-3
public class Matrix {
public static int a = 0;
public static int b = 0;
public double myArray[][];
public Matrix(double a[][]) {
this.myArray = a;
}
public Matrix(int b, Vector... vectors) {
double myArray[][] = new double[vectors.length][];
int row = vectors.length;
Matrix.a = row;
int column = vectors[0].getYourArray().length;
Matrix.b = column;
for (int i = 0; i < row; i++) {
myArray[i] = new double[row];
}
for (int i = 0; i < row; i++) {
for (int j = 0; j < column; j++) {
if (b == 0) {
double[] a = vectors[i].getYourArray();
myArray[i][j] = a[j];
} else {
myArray[j][i] = vectors[i].getYourArray()[j];
}
}
}
}
public class Vector {
double yourArray[];
public double[] getYourArray() {
return yourArray;
}
public void setYourArray(double[] yourArray) {
this.yourArray = yourArray;
}
public Vector(double... yourArray) {
this.yourArray = yourArray;
}
}
}
创建2个矢量阵列,并将它们发送到载体类来制造阵列,其包括这两个向量参数,然后发送到矩阵类创建与矢量阵列的维数矩阵确定矢量阵列长度
的问题是,我如何确定新矩阵的行和列?
我不能写一个正确的代码的家伙请帮我
获取行数(第1维)和最大列数(第2维)。你走了。 – Thomas