Gecode::Matrix< A > Class Template Reference
[Direct modeling support]
Matrix-interface for arrays. More...
#include <minimodel.hh>
Classes | |
class | Slice |
A slice of a matrix. More... | |
Public Types | |
typedef ArrayTraits< A > ::value_type | value_type |
The type of elements of this array. | |
typedef ArrayTraits< A >::args_type | args_type |
The type of the Args-array type for value_type values. | |
Public Member Functions | |
Matrix (A a, int w, int h) | |
Basic constructor. | |
Matrix (A a, int n) | |
Basic constructor. | |
int | width (void) const |
Return the width of the matrix. | |
int | height (void) const |
Return the height of the matrix. | |
args_type const | get_array (void) const |
Return an Args-array of the contents of the matrix. | |
value_type & | operator() (int c, int r) |
Access element (c, r) of the matrix. | |
Slice | slice (int fc, int tc, int fr, int tr) |
Access slice of the matrix. | |
Slice | row (int r) |
Access row r. | |
Slice | col (int c) |
Access column c. | |
Related Functions | |
(Note that these are not member functions.) | |
void | element (Home home, const Matrix< IntArgs > &m, IntVar x, IntVar y, IntVar z, IntConLevel icl=ICL_DEF) |
Element constraint for matrix. | |
void | element (Home home, const Matrix< IntArgs > &m, IntVar x, IntVar y, BoolVar z, IntConLevel icl=ICL_DEF) |
Element constraint for matrix. | |
void | element (Home home, const Matrix< IntSetArgs > &m, IntVar x, IntVar y, SetVar z) |
Element constraint for matrix. |
Detailed Description
template<class A>
class Gecode::Matrix< A >
Matrix-interface for arrays.
This class allows for wrapping some array and accessing it as a matrix.
- Note:
- This is a light-weight wrapper, and is not intended for storing variables directly instead of in an array.
Definition at line 1312 of file minimodel.hh.
Member Typedef Documentation
typedef ArrayTraits<A>::value_type Gecode::Matrix< A >::value_type |
The type of elements of this array.
Definition at line 1315 of file minimodel.hh.
typedef ArrayTraits<A>::args_type Gecode::Matrix< A >::args_type |
The type of the Args-array type for value_type values.
Definition at line 1317 of file minimodel.hh.
Constructor & Destructor Documentation
Gecode::Matrix< A >::Matrix | ( | A | a, | |
int | w, | |||
int | h | |||
) | [inline] |
Basic constructor.
Constructs a Matrix from the array a, using w and h as the width and height of the matrix.
The elements in the wrapped array a are accessed in row-major order.
- Exceptions:
-
MiniModel::ArgumentSizeMismatch Raised if the parameters w and h doesn't match the size of the array a.
Definition at line 85 of file matrix.hpp.
Gecode::Matrix< A >::Matrix | ( | A | a, | |
int | n | |||
) | [inline] |
Basic constructor.
Constructs a square Matrix from the array a, using n as the length of the sides.
The elements in the wrapped array a are accessed in row-major order.
- Exceptions:
-
MiniModel::ArgumentSizeMismatch Raised if the parameter n doesn't match the size of the array a.
Definition at line 93 of file matrix.hpp.
Member Function Documentation
int Gecode::Matrix< A >::width | ( | void | ) | const [inline] |
Return the width of the matrix.
Definition at line 101 of file matrix.hpp.
int Gecode::Matrix< A >::height | ( | void | ) | const [inline] |
Return the height of the matrix.
Definition at line 104 of file matrix.hpp.
Matrix< A >::args_type const Gecode::Matrix< A >::get_array | ( | void | ) | const [inline] |
Return an Args-array of the contents of the matrix.
Definition at line 107 of file matrix.hpp.
Matrix< A >::value_type & Gecode::Matrix< A >::operator() | ( | int | c, | |
int | r | |||
) | [inline] |
Access element (c, r) of the matrix.
- Exceptions:
-
MiniModel::ArgumentOutOfRange Raised if c or r are out of range.
Definition at line 113 of file matrix.hpp.
Matrix< A >::Slice Gecode::Matrix< A >::slice | ( | int | fc, | |
int | tc, | |||
int | fr, | |||
int | tr | |||
) | [inline] |
Access slice of the matrix.
This function allows accessing a slice of the matrix, located at columns and rows
. The result of this function is an object that can be converted into either a Matrix<args_type> or into args_type.
For further information, see Slice.
Definition at line 121 of file matrix.hpp.
Matrix< A >::Slice Gecode::Matrix< A >::row | ( | int | r | ) | [inline] |
Access row r.
Definition at line 127 of file matrix.hpp.
Matrix< A >::Slice Gecode::Matrix< A >::col | ( | int | c | ) | [inline] |
Access column c.
Definition at line 133 of file matrix.hpp.
Friends And Related Function Documentation
void element | ( | Home | home, | |
const Matrix< IntArgs > & | m, | |||
IntVar | x, | |||
IntVar | y, | |||
IntVar | z, | |||
IntConLevel | icl = ICL_DEF | |||
) | [related] |
Element constraint for matrix.
Here, x and y are the coordinates and z is the value at position m(x,y).
void element | ( | Home | home, | |
const Matrix< IntArgs > & | m, | |||
IntVar | x, | |||
IntVar | y, | |||
BoolVar | z, | |||
IntConLevel | icl = ICL_DEF | |||
) | [related] |
Element constraint for matrix.
Here, x and y are the coordinates and z is the value at position m(x,y).
void element | ( | Home | home, | |
const Matrix< IntSetArgs > & | m, | |||
IntVar | x, | |||
IntVar | y, | |||
SetVar | z | |||
) | [related] |
Element constraint for matrix.
Here, x and y are the coordinates and z is the value at position m(x,y).
The documentation for this class was generated from the following files:
- gecode/minimodel.hh (Revision: 10032)
- gecode/minimodel/matrix.hpp (Revision: 9898)