| 78 | } |
| 79 | |
| 80 | void CSRMatrix::initializeToEmpty( unsigned m, unsigned n ) |
| 81 | { |
| 82 | _m = m; |
| 83 | _n = n; |
| 84 | |
| 85 | unsigned estimatedNumRowEntries = std::max( 2U, _n / ROW_DENSITY_ESTIMATE ); |
| 86 | _estimatedNnz = estimatedNumRowEntries * _m; |
| 87 | |
| 88 | freeMemoryIfNeeded(); |
| 89 | |
| 90 | _A = new double[_estimatedNnz]; |
| 91 | if ( !_A ) |
| 92 | throw BasisFactorizationError( BasisFactorizationError::ALLOCATION_FAILED, "CSRMatrix::A" ); |
| 93 | |
| 94 | _IA = new unsigned[_m + 1]; |
| 95 | if ( !_IA ) |
| 96 | throw BasisFactorizationError( BasisFactorizationError::ALLOCATION_FAILED, |
| 97 | "CSRMatrix::IA" ); |
| 98 | |
| 99 | _JA = new unsigned[_estimatedNnz]; |
| 100 | if ( !_JA ) |
| 101 | throw BasisFactorizationError( BasisFactorizationError::ALLOCATION_FAILED, |
| 102 | "CSRMatrix::JA" ); |
| 103 | |
| 104 | std::fill_n( _IA, _m + 1, 0.0 ); |
| 105 | _nnz = 0; |
| 106 | } |
| 107 | |
| 108 | void CSRMatrix::increaseCapacity() |
| 109 | { |
no test coverage detected