{@inheritDoc} The length of the returned row vector reflects the size of
matrix at the time of the call, which may be different from earlier calls
to {@link #columns()}.
553990
public DoubleVector getRowVector(int row) {
        DoubleVector v = getRow(row, -1, false);
        // If no row was currently assigned in the matrix, then return an empty
        // vector in its place.  Otherwise, return a view on top of the vector
        // with its current length
        return (v == null) 
            ? new CompactSparseVector(cols.get())
            : Vectors.subview(v, 0, cols.get());
    }
654667
public void setRow(int row, double[] columns) {
        checkIndices(row, columns.length - 1);

        if (cols <= columns.length)
            cols = columns.length;
        
        SparseDoubleVector rowVec = updateRow(row);

        for (int col = 0; col < cols; ++col) {
            double val = columns[col];
            rowVec.set(col, val);
        }
    }
794191
public boolean isInBounds(int row, int col) {
        return row >= 0 && col >= 0 && row < mat.getNumRows() && col < mat.getNumCols();
    }
1105627
public void setMaxSize( int maxRows , int maxCols )
    {
        this.maxRows = maxRows; this.maxCols = maxCols;

        Q = new DMatrixRMaj(maxRows,maxRows);
        R = new DMatrixRMaj(maxRows,maxCols);

        Y = new DMatrixRMaj(maxRows,1);
        Z = new DMatrixRMaj(maxRows,1);
    }
1168870
@Override
    public Matrix<T> repelem(final int rowRepeats, final int colRepeats) {
        N.checkArgument(rowRepeats > 0 && colRepeats > 0, "rowRepeats=%s and colRepeats=%s must be bigger than 0", rowRepeats, colRepeats);

        final T[][] c = N.newArray(arrayType, rows * rowRepeats);

        for (int i = 0, len = c.length; i < len; i++) {
            c[i] = N.newArray(componentType, cols * colRepeats);
        }

        for (int i = 0; i < rows; i++) {
            final T[] fr = c[i * rowRepeats];

            for (int j = 0; j < cols; j++) {
                N.copy(Array.repeat(a[i][j], colRepeats), 0, fr, j * colRepeats, colRepeats);
            }

            for (int k = 1; k < rowRepeats; k++) {
                N.copy(fr, 0, c[i * rowRepeats + k], 0, fr.length);
            }
        }

        return new Matrix<T>(c);
    }
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;
    }
1187376
function (rows) {
		var row,
			rowsLength,
			col,
			colsLength,
			columns;

		if (rows) {
			columns = [];
			rowsLength = rows.length;
			for (row = 0; row < rowsLength; row++) {
				colsLength = rows[row].length;
				for (col = 0; col < colsLength; col++) {
					if (!columns[col]) {
						columns[col] = [];
					}
					columns[col][row] = rows[row][col];
				}
			}
		}
		return columns;
	}
1117589
public static double[] colMeans (RealMatrix matrix) {
        // Get the col sums:
        double[] retval = EMatrixUtils.colSums(matrix);

        // Iterate over return value and divide by the length:
        for (int i = 0; i < retval.length; i++) {
            retval[i] = retval[i] / matrix.getRowDimension();
        }

        // Done, return col means:
        return retval;
    }
868252
public void printMatrixSize(MatrixSize size) {
        format(Locale.ENGLISH, "%10d %10d %19d%n", size.numRows(),
                size.numColumns(), size.numEntries());
    }
1358643
public static INDArray toMatrix(List<Row> rows) {
        INDArray ret = Nd4j.create(rows.size(), rows.get(0).size());
        for (int i = 0; i < ret.rows(); i++) {
            for (int j = 0; j < ret.columns(); j++) {
                ret.putScalar(i, j, rows.get(i).getDouble(j));
            }
        }
        return ret;
    }
816000
public void printVectorSize(VectorSize size) {
        format(Locale.ENGLISH, "%10d %19d%n", size.size(), size.numEntries());
    }
936201
function _calculateCellLengths($row) {
        for ($i = 0; $i < count($row); $i++) {
            if (!isset($this->_cell_lengths[$i])) {
                $this->_cell_lengths[$i] = 0;
            }
            $this->_cell_lengths[$i] = max($this->_cell_lengths[$i],
                $this->_strlen($row[$i]));
        }
    }
