MCPcopy Create free account
hub / github.com/Gecode/gecode / Slice

Method Slice

gecode/minimodel/matrix.hpp:42–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41 template<class A>
42 inline
43 Slice<A>::Slice(const Matrix<A>& a, int fc, int tc, int fr, int tr)
44 : _r(0), _fc(fc), _tc(tc), _fr(fr), _tr(tr) {
45 if (tc > a.width() || tr > a.height())
46 throw MiniModel::ArgumentOutOfRange("Slice::Slice");
47 if (fc >= tc || fr >= tr) {
48 _fc=0; _tc=0; _fr=0; _tr=0;
49 return;
50 }
51
52 _r = ArgsType((tc-fc)*(tr-fr));
53
54 int i = 0;
55 for (int h = fr; h < tr; h++)
56 for (int w = fc; w < tc; w++)
57 _r[i++] = a(w, h);
58 }
59
60 template<class A>
61 Slice<A>&

Callers

nothing calls this directly

Calls 4

ArgsTypeFunction · 0.85
aFunction · 0.85
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected