Reads in a {@link ZMatrixRMaj} from the IO stream where the user specifies the matrix dimensions.

@param numRows Number of rows in the matrix
@param numCols Number of columns in the matrix
@return ZMatrixRMaj
@throws IOException
358093
public ZMatrixRMaj readZDRM(int numRows, int numCols) throws IOException {

        ZMatrixRMaj A = new ZMatrixRMaj(numRows,numCols);

        int wordsCol = numCols*2;

        for( int i = 0; i < numRows; i++ ) {
            List<String> words = extractWords();
            if( words == null )
                throw new IOException("Too few rows found. expected "+numRows+" actual "+i);

            if( words.size() != wordsCol )
                throw new IOException("Unexpected number of words in column. Found "+words.size()+" expected "+wordsCol);
            for( int j = 0; j < wordsCol; j += 2 ) {

                double real = Double.parseDouble(words.get(j));
                double imaginary = Double.parseDouble(words.get(j+1));

                A.set(i, j, real, imaginary);
            }
        }

        return A;
    }
1149210
public static ZMatrixRMaj[] columnsToVector(ZMatrixRMaj A, ZMatrixRMaj[] v)
    {
        ZMatrixRMaj[]ret;
        if( v == null || v.length < A.numCols ) {
            ret = new ZMatrixRMaj[ A.numCols ];
        } else {
            ret = v;
        }

        for( int i = 0; i < ret.length; i++ ) {
            if( ret[i] == null ) {
                ret[i] = new ZMatrixRMaj(A.numRows,1);
            } else {
                ret[i].reshape(A.numRows,1);
            }

            ZMatrixRMaj u = ret[i];

            int indexU = 0;
            for( int j = 0; j < A.numRows; j++ ) {
                int indexA = A.getIndex(j,i);
                u.data[indexU++] = A.data[indexA++];
                u.data[indexU++] = A.data[indexA];
            }
        }

        return ret;
    }
1053997
public void setMaxSize( int maxRows , int maxCols )
    {
        this.maxRows = maxRows; this.maxCols = maxCols;

        Q = new ZMatrixRMaj(maxRows,maxRows);
        Qt = new ZMatrixRMaj(maxRows,maxRows);
        R = new ZMatrixRMaj(maxRows,maxCols);

        Y = new ZMatrixRMaj(maxRows,1);
        Z = new ZMatrixRMaj(maxRows,1);
    }
319942
public IMatrix mul(IMatrix b) {
        IMatrix result = new IMatrix(rows, columns);
        mul(b, result);
        return result;
    }
297508
public FMatrixRMaj readFDRM(int numRows, int numCols) throws IOException {

        FMatrixRMaj A = new FMatrixRMaj(numRows,numCols);

        for( int i = 0; i < numRows; i++ ) {
            List<String> words = extractWords();
            if( words == null )
                throw new IOException("Too few rows found. expected "+numRows+" actual "+i);

            if( words.size() != numCols )
                throw new IOException("Unexpected number of words in column. Found "+words.size()+" expected "+numCols);
            for( int j = 0; j < numCols; j++ ) {
                A.set(i,j,Float.parseFloat(words.get(j)));
            }
        }

        return A;
    }
771897
public RowVector getRow(int r) throws MatrixException
    {
        if ((r < 0) || (r >= nRows)) {
            throw new MatrixException(MatrixException.INVALID_INDEX);
        }

        RowVector rv = new RowVector(nCols);
        for (int c = 0; c < nCols; ++c) {
            rv.values[0][c] = this.values[r][c];
        }

        return rv;
    }
1210165
public static DMatrixRMaj parse_DDRM(String s , int numColumns )
    {
        String []vals = s.split("(\\s)+");

        // there is the possibility the first element could be empty
        int start = vals[0].isEmpty() ? 1 : 0;

        // covert it from string to doubles
        int numRows = (vals.length-start) / numColumns;

        DMatrixRMaj ret = new DMatrixRMaj(numRows,numColumns);

        int index = start;
        for( int i = 0; i < numRows; i++ ) {
            for( int j = 0; j < numColumns; j++ ) {
                ret.set(i,j, Double.parseDouble(vals[ index++ ]));
            }
        }

        return ret;
    }
