JuliaInterop / JavaCall.jl

Call Java from Julia
http://juliainterop.github.io/JavaCall.jl
Other
118 stars 53 forks source link

Allow multidimensional array inputs #156

Open davnn opened 2 years ago

davnn commented 2 years ago

How could we extend JavaCall to allow passing of multidimensional arrays? E.g.

public class Test {
    public static double[][] testDoubleArray2D(double[][] array) {
        return array;
    }
}

The problem appears to be MethodError: no method matching jvalue(::Vector{Vector{Float64}}), but I'm having a hard time debugging the root cause of this issue.

mkitti commented 2 years ago

double[][] is not the correct way to represent a matrix in Java. You would need a multidimensional array class in Java to do this. For example, https://github.com/imglib/imglib2/blob/master/src/main/java/net/imglib2/img/array/ArrayImg.java .

davnn commented 2 years ago

double[][] is not the correct way to represent a matrix in Java. You would need a multidimensional array class in Java to do this. For example, https://github.com/imglib/imglib2/blob/master/src/main/java/net/imglib2/img/array/ArrayImg.java .

The library I would like to use requires a double[][] as input, I do not have an influence on that design I'm afraid. Do you suggest that I should use some Matrix library and convert the matrix to double[][] natively?