The shape is like this:
A,B,C
D,E,F,G
H,I,J,K,L
M,N,O,P
Q,R,S
and I want to constraint the diagonals to a certain sum, i.e.:
A+D+H = B+E+I+M = ... = L+P+S = CONST_SUM
I thought of flattening the list and trying to work out some mathematical formulas to obtain the correct elements, by computing the hops at each level. So far, I have only this:
matrix([[1,2,3],[4,5,6,7][8,9,10,11,12],[13,14,15,16],[17,18,19]).
check(M) :-
matrix(M),
flatten(M, L),
check_sum(L, 1).
However, the math approach doesn't seem to go well in the paper..Any ideas?
EDIT:
I couldn't work out the math rules (the hops for every diagonal), maybe there is another approach that I should follow, and not the flattening one...