Skip to content

Function lookup has some type error in index array #62

@MarkJoe

Description

@MarkJoe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions