You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: QtSLiM/help/EidosHelpFunctions.html
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,9 @@
118
118
<pclass="p5"><spanclass="s5">Returns the <b>sample Pearson’s correlation coefficient</b> between </span><spanclass="s6">x</span><spanclass="s5"> and </span><spanclass="s6">y</span><spanclass="s5">, usually denoted <i>r</i>.<spanclass="Apple-converted-space"></span>The sizes of </span><spanclass="s6">x</span><spanclass="s5"> and </span><spanclass="s6">y</span><spanclass="s5"> must be identical.<spanclass="Apple-converted-space"></span>If </span><spanclass="s6">x</span><spanclass="s5"> and </span><spanclass="s6">y</span><spanclass="s5"> have a size of </span><spanclass="s6">0</span><spanclass="s5"> or </span><spanclass="s6">1</span><spanclass="s5">, the return value will be </span><spanclass="s6">NULL</span><spanclass="s5">.<spanclass="Apple-converted-space"></span>At present it is illegal to call </span><spanclass="s6">cor()</span><spanclass="s5"> with a matrix or array argument, because the desired behavior in that case has not yet been implemented.</span></p>
<pclass="p5"><spanclass="s5">Returns the <b>corrected sample covariance</b> between </span><spanclass="s6">x</span><spanclass="s5"> and </span><spanclass="s6">y</span><spanclass="s5">.<spanclass="Apple-converted-space"></span>The sizes of </span><spanclass="s6">x</span><spanclass="s5"> and </span><spanclass="s6">y</span><spanclass="s5"> must be identical.<spanclass="Apple-converted-space"></span>If </span><spanclass="s6">x</span><spanclass="s5"> and </span><spanclass="s6">y</span><spanclass="s5"> have a size of </span><spanclass="s6">0</span><spanclass="s5"> or </span><spanclass="s6">1</span><spanclass="s5">, the return value will be </span><spanclass="s6">NULL</span><spanclass="s5">.<spanclass="Apple-converted-space"></span>At present it is illegal to call </span><spanclass="s6">cov()</span><spanclass="s5"> with a matrix or array argument, because the desired behavior in that case has not yet been implemented.</span></p>
<pclass="p5">Returns the result of convolving <spanclass="s2">x</span> with <spanclass="s2">filter</span>.<spanclass="Apple-converted-space"></span>The returned vector will be the same length as <spanclass="s2">x</span>.<spanclass="Apple-converted-space"></span>The convolution is performed by centering <spanclass="s2">filter</span> on each position of <spanclass="s2">x</span> to produce a corresponding result element that is the sum over the products of each <spanclass="s2">filter</span> value with each <spanclass="s2">x</span> value within the filter’s range.<spanclass="Apple-converted-space"></span>If the filter, centered over a given value of <spanclass="s2">x</span>, extends beyond the end of <spanclass="s2">x</span> the corresponding result element will be <spanclass="s2">NAN</span> since its value is undefined.<spanclass="Apple-converted-space"></span>The length of <spanclass="s2">filter</span> is required to be odd, so that the filter has a central value (and can thus be centered over each value of <spanclass="s2">x</span>).</p>
123
+
<pclass="p5">This function is useful for computing running means and similar transformations of an input vector,.<spanclass="Apple-converted-space"></span>For a simple running mean of width <spanclass="s2">w</span>, pass r<spanclass="s2">ep(1/w, w)</span> for <spanclass="s2">filter</span>.</p>
121
124
<pclass="p2">(+$)max(+ x, ...)</p>
122
125
<pclass="p3">Returns the <b>maximum</b> of <spanclass="s2">x</span> and the other arguments supplied: the single greatest value contained by all of them.<spanclass="Apple-converted-space"></span>All of the arguments must be the same type as <spanclass="s2">x</span>, and the return type will match that of <spanclass="s2">x</span><spanclass="s3">.</span><spanclass="Apple-converted-space"></span>If all of the arguments have a size of <spanclass="s2">0</span>, the return value will be <spanclass="s2">NULL</span>; note that this means that <spanclass="s2">max(x, max(y))</span> may produce an error, if <spanclass="s2">max(y)</span> is <spanclass="s2">NULL</span>, in cases where <spanclass="s2">max(x, y)</span> does not.</p>
EIDOS_TERMINATION << "ERROR (Eidos_ExecuteFunction_filter): function filter() requires filter to have a length that is odd and within the interval [1, 999]." << EidosTerminate(nullptr);
157
+
158
+
// half rounded down; e.g., for a filter of length 5, this is 2; this is the number of NANs at the
159
+
// start/end of the result, since the filter extends past the end of x for this many positions
160
+
int half_filter = filter_count / 2;
161
+
162
+
// the result is the same length as x, in all cases
163
+
EidosValue_Float *float_result = (new (gEidosValuePool->AllocateChunk()) EidosValue_Float())->resize_no_initialize(x_count);
0 commit comments