algorithm - Rewrite matrix into rules -
i have lot of rectangular matrices each cell represents outcome. matrices hard maintain, goal rewrite of them rules.
example matrix 1:
this easy turn rules (pseudocode):
if (i <= 5 , j <=3) else if (i <= 5 , j >=4) b else c
how rewrite next matrix?
plain text:
ij 1 2 3 4 5 6 7 8 9 1 c c c c b 2 c c c c b b 3 c c c c b b b 4 c c c c b b b b 5 c c c c b b b b b 6 c c c b b b b b b 7 c c b b b b b b b 8 c b b b b b b b b 9 b b b b b b b b b
the sec matrix can represented as:
if (i+j <= 5) homecoming a; else if (i+j <= 9) homecoming c; else homecoming b;
in general, can check side of diagonal line point on testing i+j
/
line, or i-j
\
line.
algorithm matrix
No comments:
Post a Comment