public double[] solveLinearSet(double[] bvec){
    	    double[] xvec = null;
    	    if(this.numberOfRows==this.numberOfColumns){
    	        // square matrix - LU decomposition used
        	    Matrix ludmat =	this.luDecomp();
       	        xvec = ludmat.luBackSub(bvec);
       	    }
       	    else{
       	        if(this.numberOfRows>this.numberOfColumns){
       	            // overdetermined equations - least squares used - must be used with care
       	            int n = bvec.length;
       	            if(this.numberOfRows!=n)throw new IllegalArgumentException("Overdetermined equation solution - vector length is not equal to matrix column length");
       	            Matrix avecT = this.transpose();
       	            double[][] avec = avecT.getArrayCopy();
       	            Regression reg = new Regression(avec, bvec);
                    reg.linearGeneral();
                    xvec = reg.getCoeff();
       	        }
       	        else{
       	            throw new IllegalArgumentException("This class does not handle underdetermined equations");
       	        }
       	    }
       	    return xvec;
    	}