2015-03-18 11:31:47 -04:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2015-03-18 13:32:24 -04:00
|
|
|
<!--
|
|
|
|
Copyright (C) 2015 LoVullo Associates, Inc.
|
|
|
|
|
|
|
|
This file is part of tame-core.
|
|
|
|
|
|
|
|
tame-core is free software: you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU Lesser General Public License as
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
-->
|
2015-03-18 11:31:47 -04:00
|
|
|
<package xmlns="http://www.lovullo.com/rater"
|
2013-02-13 09:27:33 -05:00
|
|
|
xmlns:c="http://www.lovullo.com/calc"
|
|
|
|
xmlns:t="http://www.lovullo.com/rater/apply-template"
|
|
|
|
core="true"
|
|
|
|
desc="Vector arithmetic">
|
|
|
|
|
2015-03-18 11:31:47 -04:00
|
|
|
<import package="../base" />
|
|
|
|
<import package="../numeric/common" />
|
|
|
|
<import package="../numeric/minmax" />
|
2013-02-13 09:27:33 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- for the time being, the vectors must be of the same length, or the first
|
|
|
|
vector must be the longer (otherwise the values will not properly add)
|
|
|
|
-->
|
2015-03-18 11:31:47 -04:00
|
|
|
<template name="_vadd_" desc="Produce a vector resulting from the addition of two vectors">
|
|
|
|
<param name="@a@" desc="First vector to add" />
|
|
|
|
<param name="@b@" desc="Second vector to add" />
|
|
|
|
<param name="@into@" desc="Variable to yield vector into" />
|
|
|
|
|
|
|
|
<param name="@yields@" desc="Value to yield (useless)">
|
|
|
|
<text>__</text>
|
|
|
|
<param-value name="@into@" />
|
|
|
|
</param>
|
|
|
|
|
|
|
|
<param name="@gendesc@" desc="Generator description (for @into@)">
|
|
|
|
<text>Sum of vectors </text>
|
|
|
|
<param-value name="@a@" />
|
|
|
|
<text> and </text>
|
|
|
|
<param-value name="@b@" />
|
|
|
|
</param>
|
|
|
|
|
|
|
|
<param name="@sym@" desc="Generator symbol">
|
2013-02-13 09:27:33 -05:00
|
|
|
<!-- empty by default -->
|
2015-03-18 11:31:47 -04:00
|
|
|
<text></text>
|
|
|
|
</param>
|
2013-02-13 09:27:33 -05:00
|
|
|
|
2015-03-18 11:31:47 -04:00
|
|
|
<rate accumulate="none" yields="@yields@">
|
2013-02-13 09:27:33 -05:00
|
|
|
<c:sum of="@a@" index="k" generates="@into@" desc="@gendesc@" sym="@sym@">
|
|
|
|
<c:value-of name="@a@" index="k" />
|
|
|
|
<c:value-of name="@b@" index="k" />
|
|
|
|
</c:sum>
|
2015-03-18 11:31:47 -04:00
|
|
|
</rate>
|
|
|
|
</template>
|
2013-02-13 09:27:33 -05:00
|
|
|
|
|
|
|
|
2015-03-18 11:31:47 -04:00
|
|
|
<template name="_vsum_" desc="Yield sum of all elements of a vector as a scalar">
|
|
|
|
<param name="@of@" desc="Vector to sum" />
|
|
|
|
<param name="@yields@" desc="Name of scalar to yield" />
|
2013-02-13 09:27:33 -05:00
|
|
|
|
2015-03-18 11:31:47 -04:00
|
|
|
<rate yields="@yields@">
|
2013-02-13 09:27:33 -05:00
|
|
|
<c:sum of="@of@" />
|
2015-03-18 11:31:47 -04:00
|
|
|
</rate>
|
|
|
|
</template>
|
|
|
|
</package>
|
|
|
|
|