#include <MatrixN.h>
Inheritance diagram for Physsim::MatrixN:

Public Member Functions | |
| MatrixN () | |
| Default constructor - constructs an empty matrix. | |
| MatrixN (unsigned rows, unsigned columns) | |
| Constructs a rows x columns dimensional (unitialized) matrix. | |
| MatrixN (const MatrixN &source) | |
| Copy constructor. | |
| MatrixN (unsigned rows, unsigned columns, const boost::shared_array< Real > array) | |
| Constructs a matrix from an array. | |
| MatrixN (const VectorN &v, bool transpose) | |
| Constructs a matrix from a vector. | |
| VectorN | get_row (unsigned i) const |
| Gets the specified row of the matrix. | |
| VectorN | get_column (unsigned i) const |
| Gets the specified column of the matrix. | |
| void | get_row (unsigned i, VectorN &result) const |
| Gets the specified row of the matrix. | |
| void | get_column (unsigned i, VectorN &result) const |
| Gets the specified column of the matrix. | |
| unsigned | rows () const |
| unsigned | columns () const |
| void | resize (unsigned rows, unsigned columns, bool preserve=false) |
| Resizes this matrix, optionally preserving its existing elements. | |
| void | set_row (unsigned i, const VectorN &v) |
| Sets the specified row of the matrix. | |
| void | set_column (unsigned i, const VectorN &v) |
| Sets the specified column of the matrix. | |
| void | set_sub_matrix (unsigned row_start, unsigned col_start, const MatrixN &m) |
| Sets the specified sub matrix. | |
| MatrixN | get_sub_matrix (unsigned row_start, unsigned row_end, unsigned col_start, unsigned col_end) const |
| Gets the specified sub matrix. | |
| bool | epsilon_equals (const MatrixN &m, Real epsilon) |
| Determines whether this matrix is equal to another within the specified tolerance. | |
| void | set_zero () |
| Sets the matrix to the zero matrix. | |
| virtual void | transpose () |
| Sets this matrix to its transpose. | |
| void | augment_rows (const MatrixN &m) |
| Augments the rows of this matrix. | |
| void | augment_rows (const VectorN &v) |
| Augments the rows of this matrix with a vector. | |
| void | augment_columns (const MatrixN &m) |
| Augments the columns of this matrix. | |
| void | augment_columns (const VectorN &v) |
| Augments the columns of this matrix with a vector. | |
| virtual void | operator= (const MatrixN &source) |
| Sets this matrix to that of another. | |
| VectorN | operator * (const VectorN &v) const |
| Multiplies this matrix by a vector. | |
| MatrixN | operator * (const MatrixN &m) const |
| MatrixN | operator * (Real scalar) const |
| Multiplies this matrix by a scalar. | |
| MatrixN | operator/ (Real scalar) const |
| boost::shared_array< Real > | operator * (boost::shared_array< Real > array) const |
| MatrixN | operator+ (const MatrixN &m) const |
| Adds two matrices together. | |
| void | operator+= (const MatrixN &m) |
| Adds m to *this in place. | |
| MatrixN | operator- (const MatrixN &m) const |
| Subtracts m2 from m1. | |
| MatrixN | operator- () const |
| Returns the negation of this matrix. | |
| void | operator-= (const MatrixN &m) |
| Subtracts m from *this in place. | |
| void | operator/= (Real scalar) |
| Divides this matrix by a scalar in place. | |
| void | operator *= (Real scalar) |
| Multiplies this matrix by another in place. | |
| void | operator *= (const MatrixN &m) |
| Multiplies this matrix by another in place. | |
| Real & | operator() (const unsigned i, const unsigned j) |
| Real | operator() (const unsigned i, const unsigned j) const |
| boost::shared_array< Real > & | data () |
|
const boost::shared_array< Real > & | data () const |
Static Public Member Functions | |
| static bool | epsilon_equals (const MatrixN &m1, const MatrixN &m2, Real epsilon) |
| Determines whether two matrices are equal within the specified tolerance. | |
| static MatrixN | zero (unsigned rows, unsigned columns) |
| static MatrixN | transpose (const MatrixN &m) |
| Determines the transpose of the matrix. | |
| static void | mult (const MatrixN &m1, const MatrixN &m2, MatrixN &result) |
| Multiplies two matrices and returns the result in a third matrix. | |
| static void | mult (const MatrixN &m, const VectorN &v, VectorN &result) |
| Multiplies a matrix by a vector and returns the result in a passed vector. | |
| static void | mult_transpose (const MatrixN &m, const VectorN &v, VectorN &result) |
| Multiplies the transpose of a matrix by a vector. | |
| static MatrixN | mult (const MatrixN &m1, const MatrixN &m2) |
| Multiplies this matrix by another matrix. | |
| static VectorN | mult (const MatrixN &m, const VectorN &v) |
| Multiplies this matrix by a vector. | |
| static VectorN | mult_transpose (const MatrixN &m, const VectorN &v) |
| Multiplies the transpose of this matrix by a vector. | |
Protected Attributes | |
| boost::shared_array< Real > | _data |
| unsigned | _rows |
| unsigned | _columns |
The underlying data is stored in column-major format (e.g., the element at row 1, column 0 is the second element in the flat array).
| MatrixN::MatrixN | ( | unsigned | rows, | |
| unsigned | columns, | |||
| const boost::shared_array< Real > | array | |||
| ) |
Constructs a matrix from an array.
| rows | the number of rows of the matrix | |
| columns | the number of columns of the matrix | |
| array | an array of rows*columns Real values in row-major format |
| MatrixN::MatrixN | ( | const VectorN & | v, | |
| bool | transpose | |||
| ) |
Constructs a matrix from a vector.
| v | the vector | |
| transpose | if true the matrix will be transposed (1xn instead of nx1) |
| VectorN MatrixN::get_row | ( | unsigned | i | ) | const |
Gets the specified row of the matrix.
| i | the 0-index of the row |
| VectorN MatrixN::get_column | ( | unsigned | i | ) | const |
Gets the specified column of the matrix.
| i | the 0-index of the column |
| void MatrixN::get_row | ( | unsigned | i, | |
| VectorN & | result | |||
| ) | const |
Gets the specified row of the matrix.
| i | the 0-index of the row |
| void MatrixN::set_row | ( | unsigned | i, | |
| const VectorN & | v | |||
| ) |
Sets the specified row of the matrix.
| i | the 0-index of the row | |
| v | a vector of the same length as the number of columns of this |
| void MatrixN::set_column | ( | unsigned | i, | |
| const VectorN & | v | |||
| ) |
Sets the specified column of the matrix.
| i | the 0-index of the column | |
| v | a vector of the same length as the number of rows of this |
| void MatrixN::set_sub_matrix | ( | unsigned | row_start, | |
| unsigned | col_start, | |||
| const MatrixN & | m | |||
| ) |
Sets the specified sub matrix.
| row_start | the row to start (inclusive) | |
| col_start | the row to end (inclusive) | |
| m | the source matrix |
| MatrixN MatrixN::get_sub_matrix | ( | unsigned | row_start, | |
| unsigned | row_end, | |||
| unsigned | col_start, | |||
| unsigned | col_end | |||
| ) | const |
Gets the specified sub matrix.
| row_start | the row to start (inclusive) | |
| row_end | the row to end (inclusive) | |
| col_start | the column to start (inclusive) | |
| col_end | the column to end (inclusive) |
| void MatrixN::augment_rows | ( | const MatrixN & | m | ) |
Augments the rows of this matrix.
This method stacks this matrix on top of the matrix m. Thus, both this and m must have the same number of columns.
| void MatrixN::augment_rows | ( | const VectorN & | v | ) |
Augments the rows of this matrix with a vector.
This method stacks this matrix above the transposed vector v. Thus, the columns of this must equal the length of v.
| void MatrixN::augment_columns | ( | const MatrixN & | m | ) |
Augments the columns of this matrix.
This method stacks this matrix to the left of the matrix m. Thus, both this and m must have the same number of rows.
| void MatrixN::augment_columns | ( | const VectorN & | v | ) |
Augments the columns of this matrix with a vector.
This method stacks this matrix to the left of the vector v. Thus, the rows of this must equal the length of v.
1.5.1