24 #ifndef PPL_Matrix_inlines_hh
25 #define PPL_Matrix_inlines_hh 1
29 template <
typename Row>
32 return std::vector<Row>().max_size();
35 template <
typename Row>
38 return Row::max_size();
41 template <
typename Row>
49 template <
typename Row>
55 template <
typename Row>
61 template <
typename Row>
64 return rows.capacity();
67 template <
typename Row>
70 return num_rows() == 0;
73 template <
typename Row>
79 template <
typename Row>
83 rows.reserve(requested_capacity);
86 template <
typename Row>
89 resize(num_rows() + n, num_columns() + m);
92 template <
typename Row>
95 resize(num_rows() + n, num_columns());
98 template <
typename Row>
105 swap(rows.back(), row);
109 template <
typename Row>
113 swap(rows.back(), x);
117 template <
typename Row>
120 resize(num_rows() - n, num_columns());
123 template <
typename Row>
126 rows.erase(first, last);
129 template <
typename Row>
132 resize(num_rows(), num_columns() + n);
135 template <
typename Row>
138 PPL_ASSERT(n <= num_columns());
139 resize(num_rows(), num_columns() - n);
142 template <
typename Row>
148 template <
typename Row>
154 template <
typename Row>
160 template <
typename Row>
166 template <
typename Row>
172 template <
typename Row>
175 PPL_ASSERT(i < rows.size());
179 template <
typename Row>
182 PPL_ASSERT(i < rows.size());
186 template <
typename Row>
192 template <
typename Row>
200 #endif // !defined(PPL_Matrix_inlines_hh)
void swap(Matrix< Row > &x, Matrix< Row > &y)
void swap(CO_Tree &x, CO_Tree &y)
size_t dimension_type
An unsigned integral type for representing space dimensions.
static dimension_type max_num_columns()
Returns the maximum number of columns of a Sparse_Matrix.
iterator end()
Returns an iterator pointing after the last row.
void remove_trailing_columns(dimension_type n)
Shrinks the matrix by removing its n trailing columns.
Swapping_Vector< Row >::iterator iterator
A sparse matrix of Coefficient.
Swapping_Vector< Row >::const_iterator const_iterator
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
void add_zero_rows_and_columns(dimension_type n, dimension_type m)
Adds n rows and m columns of zeroes to the matrix.
void add_zero_rows(dimension_type n)
Adds to the matrix n rows of zeroes.
void clear()
Equivalent to resize(0,0).
void remove_rows(iterator first, iterator last)
iterator begin()
Returns an iterator pointing to the first row.
void add_row(const Row &x)
Adds a copy of the row x at the end of the matrix.
dimension_type num_columns() const
Returns the number of columns in the matrix.
Enable_If< Is_Native< T >::value, memory_size_type >::type external_memory_in_bytes(const T &)
For native types, returns the size in bytes of the memory managed by the type of the (unused) paramet...
bool has_no_rows() const
Returns true if and only if *this has no rows.
void remove_trailing_rows(dimension_type n)
Removes from the matrix the last n rows.
dimension_type num_columns_
The number of columns in this matrix.
static dimension_type max_num_rows()
Returns the maximum number of rows of a Sparse_Matrix.
The entire library is confined to this namespace.
Swapping_Vector< Row > rows
The vector that stores the matrix's elements.
Row & operator[](dimension_type i)
Returns a reference to the i-th row.
dimension_type capacity() const
Returns the capacity of the row vector.
void reserve_rows(dimension_type n)
Reserves space for at least n rows.
void add_recycled_row(Row &y)
Adds the row y to the matrix.
void resize(dimension_type n)
Equivalent to resize(n, n).
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
void add_zero_columns(dimension_type n)
Adds n columns of zeroes to the matrix.
dimension_type num_rows() const
Returns the number of rows in the matrix.
void m_swap(Matrix &x)
Swaps (*this) with x.