JavaCall.jl icon indicating copy to clipboard operation
JavaCall.jl copied to clipboard

Allow multidimensional array inputs

Open davnn opened this issue 4 years ago • 2 comments

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.

davnn avatar Jan 21 '22 17:01 davnn

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 .

mkitti avatar Jan 21 '22 17:01 mkitti

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?

davnn avatar Jan 21 '22 17:01 davnn