| Home | zeGraph lib | Lua lib | Custom lib | Tutorials | Notes | XML Script | C-Talk | Z-Script |
Graph
   axis
   blend
   color
   color bar
   fog
   freetype
   light
   line
   material
   node
   point
   plot
   polygon
   render
   scene
   stencil
   texcoord
   text
   texture
   vertex
Utility
   array
   bio
   hdf
   make
   math
   netcdf
Auxiliary
   curl
   expact
   sqlite
   window

zeArray

Use .new("int",...) to create the object. It supports C data types of char, unsigned char, short, unsigned short, int, unsigned int, float, and double . The corresponding names for creating those array type are "char", "uchar", "short", "ushort", "int", "uint", "float", and "double", respectively. Object functions include fill, range, add, sub, mul, div, eq, ne, le, lt, ge, gt, count, find, getarr, setarr, getele, setele, getidx, setidx, getblc, setblc, getptr, setptr, insert, delete, sample, flip, swap, shift, transpose, concat, min, max, reshape, resize, size, sort, unique, parse, print. Refer to the tutorial for how to handle 1- or 2-dimentional data.

:fill(v)

Fills all array elements with the constant v.

:range(s, d, n)

The function resizes the array to n by 1 and fills its elements with the first equal to s; the second equal to s+d; and so on.

:add(v)

Element-wise addition by the constant.

:add(arr)

Element-wise addition by the array arr of the same type and size.

:sub(v)

Element-wise subtraction by the constant.

:sub(arr)

Element-wise subtraction by the array of the same type and size.

:mul(v)

Element-wise multiplication by the constant.

:mul(arr)

Element-wise multiplication by the array of the same type and size.

:div(v)

Element-wise division by the constant.

:div(arr)

Element-wise division by the array of the same type and size.

:eq(v, idx)

Element-wise equal-to comparison with the constant. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:eq(arr, idx)

Element-wise equal-to comparison with the array of the same type and size. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:ne(v, idx)

Element-wise not-equal comparison with the constant. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:ne(arr, idx)

Element-wise not-equal comparison with the array of the same type and size. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:lt(v, idx)

Element-wise less-then comparison with the constant. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:lt(arr, idx)

Element-wise less-then comparison with the array of the same type and size. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:le(v, idx)

Element-wise less-than-or-equal-to comparison with the constant. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:le(arr, idx)

Element-wise less-than-or-equal-to comparison with the array of the same type and size. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:gt(v, idx)

Element-wise greater-than comparison with the constant. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:gt(arr, idx)

Element-wise greater-than comparison with the array of the same type and size. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:ge(v, idx)

Element-wise greater-than-or-equal-to comparison with the constant. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:ge(arr, idx)

Element-wise greater-than-or-equal-to comparison with the array of the same type and size. Sets the index elements to 1 for those elements that satisfy the condition and to 0 otherwise.

:count()

Counts the non-zero elements.

:find( idx)

Finds the non-zero elemetns and set their indices to the elements of idx, which is a zeArray object of unsigned integer.

:getarr(j, vec)

Gets the jth vector to the vector vec.

:getarr(j, arr, "r")

Gets the jth record to the vector vec.

:setarr(j, v)

Assigns the constant v to the jth vector.

:setarr(j, v, "r")

Assigns the constant v to the jth record.

:setarr(j, vec)

Assigns the vector vec to the jth vector.

:setarr(j, vec, "r")

Assigns the vector vec to the jth record.

:getele(i, j)

Returns the element at (i, j) if j >= 0; otherwise returns the ith record.

:setele(i, j, v)

Sets the constant v to the element at (i, j).

:setele(i, -1, v1, v2, ...)

Sets the v1, v2, ... to the ith record. The number of constant must be the same as the number of record elements.

:getidx(idx, arr)

Assigns the elements at non-zero index of the array idx to the array arr of the same type. The array idx has the type of char and the same size as the calling array.

:setidx(idx, v)

Assigns constant v to elements at the indices of non-zero idx. The array idx has the type of char and the same size as the calling array.

:setidx(idx, arr)

Assigns arr elements at non-zero index of idx to the calling array, i.e., if idx[i] != 0 then me.data[i] = arr.data[i]. The array arr has the same type and size as the calling array. The array idx has the type of char.

:getblc(i, m, j, n, arr)

Gets a m by n block of elements to the array arr statrting at (i, j).

:setblc(i, j, arr)

Replaces a block of elements with those of the array arr starting at (i, j).

:getptr()

Returns the pointer to the data in the array, the array type, and the size of a array element.

:setptr(ptr, type, n)

Transfers n number of data of the type pointed to by ptr to the calling array.

:insert(j, v)

Inserts a vector before the jth vector and sets the constant v to all elements of the new vector.

:insert(j, v, "r")

Inserts a record before the jth record and sets the constant v to all elements of the new record.

:insert(j, vec)

Inserts the vector vec of the same type before the jth vector.

:insert(j, vec, "r")

Inserts the vector vec of the same type as a record before the jth record.

:delele(j)

Deletes the jth vector.

:delele(j, "r")

Deletes the jth record.

:sample(idx, arr)

Sampls vectors to the array arr according to the vector idx that indicates which vectors to sample.

:sample(idx, arr, "r")

Sampls records to the array arr according to the vector idx that indicates which records to sample.

:flip()

Flips array vectors.

:flip("r")

Flips array records.

:swap(i, j)

Swaps the ith and the jth vectors.

:swap(i, j, "r")

Swaps the ith and the jth records.

:shift(n)

Shifts vectors up (n > 0) or down (n < 0).

:shift(n, "r")

Shifts records left (n > 0) or right (n < 0).

:transpose()

Transpose the array.

:concat(arr)

Concatenates the array arr by cross multiplication. The number of records of arr must equal to the number of vectors of the calling array.

:min()

Returns the minimum of all elements.

:max()

Returns the maximum of all elements.

:reshape(m, n)

Reshapes the array to m by n. m times n must equal to the total elements of the original array.

:resize()

Resets the array size to m by n.

:size()

Returns the number of records and the number of vector of the array.

:sort(j)

Sorts the jth vector in ascending order and re-arranges other vectors accordingly.

:sort(n, -1)

Sorts the jth vector in descending order and re-arranges other vectors accordingly.

:unique()

Sorts the vector in ascending order and remove duplications.

:unique(-1)

Sorts the vector in descending order and remove duplications.

:parse(i, string)

Parses the string to numbers and sets them to the ith record.

:print()

Prints array data to the screen.

:print(space, delimiter, file)

Saves the array data to the file; each line will have the lead space; and items will be separated by the delimiter.