Re: [gecode-users] Sum over matrix slice

2014-05-15 Thread Tomas Lidén
Argh - my bad... Thanks! /T Christian Schulte skrev 2014-05-15 13:39: Hi Tomas, According to the documentation slice(i1,i2,j1,j2) extracts the elements with coordinates in [i1,i2) and [j1,j2). So, in your example, slice(i,i+1,i,i+1) extracts the elements with coordinates [i,i+1) and [i,i+1

Re: [gecode-users] Sum over matrix slice

2014-05-15 Thread Christian Schulte
Subject: [gecode-users] Sum over matrix slice Hi! While working on a course assignment I realized (after some struggling) that summing over a matrix slice does not perform as expected: === snippet == BoolVarArray x(home, n*n, 0, 1); Matrix m(x, n, n); rel(home, sum(m.slice(i, i+1, i, i+1)) >

[gecode-users] Sum over matrix slice

2014-05-15 Thread Tomas Lidén
Hi! While working on a course assignment I realized (after some struggling) that summing over a matrix slice does not perform as expected: === snippet == BoolVarArray x(home, n*n, 0, 1); Matrix m(x, n, n); rel(home, sum(m.slice(i, i+1, i, i+1)) > 0); // forces m(i,i) > 0 !! BoolVarArgs s; s <