## functions in std.i - m

mac_primitives

mac_primitives, file sets FILE primitive data types to be native to MacIntosh, 8 byte double. Interpreted function, defined at i0/std.i line 2913

macl_primitives

macl_primitives, file sets FILE primitive data types to be native to MacIntosh, long double. Interpreted function, defined at i0/std.i line 2921

max

max(x) or max(x, y, z, ...) returns the scalar maximum value of its array argument, or, if more than one argument is supplied, returns an array of the maximum value for each array element among the several arguments. In the multi-argument case, the arguments must be conformable. Builtin function, documented at i0/std.i line 811SEE ALSO: min, sum, avg

median

median(x) or median(x, which) returns the median of the array X. The search for the median takes place along the dimension of X specified by WHICH. WHICH defaults to 1, meaning the first index of X. The median function returns an array with one fewer dimension than its argument X (the WHICH dimension of X is missing in the result), in exact analogy with rank reducing index range functions. If dimsof(X)(WHICH) is odd, the result will have the same data type as X; if even, the result will be a float or a double, since the median is defined as the arithmetic mean between the two central values in that case. Interpreted function, defined at i0/std.i line 1231SEE ALSO: sort

merge

merge(true_expr, false_expr, condition) returns the values TRUE_EXPR or FALSE_EXPR where CONDITION is non-zero or zero, respectively. The result has the data type of TRUE_EXPR or FALSE_EXPR, promoted to the higher arithmetic type if necessary. The result has the dimensions of CONDITION. The number of elements in TRUE_EXPR must match the number of non-zero elements of CONDITION, and the number of elements in FALSE_EXPR must match the number of zero elements of CONDITION. (TRUE_EXPR or FALSE_EXPR should be nil if there are no such elements of CONDITION. Normally, TRUE_EXPR and FALSE_EXPR should be 1-D arrays if they are not nil.) This function is intended for vectorizing a function whose domain is divided into two or more parts, as in: func f(x) { big= (x>=threshhold); wb= where(big); ws= where(!big); if (is_array(wb)) { xx= x(wb); fb=SEE ALSO: mergef, merge2, where} if (is_array(ws)) { xx= x(ws); fs= } return merge(fb, fs, big); } Builtin function, documented at i0/std.i line 894

merge2

merge2(true_expr, false_expr, condition) returns the values TRUE_EXPR or FALSE_EXPR where CONDITION is non-zero or zero, respectively. The result has the data type of TRUE_EXPR or FALSE_EXPR, promoted to the higher arithmetic type if necessary. Unlike the merge function, TRUE_EXPR and FALSE_EXPR must be conformable with each other, and with the CONDITION. Interpreted function, defined at i0/std.i line 925SEE ALSO: merge, where, mergef

mergef

y = mergef(x, f1, cond1, f2, cond2, ... felse) Evaluate F1(X(where(COND1))), F2(X(where(COND2))), and so on, until FELSE(X(where(!(COND1 | COND2 | ...)))) and merge all the results back into an array Y with the same dimensions as X. Each of the CONDi must have the same dimensions as X, and they must be mutally exclusive. During the evaluation of Fi, note that all of the local variables of the caller of mergef are available. The Fi are invoked as Fi(X(mergel)) and the variable mergel = where(CONDi) is available to the Fi, in case they need to extract any additional parameters. If noneof(CONDi) then Fi will not be called at all, otherwise, the Fi are invoked in order. The return value of Fi must have the same shape as its argument (which will be a 1D array or scalar). Use mergeg to construct secondary results the same shape as X and Y. Interpreted function, defined at i0/std.i line 947SEE ALSO: mergeg, merge

mergeg

z = mergeg(z, value) or z = mergeg(z) If secondary results are to be returned from a mergef, besides its return value, the Fi may construct them using the second form of mergef: z = mergeg(z, value) where z is a variable in the original caller of mergef, and value is its value where(CONDi). Note that the variable name of the first parameter must be the same as the variable name it is assigned to in this construction -- that variable is being used to hold the state of z as it is built. After the outer mergef returns, the caller needs to invoke z = mergeg(z) one final time to complete each secondary return value. z = []; y = mergef(x, f1, cond, f2); z = mergeg(z); ... func f1(x) {SEE ALSO: mergef, mergez = mergeg(z, exprz(x)); return expry(x); } func f2(x) { z = mergeg(z, exprz(x)); return expry(x); } Interpreted function, defined at i0/std.i line 993

min

min(x) or min(x, y, z, ...) returns the scalar minimum value of its array argument, or, if more than one argument is supplied, returns an array of the minimum value for each array element among the several arguments. In the multi-argument case, the arguments must be conformable. Builtin function, documented at i0/std.i line 801SEE ALSO: max, sum, avg

mkdir

mkdir, directory_name rmdir, directory_name Create DIRECTORY_NAME with mkdir, or remove it with rmdir. The rmdir function only works if the directory is empty. Builtin function, documented at i0/std.i line 2478SEE ALSO: cd, lsdir, get_cwd, get_home