259553
protected void convertToColumnMajor(DMatrixRMaj A) {
        for( int x = 0; x < numCols; x++ ) {
            double colQ[] = dataQR[x];
            for( int y = 0; y < numRows; y++ ) {
                colQ[y] = A.data[y*A.numCols+x];
            }
        }
    }
1229940
def lengths( self ):
        
        return( np.array( [ math.sqrt( sum( row**2 ) ) for row in self.matrix ] ) )
702502
private String addRow(String rowId, String[] row) {
        Map<InterpolationVariable, Integer> vars = getInterpolationVariables();
        if (row.length != vars.size() - 1) {
            throw new IllegalArgumentException("Invalid numbers of columns: " + row.length + " expected: "
                                                       + (vars.size() - 1));
        }
        if (rowId == null || rowId.length() == 0) {
            rowId = getNewIdColValue();
        }
        for (Map.Entry<InterpolationVariable, Integer> entry : vars.entrySet()) {
            List<String> list = table.get(entry.getKey().getVarName());
            if (list == null) {
                list = new ArrayList<String>();
                table.put(entry.getKey().getVarName(),
                          list);
            }
            if (rowsCount != list.size()) {
                throw new IllegalArgumentException("invalid list size for " + entry.getKey() + ", expected: "
                                                           + rowsCount + " was: " + list.size());
            }
            if (ID_COLUMN_NAME.equals(entry.getKey().getVarName())) {
                list.add(rowId);
            } else {
                list.add(row[entry.getValue()]);
            }
        }
        rowsCount++;
        return rowId;
    }
1204835
private static Matrix readDenseTextMatrix(File matrix, Type matrixType,
                                              boolean transposeOnRead) 
            throws IOException {
        BufferedReader br = new BufferedReader(new FileReader(matrix));

        // unknown number of rows, so do a quick scan to determine it
        int rows = 0;
        int cols = -1;
        for (String line = null; (line = br.readLine()) != null; rows++) {
            // Create a scanner to parse out the values from the current line of
            // the file.
            Scanner s = new Scanner(line);
            s.useLocale(Locale.US);
            int vals = 0;
            // Count how many columns the row has
            for (; s.hasNextDouble(); vals++, s.nextDouble())
                ;

            // Base case if the number of columns has not been set
            if (cols == -1) 
                cols = vals;
            // Otherwise, ensure that the number of values in the current row
            // matches the number of values seen in the first
            else {
                if (cols != vals) {
                    throw new MatrixIOException("line " + (rows + 1) + 
                        " contains an inconsistent number of columns. " +
                        cols + " columns expected versus " + vals + " found.");
                }
            }
        }
        br.close();

        if (MATRIX_IO_LOGGER.isLoggable(Level.FINE)) {
            MATRIX_IO_LOGGER.fine("reading in text matrix with " + rows  +
                                  " rows and " + cols + " cols");
        }

        // Once the matrix has had its dimensions determined, re-open the file
        // to load the data into a Matrix instance.  Use a Scanner to parse the
        // text for us.
        Scanner scanner = new Scanner(matrix);
        scanner.useLocale(Locale.US);
        Matrix m = (transposeOnRead)
            ? Matrices.create(cols, rows, matrixType)
            : Matrices.create(rows, cols, matrixType);
        
        for (int row = 0; row < rows; ++row) {
            for (int col = 0; col < cols; ++col) {
                double d = scanner.nextDouble();
                if (transposeOnRead)
                    m.set(col, row, d);
                else
                    m.set(row, col, d);
            }
        }
        scanner.close();
        
        return m;
    }
298395
function(row, tmpRowDepth) {
                tmpRowDepth = tmpRowDepth || 1;

                for(var n=0; n<row.length; n++) {
                    var col = row[n];
                    // Column has children, so keep counting
                    if(YAHOO.lang.isArray(col.children)) {
                        tmpRowDepth++;
                        countMaxRowDepth(col.children, tmpRowDepth);
                        tmpRowDepth--;
                    }
                    // No children, is it the max depth?
                    else {
                        if(tmpRowDepth > maxRowDepth) {
                            maxRowDepth = tmpRowDepth;
                        }
                    }

                }
            }