Tag: 矩阵

使用数组的矩阵乘法

我正在尝试使用多维数组( [2][2] )制作一个简单的矩阵乘法。 我对此有点新意,我无法找到它我做错了什么。 在告诉我它是什么时,我真的很感激。 我宁愿不使用库或类似的东西,我主要是这样做,以了解它是如何工作的。 非常感谢你提前。 我在main方法中声明我的arays如下: Double[][] A={{4.00,3.00},{2.00,1.00}}; Double[][] B={{-0.500,1.500},{1.000,-2.0000}}; A * B应该返回单位矩阵。 它没有。 public static Double[][] multiplicar(Double[][] A, Double[][] B){ //the method runs and returns a matrix of the correct dimensions //(I actually changed the .length function to a specific value to eliminate //it as a possible issue), but not the correct […]

Java:使用GridLayout输入矩阵

我正在尝试编写一个可以使用GridLayout输入任意大小的矩阵的函数,但是因为我找不到一个合适的方法来提取JTextField值来填充’mat’var(参见下面的FIXME) 。 /** * @mat: matrix declared in main (eg: mat[][] = new int[3][3];) * @rows: number of matrix rows (eg: int rows = 3;) * @columns: number of matrix columns (eg: int columns = 3;) */ public static int[][] inputMatrix(int[][] mat, int rows, int columns) { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(rows,columns)); for […]

Java矩阵库

我想知道任何一个着名的Java矩阵库,比如Colt或EJML,是否实际上提供了与MatLab类似的function? 例如,我似乎无法在API简单方法的定义中找到彼此相加或相减两个矩阵/向量的任何地方,这似乎是最常用的操作。 我错过了什么吗?