44 : _r(0), _fc(fc), _tc(tc), _fr(fr), _tr(tr) {
45 if (tc >
a.width() || tr >
a.height())
47 if (fc >= tc || fr >= tr) {
48 _fc=0; _tc=0; _fr=0; _tr=0;
55 for (
int h = fr; h < tr; h++)
56 for (
int w = fc; w < tc; w++)
63 for (
int i = 0; i < _r.
size()/2; i++)
64 std::swap(_r[i], _r[_r.size()-i-1]);
85 Slice<A>::operator
const Matrix<typename Slice<A>::ArgsType>(void)
const {
86 return Matrix<ArgsType>(_r, _tc-_fc, _tr-_fr);
128 : _a(
a), _w(w), _h(h) {
129 if ((_w * _h) != _a.size())
136 : _a(
a), _w(
n), _h(
n) {
137 if (
n*
n != _a.size())
156 if ((c >= _w) || (
r >= _h))
164 if ((c >= _w) || (
r >= _h))
172 return Slice<A>(*
this, fc, tc, fr, tr);
178 return slice(0, width(),
r,
r+1);
184 return slice(c, c+1, 0, height());
187 template<
class Char,
class Traits,
class A>
188 std::basic_ostream<Char,Traits>&
190 std::basic_ostringstream<Char,Traits> s;
191 s.copyfmt(os); s.width(0);
192 for (
int i=0; i<m.
height(); i++) {
193 for (
int j=0; j<m.
width(); j++) {
198 return os << s.str();
201 template<
class Char,
class Traits,
class A>
202 std::basic_ostream<Char,Traits>&
203 operator <<(std::basic_ostream<Char,Traits>& os,
const Slice<A>& s) {
204 return os << static_cast<typename Slice<A>::ArgsType>(s);
228#ifdef GECODE_HAS_SET_VARS
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
int size(void) const
Return size of array (number of elements)
Traits of arrays in Gecode.
Boolean integer variables.
Home class for posting propagators
Matrix-interface for arrays.
int width(void) const
Return the width of the matrix.
ValueType & operator()(int c, int r)
Access element (c, r) of the matrix.
Slice< A > slice(int fc, int tc, int fr, int tr) const
Access slice of the matrix.
Slice< A > col(int c) const
Access column c.
Slice< A > row(int r) const
Access row r.
ArgsType const get_array(void) const
Return an Args-array of the contents of the matrix.
ArrayTraits< A >::ArgsType ArgsType
The type of the Args-array type for ValueType values.
Matrix(A a, int w, int h)
Basic constructor.
ArrayTraits< A >::ValueType ValueType
The type of elements of this array.
int height(void) const
Return the height of the matrix.
Exception: Argument out of range
Exception: Sizes of arguments does not match
Slice(const Matrix< A > &a, int fc, int tc, int fr, int tr)
Construct slice.
ArrayTraits< A >::ArgsType ArgsType
The type of the Args-array type for ValueType values.
Slice & reverse(void)
Reverses the contents of the slice, and returns a reference to it.
IntPropLevel
Propagation levels for integer propagators.
Gecode toplevel namespace
FloatVal operator+(const FloatVal &x)
Post propagator for SetVar SetOpType SetVar SetRelType r
Archive & operator<<(Archive &e, FloatNumBranch nl)
void element(Home home, IntSharedArray n, IntVar x0, IntVar x1, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Post propagator for SetVar SetOpType SetVar y
Post propagator for SetVar x