private bool setup(FMatrixRMaj orig) { transposed = orig.numCols > orig.numRows; // flag what should be computed and what should not be computed if (transposed) { computeU = prefComputeV; computeV = prefComputeU; _numRowsT = orig.numCols; _numColsT = orig.numRows; } else { computeU = prefComputeU; computeV = prefComputeV; _numRowsT = orig.numRows; _numColsT = orig.numCols; } _numRows = orig.numRows; _numCols = orig.numCols; if (_numRows == 0 || _numCols == 0) { return(false); } if (diag == null || diag.Length < _numColsT) { diag = new float[_numColsT]; off = new float[_numColsT - 1]; } // if it is a tall matrix and U is not needed then there is faster decomposition algorithm if (canUseTallBidiagonal && _numRows > _numCols * 2 && !computeU) { if (bidiag == null || !(bidiag is BidiagonalDecompositionTall_FDRM)) { bidiag = new BidiagonalDecompositionTall_FDRM(); } } else if (bidiag == null || !(bidiag is BidiagonalDecompositionRow_FDRM)) { bidiag = new BidiagonalDecompositionRow_FDRM(); } return(true); }