This class implements matrices, in the linear-algebra sense, restricted to integer-valued elements.
More...
|
| Int_matrix () |
| Default ctor builds a matrix of zero rows, zero columns. More...
|
|
| Int_matrix (int rows, int cols) |
| Ctor builds a matrix of specified number of rows and columns. More...
|
|
| Int_matrix (unsigned rows, unsigned cols) |
| Ctor builds a matrix of specified number of rows and columns. More...
|
|
| Int_matrix (unsigned rows, unsigned cols, Value_type val) |
| Ctor builds a matrix of specified number of rows and columns. More...
|
|
| Int_matrix (unsigned long rows, unsigned long cols) |
| Ctor builds a matrix of specified number of rows and columns. More...
|
|
| Int_matrix (unsigned long rows, unsigned long cols, Value_type val) |
| Ctor builds a matrix of specified number of rows and columns. More...
|
|
| Int_matrix (int rows, int cols, Value_type num) |
| Ctor builds a matrix of specified size, all entries set to num. More...
|
|
| Int_matrix (int rows, int cols, const Value_type *data) |
| Ctor builds a matrix and initializes entries from an array. More...
|
|
| Int_matrix (Impl_type *mat_ptr) |
| Conversion ctor: claim ownership of an existing int matrix pointer (i.e., make a shallow copy). More...
|
|
| Int_matrix (const Impl_type &mat_ref) |
| Ctor copies contents (i.e., a deep copy) of an existing C-struct matrix. More...
|
|
| Int_matrix (const std::string &file_name) |
| Read matrix from file. More...
|
|
| Int_matrix (const Int_matrix &mat_ref) |
| Copy ctor. More...
|
|
| ~Int_matrix () |
|
Int_matrix & | zero_out (int num_rows, int num_cols) |
| Resize matrix, replace contents with the identity matrix. More...
|
|
Int_matrix & | zero_out (int rows) |
| Resize matrix to be square, and clobber contents with zeroes. More...
|
|
Int_matrix & | zero_out () |
| Clobber contents of matrix with zeroes. More...
|
|
Int_matrix & | operator= (const Impl_type &mat_ref) |
| Clone of zero_out(int,int) More...
|
|
Int_matrix & | operator= (const Int_matrix &src) |
| Assign contents from a kjb::Int_matrix, a C++ object. More...
|
|
void | swap (Int_matrix &other) |
| Swap the representations of two matrices. More...
|
|
int | get_num_rows () const |
| Return the number of rows in the matrix. More...
|
|
int | get_num_cols () const |
| Return the number of columns in the matrix. More...
|
|
int | get_length () const |
| Return the number of elements in the matrix. More...
|
|
const Impl_type * | get_c_matrix () const |
| Get const pointer to the underlying kjb_c::Int_matrix C struct. More...
|
|
Impl_type * | get_underlying_representation_with_guilt () |
| Get pointer to the underlying kjb_c::Matrix C struct. More...
|
|
Value_type ** | ptr_to_storage_area () const |
| Access a pointer to the underlying implementation, use with care. More...
|
|
Int_matrix & | resize (int new_rows, int new_cols, Value_type pad=Value_type(0)) |
| Resize this matrix, retaining previous values. More...
|
|
Int_matrix & | realloc (int new_rows, int new_cols) |
| Resize this matrix, discarding previous values (faster than resize, because storage is reused) More...
|
|
Int_matrix | transpose () |
| Transpose this matrix, in-place. More...
|
|
void | check_bounds (int row, int col) const |
| Test whether the given row and column indices are valid. More...
|
|
Value_type & | operator[] (int i) |
| Subscript matrix like a one-dimensional C array, e.g., A[10], using row-major ordering, and returning an lvalue. More...
|
|
Value_type | operator[] (int i) const |
| Subscript matrix like a one-dimensional C array, e.g., A[10], using row-major ordering, and returning an rvalue. More...
|
|
Value_type & | operator() (int i) |
| MATLAB-style one-dimensional subscript of matrix, e.g., A(10), using row-major ordering, and returning an lvalue. More...
|
|
Value_type | operator() (int i) const |
| MATLAB-style one-dimensional subscript of matrix, e.g., A(10), using row-major ordering, and returning an rvalue. More...
|
|
Value_type & | operator() (int row, int col) |
| Access matrix like a Fortran or MATLAB two-dimensional array, e.g., A(2,4), and return an lvalue. More...
|
|
Value_type | operator() (int row, int col) const |
| Access matrix like a Fortran or MATLAB two-dimensional array, e.g., A(2,4), and return an rvalue. More...
|
|
Value_type & | at (int i) |
| Access matrix like a one-dimensional array, using row-major ordering, and returning an lvalue. More...
|
|
Value_type | at (int i) const |
| Access matrix like a one-dimensional array, using row-major ordering, and returning an rvalue. More...
|
|
Value_type & | at (int row, int col) |
| Access matrix with bounds checking and return an lvalue. More...
|
|
Value_type | at (int row, int col) const |
| Access matrix with bounds checking and return an rvalue. More...
|
|
Vec_type | get_row (int row) const |
| Return a specified row of this matrix, in the form of an Int_vector. More...
|
|
Vec_type | get_col (int col) const |
| Return a specified column of this matrix, in the form of an Int_vector. More...
|
|
template<class Generic_vector > |
void | set_row (int row, const Generic_vector &v) |
| Replace a row of the matrix with the given vector. More...
|
|
template<class Iterator > |
void | set_row (int row, Iterator begin, Iterator end) |
| Dispatch for set_row. Don't call directly. More...
|
|
template<class Generic_vector > |
void | set_col (int col, const Generic_vector &v) |
| Replace a column of the matrix with the given vector. "vector" can be any collection of values convertible to int. More...
|
|
template<class Iterator > |
void | set_col (int col, Iterator begin, Iterator end) |
| Dispatch for set_col. Don't call directly. More...
|
|
int | write (const char *filename=0) const |
| Writes the matrix contents to a file specified by name. More...
|
|
Int_matrix & | operator*= (const Int_matrix &op2) |
| Compute product of this matrix (on the left) and another, and replace this matrix with the result. More...
|
|
Int_matrix & | multiply (const Int_matrix &op2) |
| Compute product of this matrix (on the left) and another, and replace this matrix with the result, like *=. More...
|
|
Int_matrix & | operator*= (Value_type op2) |
| Multiply this matrix by a scalar, in place. More...
|
|
Int_matrix & | multiply (Value_type op2) |
| Multiply this matrix by a scalar, in place. More...
|
|
Int_matrix & | operator/= (Int_matrix::Value_type op2) |
| Perform integer division on each entry in the matrix by a scalar value. More...
|
|
Int_matrix & | divide (Int_matrix::Value_type op2) |
| Perform integer division on each entry in the matrix by a scalar value. More...
|
|
Int_matrix & | operator+= (const Int_matrix &op2) |
| Add, in place, a matrix to this matrix. More...
|
|
Int_matrix & | add (const Int_matrix &op2) |
| Add, in place, a matrix to this matrix. More...
|
|
Int_matrix & | operator-= (const Int_matrix &op2) |
| Subtract another matrix from this matrix, in place. More...
|
|
Int_matrix & | subtract (const Int_matrix &op2) |
| Subtract another matrix from this matrix, in place. More...
|
|
Int_matrix & | negate () |
| Transform this matrix into the additive inverse of its former value, in place. More...
|
|
Mat_type & | mapcar (Mapper) |
| Transform the elements of a matrix. More...
|
|
This class implements matrices, in the linear-algebra sense, restricted to integer-valued elements.
For better maintainability, refer to the element type using this class's Value_type typedef, instead of referring to 'int' directly.
Most methods of this class are implemented in the C language portion of the KJB library, with this class forming a thin (usually inlined) layer.