-
Notifications
You must be signed in to change notification settings - Fork 5
Description
First import ArrayFire like this
import ArrayFire as AF
Then the following works with the Haskell ArrayFire bindings
m = matrix @double (5,3) [[1,0,9.8,7.999,65,21],[0.9,6.4,2.2,1.2,2.3],[0,0,8.3,3.2,4.3]]
idx = vector @double 2 [0,2]
AF.lookup m idx 1
Using complex matrices will result in an error:
m = matrix @(Complex Double) (5,3) [[1 :+ 1,0,9.8,7.999,65,21],[0.9,6.4,2.2,1.2,2.3],[0,0,8.3,3.2,4.3]]
idx = vector @double 2 [0,2]
AF.lookup m idx 1
leads to the error
"... Couldn't match type ‘Double’ with ‘Complex Double’..."
The following
m = matrix @(Complex Double) (5,3) [[1 :+ 1,0,9.8,7.999,65,21],[0.9,6.4,2.2,1.2,2.3],[0,0,8.3,3.2,4.3]]
idz = vector @(Complex Double) 2 [0,2]
AF.lookup m idz 1
leads to
*** Exception: AFException {afExceptionType = ArgError, afExceptionCode = 202, afExceptionMsg = "Invalid input argument"}
In any case, the index array has the wrong type, it should be acceptable only as
array @int
but it isn't.