1287403
public static RowMajorSparseMatrix from1DArray(int rows, int columns, double[] array) {
        return CRSMatrix.from1DArray(rows, columns, array);
    }
164347
public CMatrixRMaj readCDRM(int numRows, int numCols) throws IOException {

        CMatrixRMaj A = new CMatrixRMaj(numRows,numCols);

        int wordsCol = numCols*2;

        for( int i = 0; i < numRows; i++ ) {
            List<String> words = extractWords();
            if( words == null )
                throw new IOException("Too few rows found. expected "+numRows+" actual "+i);

            if( words.size() != wordsCol )
                throw new IOException("Unexpected number of words in column. Found "+words.size()+" expected "+wordsCol);
            for( int j = 0; j < wordsCol; j += 2 ) {

                float real = Float.parseFloat(words.get(j));
                float imaginary = Float.parseFloat(words.get(j+1));

                A.set(i, j, real, imaginary);
            }
        }

        return A;
    }
886626
@Override
    public void setExpectedMaxSize( int numRows , int numCols ) {
        super.setExpectedMaxSize(numRows,numCols);

        // if the matrix that is being decomposed is smaller than the block we really don't
        // see the B matrix.
        if( numRows < blockWidth)
            B = new DMatrixRMaj(0,0);
        else
            B = new DMatrixRMaj(blockWidth,maxWidth);

        chol = new CholeskyBlockHelper_DDRM(blockWidth);
    }
1298571
public DMatrixRMaj getR() {
        DMatrixRMaj R = new DMatrixRMaj(QR.numRows,QR.numCols);
        int N = Math.min(QR.numCols,QR.numRows);

        for( int i = 0; i < N; i++ ) {
            for( int j = i; j < QR.numCols; j++ ) {
                R.unsafe_set(i,j, QR.unsafe_get(i,j));
            }
        }

        return R;
    }
229214
@Override
    public ZMatrixRMaj getR(ZMatrixRMaj R, boolean compact) {
        if( compact )
            R = UtilDecompositons_ZDRM.checkZerosLT(R,minLength,numCols);
        else
            R = UtilDecompositons_ZDRM.checkZerosLT(R,numRows,numCols);

        for( int i = 0; i < R.numRows; i++ ) {
            for( int j = i; j < R.numCols; j++ ) {
                int index = QR.getIndex(j,i);
                R.set(i,j,QR.data[index],QR.data[index+1]);
            }
        }

        return R;
    }
999194
int numDocs() throws IOException
   {
      if (indexNames.size() == 0)
      {
         return volatileIndex.getNumDocuments();
      }
      else
      {
         CachingMultiIndexReader reader = getIndexReader();
         try
         {
            return reader.numDocs();
         }
         finally
         {
            reader.release();
         }
      }
   }
534369
public function addRow($numCols=NULL){
		$row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1),$numCols);
		$this->rows[]=$row;
		return $row;
	}
462156
public static DenseMatrix matrix(int nrows, int ncols, double value) {
        if (nlmatrixOnes != null) {
            try {
                return (DenseMatrix) nlmatrixOnes.newInstance(nrows, ncols, value);
            } catch (Exception e) {
                logger.error("Failed to call NLMatrix(int, int, double): {}", e);
            }
        }

        return new JMatrix(nrows, ncols, value);
    }
496746
private Matrix<Double> generateRandomMatrix(final int nRows, final int nColumns) {
    final List<List<Double>> rows = new ArrayList<>(nRows);
    final Random random = new Random();
    for (int i = 0; i < nRows; i++) {
      final List<Double> row = new ArrayList<>(nColumns);
      for (int j = 0; j < nColumns; j++) {
        row.add(random.nextDouble());
      }
      rows.add(row);
    }
    return new RowMatrix(rows);
  }
1144392
@Override
    public DMatrixRMaj getA() {
        if( A.data.length < numRows*numCols ) {
            A = new DMatrixRMaj(numRows,numCols);
        }
        A.reshape(numRows,numCols, false);
        CommonOps_DDRM.mult(Q,R,A);

        return A;
    }