求一道Java题的答案 请高手指教!
设计和编写代表矩阵的Matrix类。该类包括矩阵行列数变量introws和intcols,矩阵数据数组doubledata[][],构造方法Matrix()、Matrix...
设计和编写代表矩阵的Matrix类。该类包括矩阵行列数变量int rows和int cols,矩阵数据数组double data[][],构造方法Matrix()、Matrix(int rows,int cols)、Matrix(int rows,int cols,double data[][]),获取某元素值的方法getData(int row,int col),设置某元素值的方法setData(int row,int col,double value),计算两个矩阵的乘积的方法multiply(Matrix m)以及toString()等内容
展开
展开全部
public class Matrix {
public Matrix(int rows, int cols, double[][] data) {
this.rows = rows;
this.cols = cols;
this.data = data;
}
public Matrix(int rows, int cols) {
this.rows = rows;
this.cols = cols;
}
public Matrix() {
}
public int rows;
public int cols;
public double[][] data;
public double[][] getData(int row,int col){
return null;
}
public void setData (int row,int col,double value){
}
public void multiply(Matrix m){
}
@Override
public String toString() {
return super.toString();
}
}
public Matrix(int rows, int cols, double[][] data) {
this.rows = rows;
this.cols = cols;
this.data = data;
}
public Matrix(int rows, int cols) {
this.rows = rows;
this.cols = cols;
}
public Matrix() {
}
public int rows;
public int cols;
public double[][] data;
public double[][] getData(int row,int col){
return null;
}
public void setData (int row,int col,double value){
}
public void multiply(Matrix m){
}
@Override
public String toString() {
return super.toString();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询