|
915 | 915 | \f3\fs20 with a matrix or array argument, because the desired behavior in that case has not yet been implemented.\ |
916 | 916 | \pard\pardeftab720\li720\fi-446\ri720\sb180\sa60\partightenfactor0 |
917 | 917 |
|
918 | | -\f1\fs18 \cf2 \kerning1\expnd0\expndtw0 (float)filter(numeric\'a0x, float\'a0filter)\ |
| 918 | +\f1\fs18 \cf2 \kerning1\expnd0\expndtw0 (float)filter(numeric\'a0x, float\'a0filter, [lif$\'a0outside\'a0=\'a0F])\ |
919 | 919 | \pard\pardeftab720\li547\ri720\sb60\sa60\partightenfactor0 |
920 | 920 |
|
921 | 921 | \f3\fs20 \cf2 Returns the result of convolving |
|
932 | 932 | \f1\fs18 filter |
933 | 933 | \f3\fs20 value with each |
934 | 934 | \f1\fs18 x |
935 | | -\f3\fs20 value within the filter\'92s range. If the filter, centered over a given value of |
| 935 | +\f3\fs20 value within the filter\'92s range. The length of |
| 936 | +\f1\fs18 filter |
| 937 | +\f3\fs20 is required to be odd, so that the filter has a central value (and can thus be centered over each value of |
| 938 | +\f1\fs18 x |
| 939 | +\f3\fs20 ).\ |
| 940 | +If the filter, centered over a given value of |
936 | 941 | \f1\fs18 x |
937 | 942 | \f3\fs20 , extends beyond the end of |
938 | 943 | \f1\fs18 x |
939 | | -\f3\fs20 the corresponding result element will be |
| 944 | +\f3\fs20 then the calculation of the corresponding element of the result is governed by the |
| 945 | +\f1\fs18 outside |
| 946 | +\f3\fs20 parameter. When |
| 947 | +\f1\fs18 outside |
| 948 | +\f3\fs20 is |
| 949 | +\f1\fs18 F |
| 950 | +\f3\fs20 (the default), the corresponding element in the result will be |
940 | 951 | \f1\fs18 NAN |
941 | | -\f3\fs20 since its value is undefined. The length of |
942 | | -\f1\fs18 filter |
943 | | -\f3\fs20 is required to be odd, so that the filter has a central value (and can thus be centered over each value of |
| 952 | +\f3\fs20 ; this matches the behavior of the R |
| 953 | +\f1\fs18 filter() |
| 954 | +\f3\fs20 function (except that R uses |
| 955 | +\f1\fs18 NA |
| 956 | +\f3\fs20 ). If |
| 957 | +\f1\fs18 outside |
| 958 | +\f3\fs20 is |
| 959 | +\f1\fs18 T |
| 960 | +\f3\fs20 , values outside |
944 | 961 | \f1\fs18 x |
945 | | -\f3\fs20 ).\ |
946 | | -This function is useful for computing running means and similar transformations of an input vector,. For a simple running mean of width |
| 962 | +\f3\fs20 will be excluded from the calculation (the filter value covering that position will be considered to be |
| 963 | +\f1\fs18 0 |
| 964 | +\f3\fs20 ), and the other values in the filter will be adjusted so that the sum of the absolute values of the filter weights used is unchanged, to compensate for the excluded values by giving the positions inside |
| 965 | +\f1\fs18 x |
| 966 | +\f3\fs20 more weight. Finally, if |
| 967 | +\f1\fs18 outside |
| 968 | +\f3\fs20 is |
| 969 | +\f1\fs18 integer |
| 970 | +\f3\fs20 or |
| 971 | +\f1\fs18 float |
| 972 | +\f3\fs20 , that value will be used as the value of |
| 973 | +\f1\fs18 x |
| 974 | +\f3\fs20 for all positions outside |
| 975 | +\f1\fs18 x |
| 976 | +\f3\fs20 ; one might pass an expected value or mean value in this way, to be used for all outside positions.\ |
| 977 | +This function is useful for computing running means and similar transformations of an input vector. For a simple running mean of width |
947 | 978 | \f1\fs18 w |
948 | 979 | \f3\fs20 , pass r |
949 | 980 | \f1\fs18 ep(1/w, w) |
950 | 981 | \f3\fs20 for |
951 | 982 | \f1\fs18 filter |
952 | | -\f3\fs20 .\ |
| 983 | +\f3\fs20 . That case is automatically detected and handled efficiently; otherwise, the runtime of this function is proportional to the length of |
| 984 | +\f1\fs18 x |
| 985 | +\f3\fs20 times the length of |
| 986 | +\f1\fs18 filter |
| 987 | +\f3\fs20 , and so will be slow for long filters.\ |
953 | 988 | \pard\pardeftab720\li720\fi-446\ri720\sb180\sa60\partightenfactor0 |
954 | 989 |
|
955 | 990 | \f1\fs18 \cf0 (+$)max(+\'a0x, ...)\ |
|
0 commit comments