/** * Build a sparse matrix with the supplied row and column dimensions. * * @param rowDimension Number of rows of the matrix. * @param columnDimension Number of columns of the matrix. * @throws NotStrictlyPositiveException if row or column dimension is not * positive. * @throws NumberIsTooLargeException if the total number of entries of the * matrix is larger than {@code Integer.MAX_VALUE}. */ public OpenMapRealMatrix(int rowDimension, int columnDimension) : base(rowDimension, columnDimension) { long lRow = rowDimension; long lCol = columnDimension; if (lRow * lCol >= Integer.MAX_VALUE) { throw new Exception("NumberIsTooLargeException"); } rows = rowDimension; columns = columnDimension; entries = new OpenIntToDoubleHashMap(0.0); }
/// <summary> /// Build a sparse matrix with the supplied row and column dimensions. /// </summary> /// <param name="rowDimension">Number of rows of the matrix.</param> /// <param name="columnDimension">Number of columns of the matrix.</param> /// <exception cref="NotStrictlyPositiveException"> if row or column dimension is not /// positive.</exception> /// <exception cref="NumberIsTooLargeException"> if the total number of entries of the /// matrix is larger than <c>Int32.MaxValue</c>.</exception> public OpenMapRealMatrix(int rowDimension, int columnDimension) : base(rowDimension, columnDimension) { long lRow = rowDimension; long lCol = columnDimension; if (lRow * lCol >= Int32.MaxValue) { throw new NumberIsTooLargeException <Int64, Int32>(lRow * lCol, Int32.MaxValue, false); } this.rows = rowDimension; this.columns = columnDimension; this.entries = new OpenIntToDoubleHashMap(0.0); }
/// <summary> /// Build a matrix by copying another one. /// </summary> /// <param name="matrix">matrix to copy.</param> public OpenMapRealMatrix(OpenMapRealMatrix matrix) { this.rows = matrix.rows; this.columns = matrix.columns; this.entries = new OpenIntToDoubleHashMap(matrix.entries); }