/** * 矩阵除法运算 A/B等价于A乘以B的逆矩阵 * * @param b * @return */ public Matrix divide(Matrix b) { if (b == null) { return null; } if (!this.isSquareMatrix() || (!b.isSquareMatrix()) || (this.matrixData.length != b.getMatrixData().length)) { System.out.println("矩阵的除法要求两个矩阵都是方阵,而且行数相等!"); return null; } // 返回本矩阵与b的逆矩阵的乘积 return this.multiply(b.inverseMatrix()); }