///<summary> Solve A*X = B</summary>
        ///<param name="B"> right hand side</param>
        ///<returns> solution if A is square, least squares solution otherwise</returns>
        public static Matrix3d Solve(this Matrix3d mat, Matrix3d B)
        {
            LUDecomposition l      = new LUDecomposition();
            Matrix3d        retMat = l.LUDecompose(mat);

            return(mat);

            //return (m == n ? (new LUDecomposition(mat)).solve(B) :
            //                 (new QRDecomposition(mat)).Solve(B));
        }
        ///<summary>LU Decomposition</summary>
        ///<returns>LUDecomposition</returns>
        public static Matrix3d Lu(this Matrix3d mat)
        {
            LUDecomposition l = new LUDecomposition();

            return(l.LUDecompose(mat));
        }