Array Functions


These functions operate on lua tables containing only values that are numbers, no keys, and no sub-tables. This special type of table is called an Array, or "indexed array" since the elements may be accessed by their index, as in x[5]. Nearly all of these functions support only 1-dimensional arrays which, by definition, contain no sub-tables for dimensions greater than 1. However, the arraytoimage function supports 2-dimensional arrays. For general tables or arrays containing higher dimensional; array, use the general Table functions.

Most of these functions also work with the data array of a CImage class object, the elements of a CArray class object, or a list of numbers.

add

Adds a number to the members of a 1-dimensional array, CImage object, a single number.

arrayindex, arrayindex_b

Returns the the linear index of multi-dimensional coordinates in a multi-dimensional array. This function is the inverse of arraycoord.

arraycoord

Returns the coodinate array for an offset index. This function is the inverse of arrayindex.

arraytoimage

Converts a 1- or 2-dimensional array to a 1- or 2-dimensional CImage object.

div

Divides a number into the members of a 1-dimensional array, CImage object, or single number.

dot

Returns the dot product of two class objects or 1-dimensional arrays of numbers.

gaussdev

Returns a 1-dimensional array of Gaussian random deviates (numbers).

hist

Computes the histogram of a 1-dimensional array. This is a simplified version of the CHistogram class function.

list

Lists the contents of a table.

max

Returns the maximum value in a 1-dimensional array, CImage object, or list of numbers.

maxxy

Returns the maximum value in a 1-dimensional array, CImage object, or list of numbers.

mean

Returns the mean value for an array, CImage object, or list of numbers.

meansdev

Returns the mean and standard deviation for an array, CImage object, or list of numbers.

median

Returns the median value for a 1-dimensional array, CImage object, or list of numbers.

mediansdev

Returns the median and standard deviation for a 1-dimensional array, CImage object, or list of numbers.

min

Returns the minimum value in a 1-dimensional array, CImage object, or list of numbers.

minxy

Returns the minimum value in a 1-dimensional array, CImage object, or list of numbers.

mul

Multiples each member of a 1-dimensional array, CImage object, or a number, by a specified number.

norm

Normalizes the numbers of a 1-dimensional array, CImage or CArray object, so their sum is 1.0.

random

Returns a 1-dimensional array of uniformly distributed random numbers.

reverse

Reverses a 1-dimensional array with regard to the order of the array indices.

round

Rounds a 1-dimensional array to the nearest integer.

sdev

Returns the standard deviation of a 1-dimensional array or list of numbers.

series

Returns a 1-dimensional array containing uniformly spaced numbers.

sort

Sorts the numbers of a 1-dimensional array into ascending order.

sortr

Sorts the numbers of a 1-dimensional array into descending order.

stats

Returns a 1-dimensional array containing basic statistics for a 1-dimensional array, including the mean, median, minimum. maximum, standard deviation, and other values. This function returns an array of values like [1]=value, whereas statstr returns a table with ["name"]=value pairs.

statstr

Returns a 1-dimensional table containing basic statistics for a 1-dimensional array, including the mean, median, minimum. maximum, standard deviation, and other values. This function returns ["name"]=value pairs, whereas stats returns an indexed array, like [1]=value.

sub

Subtracts a number from the members of a 1-dimensional array or number.

sum

Returns the sum of a 1-dimensional array or list of numbers.

Related Topics

Contents

Table and Array Functions

Table Functions

CArray Class

CStats Class

CImage Class

CHistogram class


Mira Pro x64 Script User's Guide, v.8.77 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.