48 : _r(0), _fc(fc), _tc(tc), _fr(fr), _tr(tr) {
49 if (tc >
a.width() || tr >
a.height())
51 if (fc >= tc || fr >= tr) {
52 _fc=0; _tc=0; _fr=0; _tr=0;
59 for (
int h = fr; h < tr; h++)
60 for (
int w = fc; w < tc; w++)
67 for (
int i = 0;
i < _r.
size()/2;
i++)
68 std::swap(_r[
i], _r[_r.size()-
i-1]);
90 return Matrix<ArgsType>(_r, _tc-_fc, _tr-_fr);
132 :
_a(
a), _w(w), _h(h) {
133 if ((_w * _h) != _a.size())
140 :
_a(
a), _w(
n), _h(
n) {
141 if (
n*
n != _a.size())
160 if ((
c >= _w) || (
r >= _h))
168 if ((
c >= _w) || (
r >= _h))
176 return Slice<A>(*
this, fc, tc, fr, tr);
182 return slice(0, width(),
r,
r+1);
188 return slice(
c,
c+1, 0, height());
191 template<
class Char,
class Traits,
class A>
192 std::basic_ostream<Char,Traits>&
194 std::basic_ostringstream<Char,Traits> s;
195 s.copyfmt(os); s.width(0);
197 for (
int j=0; j<m.
width(); j++) {
202 return os << s.str();
205 template<
class Char,
class Traits,
class A>
206 std::basic_ostream<Char,Traits>&
208 return os << static_cast<typename Slice<A>::ArgsType>(s);
232 #ifdef GECODE_HAS_SET_VARS IntConLevel
Consistency levels for integer propagators.
Slice< A > col(int c) const
Access column c.
int size(void) const
Return size of array (number of elements)
Exception: Argument out of range
int height(void) const
Return the height of the matrix.
Slice< A > slice(int fc, int tc, int fr, int tr) const
Access slice of the matrix.
ArrayTraits< A >::ValueType ValueType
The type of elements of this array.
Gecode::FloatVal c(-8, 8)
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Slice & reverse(void)
Reverses the contents of the slice, and returns a reference to it.
Matrix(A a, int w, int h)
Basic constructor.
FloatVal operator+(const FloatVal &x)
ArrayTraits< A >::ArgsType ArgsType
The type of the Args-array type for ValueType values.
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntConLevel)
Post domain consistent propagator for .
int width(void) const
Return the width of the matrix.
struct Gecode::@511::NNF::@54::@56 a
For atomic nodes.
Boolean integer variables.
ArrayTraits< A >::ArgsType ArgsType
The type of the Args-array type for ValueType values.
Node * x
Pointer to corresponding Boolean expression node.
Slice< A > row(int r) const
Access row r.
ValueType & operator()(int c, int r)
Access element (c, r) of the matrix.
Archive & operator<<(Archive &e, FloatNumBranch nl)
Matrix-interface for arrays.
Traits of arrays in Gecode.
Gecode toplevel namespace
Slice(const Matrix< A > &a, int fc, int tc, int fr, int tr)
Construct slice.
ArgsType const get_array(void) const
Return an Args-array of the contents of the matrix.
Exception: Sizes of arguments does not match
Home class for posting propagators