
Public Types | |
|
typedef boost::multi_array_types::index | index |
| typedef MultiArray< T, 2 > | MA2 |
| typedef Matrix2D< T > | This |
Public Member Functions | |
| template<typename T1 > | |
| void | cast_values (Matrix2D< T1 > &out) |
| Cast values. | |
| double | det () const |
| Determinant (only for 2x2). | |
| int | get_number_of_columns () const |
| Returns the number of columns in the matrix. | |
| int | get_number_of_rows () const |
| Returns the number of rows in the matrix. | |
| bool | is_square () const |
| Matrix2D (const This &v) | |
| Copy constructor. | |
| Matrix2D (int Ydim, int Xdim) | |
| Constructor. | |
| Matrix2D () | |
| Empty constructor. | |
| template<typename T1 > | |
| T & | operator() (T1 &idx) const |
| T & | operator() (int j, int i) const |
| This | operator* (const T &v) const |
| Multiplication operator for an array and a scalar. | |
| This | operator* (const This &v) const |
| Multiplication operator (element by element). | |
| This & | operator*= (const T &v) |
| Multiplication operator for an array and a scalar. | |
| This & | operator*= (const This &v) |
| Multiplication operator. | |
| This | operator+ (const T &v) const |
| Sub operator for an array and a scalar. | |
| This | operator+ (const This &v) const |
| Sum operator. | |
| This & | operator+= (const T &v) |
| Addition operator for an array and a scalar. | |
| This & | operator+= (const This &v) |
| Addition operator. | |
| This | operator- (const T &v) const |
| Minus operator for an array and a scalar. | |
| This | operator- (const This &v) const |
| Minus operator. | |
| This & | operator-= (const T &v) |
| Substraction operator for an array and a scalar. | |
| This & | operator-= (const This &v) |
| Subtraction operator. | |
| This | operator/ (const T &v) const |
| Division operator for an array and a scalar. | |
| This | operator/ (const This &v) const |
| Division operator (element by element). | |
| This & | operator/= (const T &v) |
| Division operator for an array and a scalar. | |
| This & | operator/= (const This &v) |
| Division operator. | |
| void | operator= (const This &v) |
| void | pad (This &padded) |
| void | pad (This &padded, T val) |
| T & | physical_get (const int j, const int i) const |
| Physicial access to the elements of the matrix. | |
| void | physical_set (const int j, const int i, const T &val) |
| Physicial set of the elements of the matrix. | |
| template<typename T1 > | |
| void | reshape (const Matrix2D< T1 > &v) |
| Reshapes the matrix copying the size and range of a given one. | |
| template<typename T1 > | |
| void | resize (const Matrix2D< T1 > &m2) |
| Resizes the matrix copying the size of a given one. | |
| void | resize (int Ydim, int Xdim) |
| Resizes the matrix. | |
| void | set_identity () |
| Set the matrix to be an indentity matrix. | |
| void | set_zero () |
| Set the matrix to be a zero matrix. | |
| void | show (std::ostream &o=std::cout) const |
| This | transpose () |
Friends | |
| This | operator* (const T &X, const This &a1) |
| Multiplication operator for a scalar and an array. | |
| This | operator+ (const T &X, const This &a1) |
| Sum operator for a scalar and an array. | |
| This | operator- (const T &X, const This &a1) |
| Minus operator for a scalar and an array. | |
| This | operator/ (const T &X, const This &a1) |
| Division operator for a scalar and an array. | |
Related Functions | |
| (Note that these are not member functions.) | |
| double | bilinear_interpolation (Matrix2D< double > &m, VectorD< 2 > &idx, bool wrap=false, double outside=0.0) |
| double | interpolate (algebra::Matrix2D< double > &m, VectorD< 2 > &idx, bool wrap=false, double outside=0.0, int interp=0) |
| General function to call in case of interpolation in 2D matrices. | |
| IMP::algebra::Matrix2D< T >::Matrix2D | ( | int | Ydim, | |
| int | Xdim | |||
| ) |
Constructor.
| [in] | Ydim | Number of rows |
| [in] | Xdim | Number of columns |
| T& IMP::algebra::Matrix2D< T >::operator() | ( | T1 & | idx | ) | const |
Access operator. The returned element is the LOGICAL element of the matrix, NOT the direct one
| [in] | idx | must be a class supporting access via [] |
| T& IMP::algebra::Matrix2D< T >::operator() | ( | int | j, | |
| int | i | |||
| ) | const |
Access operator. The returned element is the LOGICAL element of the matrix, NOT the direct one
| [in] | j | Row to access |
| [in] | i | Column to access |
| This IMP::algebra::Matrix2D< T >::operator+ | ( | const This & | v | ) | const |
Sum operator.
| [in] | v | The matrix to add |
| void IMP::algebra::Matrix2D< T >::pad | ( | This & | padded | ) |
Pad the MultiArray. Padding is defined as doubling the size in each dimension and fill the new values with the previous average value.
| [in] | padded | the MultiArray padded |
| void IMP::algebra::Matrix2D< T >::pad | ( | This & | padded, | |
| T | val | |||
| ) |
Pad with a given value. Padding is defined as doubling the size in each dimension and fill the new values with the value.
| [out] | padded | the output MultiArray |
| [in] | val | the value to pad with |
| T& IMP::algebra::Matrix2D< T >::physical_get | ( | const int | j, | |
| const int | i | |||
| ) | const |
Physicial access to the elements of the matrix.
| [in] | j | physical row to access |
| [in] | i | physical Column to access |
| void IMP::algebra::Matrix2D< T >::physical_set | ( | const int | j, | |
| const int | i, | |||
| const T & | val | |||
| ) |
Physicial set of the elements of the matrix.
| [in] | j | physical row to access |
| [in] | i | physical Column to access |
| [in] | val | the value to set |
| void IMP::algebra::Matrix2D< T >::reshape | ( | const Matrix2D< T1 > & | v | ) |
Reshapes the matrix copying the size and range of a given one.
| [in] | v | Matrix2D whose shape to copy |
| void IMP::algebra::Matrix2D< T >::resize | ( | const Matrix2D< T1 > & | m2 | ) |
| void IMP::algebra::Matrix2D< T >::resize | ( | int | Ydim, | |
| int | Xdim | |||
| ) |
Resizes the matrix.
| [in] | Ydim | Number of rows |
| [in] | Xdim | Number of columns |
| This IMP::algebra::Matrix2D< T >::transpose | ( | ) |
Returns a matrix with this matrix transposed. The original one is not modified
| double bilinear_interpolation | ( | Matrix2D< double > & | m, | |
| VectorD< 2 > & | idx, | |||
| bool | wrap = false, |
|||
| double | outside = 0.0 | |||
| ) | [related] |
Performs bilinear interpolation for a point using the 4 closest values in the matrix
| [in] | m | the Matrix (2D) |
| [in] | idx | must be a class supporting access via []. It must have 2 elements. |
| [in] | wrap | if true, the image is wrapped and values from the right are used when the left limit is excedeed, and viceversa. Same thing is done between top and bottom. |
| [in] | outside | Value to apply if the requested idx falls outside the limits of the matrix. (It is never used if wrap is requested) |
| double interpolate | ( | algebra::Matrix2D< double > & | m, | |
| VectorD< 2 > & | idx, | |||
| bool | wrap = false, |
|||
| double | outside = 0.0, |
|||
| int | interp = 0 | |||
| ) | [related] |
General function to call in case of interpolation in 2D matrices.
| [in] | m | the Matrix (2D) |
| [in] | idx | must be a class supporting access via [] and must have 2 elements. |
| [in] | wrap | If true, the matrix is wrapped: values from the right are used when the left limit is excedeed, and viceversa. Same thing for other dimensions. |
| [in] | outside | Value to apply if the requested idx falls outside the limits of the matrix. (Never used if wrap is requested) |
| [in] | interp | type of interpolation desired. Right now it is only bilinear interpolation |