Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-01-30 11:00:01 -0500
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-09-11 09:30:53 -0400
commit500fe170d49c2c96cd1dcc8b550e116bf4748a60 (patch)
tree477a3d9e03b17d9b9691b762e9d056dd4faf1be4
parent7123f9818a5b0269d2f252e2953d4f9d5870a7ea (diff)
downloadtame-500fe170d49c2c96cd1dcc8b550e116bf4748a60.tar.gz
tame-500fe170d49c2c96cd1dcc8b550e116bf4748a60.tar.bz2
tame-500fe170d49c2c96cd1dcc8b550e116bf4748a60.zip
_fold-matrix_: Add template
* vector/fold.xml (_fold-matrix_): New template.
-rw-r--r--core/vector/fold.xml32
1 files changed, 32 insertions, 0 deletions
diff --git a/core/vector/fold.xml b/core/vector/fold.xml
index ab78afc..3582198 100644
--- a/core/vector/fold.xml
+++ b/core/vector/fold.xml
@@ -36,6 +36,38 @@
it \emph{generates} values from existing values.
+ <section title="Matrix Folding">
+ \ref{_fold-matrix_} folds a matrix into a vector by summing each of
+ the~rows.
+
+ <template name="_fold-matrix_"
+ desc="Folds matrix into a vector by summing rows">
+ <param name="@name@" desc="Matrix to fold" />
+ <param name="@class@" desc="Iteration vector of desired length" />
+ <param name="@generates@" desc="Generator name (to yield)" />
+
+ <param name="@yields@" desc="Yield name">
+ <text></text>
+ </param>
+
+
+ <rate-each class="@class@" yields="@yields@"
+ generates="@generates@" index="k">
+ <c:let>
+ <c:values>
+ <c:value name="row" type="float" set="vector"
+ desc="Matrix row">
+ <c:value-of name="@name@" index="k" />
+ </c:value>
+ </c:values>
+
+ <c:sum of="row" />
+ </c:let>
+ </rate-each>
+ </template>
+ </section>
+
+
<section title="Matrix Generation">
\ref{_unfold-vector-grouped_} generates a matrix from a vector---%
that is, it generates vectors within a vector---%