fastr icon indicating copy to clipboard operation
fastr copied to clipboard

java interop with R error?

Open ravinder387 opened this issue 2 years ago • 2 comments

I write a methods on double[][] type in java. when i add this class to R it gives me internal error. what's correspondence R data type to java data type Screenshot from 2022-12-18 21-03-50

ravinder387 avatar Dec 22 '22 11:12 ravinder387

Hello @ravinder387,

could you please also include the Java code of MatrixSqrt?

steve-s avatar Jan 02 '23 09:01 steve-s

public class Array2D {

public double[][] jsqrt(double[][] vec) {
    // output
    double[][] output = new double[vec.length][vec[0].length];
    
    // iterate col-wise
    for (int i = 0; i < vec.length; i++) {
        for (int j = 0; j < vec[0].length; j++) {
            output[i][j] = Math.sqrt(vec[i][j]);
        }

    }
    
    // return
    return output;
   
}

}

ravinder387 avatar Jan 03 '23 08:01 ravinder387