[英]How do i subtract two 2d arrays of Arraylist in java?
我有arraylist
ArrayList <double[][]>deltaedge=new ArrayList<double [][]>();
其中包含2个2d双重数据类型数组,我必须从数组1中减去假设数组0,然后将结果再次存储在数组0中。
double[][] one=deltaedge.get(0);
double[][] two=deltaedge.get(1);
double[][] three=Subtraction(one,two);//call this method
deltaedge.set(0, three);// set the result to zero position
// subtract method
public double[][] Subtraction(double[][] one, double[][] two) {
double[][] C = new double[one.length][one.length];
for (int r = 0; r < 2; r++) {
for (int c = 0; c < 2; c++) {
C[r][c] = one[r][c] - two[r][c];
}
}
return C;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.