From: timv Date: Wed, 12 Dec 2012 19:51:46 +0000 (-0500) Subject: added matrixops examples; demonstrates the "edge template overcounting problem" ... X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=38e141d37ec9664e0924bcd301ffa2245a360f1c;p=dyna2 added matrixops examples; demonstrates the "edge template overcounting problem" - a template which shouldnt fire more than once results in overcounting. --- diff --git a/examples/matrixops.dyna b/examples/matrixops.dyna new file mode 100644 index 0000000..8acd48f --- /dev/null +++ b/examples/matrixops.dyna @@ -0,0 +1,20 @@ + +% A and B are names of matricies +times(A, B, I, J) += m(A, I, K) * m(B, K, J). + +% matrix "c" is the product of matricies "a" and "b" +m(c, I, J) += times(a, b, I, J). + +% matrix "a" = [ 1 0 ; +% 0 1 ] +m(a, 1, 1) += 1. +m(a, 1, 2) += 0 . +m(a, 2, 1) += 0 . +m(a, 2, 2) += 1. + +% matrix "b" = [ 3 0 ; +% 0 2 ] +m(b, 1, 1) += 3. +m(b, 1, 2) += 0 . +m(b, 2, 1) += 0 . +m(b, 2, 2) += 2.