class DenseMatrix implements Serializable {

    public DenseMatrix solve(DenseMatrix matB) {
        assert (this.numRows() == matB.numRows());

        if (this.m == this.n) {
            if (this.isSymmetric()) {
                DenseMatrix matA = this.clone();
                DenseMatrix x = matB.clone();
                LinearSolver.symmetricIndefiniteSolve(matA, x);
                return x;
            } else {
                DenseMatrix matA = this.clone();
                DenseMatrix x = matB.clone();
                LinearSolver.nonSymmetricSolve(matA, x);
                return x;
            }
        } else if (this.m > this.n) {
            DenseMatrix matA = this.clone();
            DenseMatrix x = matB.clone();
            LeastSquareSolver.solve(matA, x);
            return x.getSubMatrix(0, this.n, 0, matB.numCols());
        } else { // this.m < this.n, indicates an under determined linear system of equations.
            DenseMatrix matA = this.clone();
            DenseMatrix x = new DenseMatrix(matA.numCols(), matB.numCols());
            x.setSubMatrix(matB, 0, matB.numRows(), 0, matB.numCols());
            LinearSolver.underDeterminedSolve(matA, x);
            return x;
        }
    }

    public  DenseMatrix();
    public  DenseMatrix(int m, int n);
    public  DenseMatrix(int m, int n, double[] data);
    public  DenseMatrix(int m, int n, double[] data, boolean inRowMajor);
    public  DenseMatrix(double[][] data);

}