Ophidia Primitives Manual
The links below describe the set of array-based primitives available in the platform. Currently available array-based functions allow data sub-setting, data aggregation (i.e. max, min, avg), array concatenation, algebraic expressions and predicate evaluation. Core functions of well-known numerical libraries (e.g. GSL) have been included into the primitives.
Each manual page describes the primitive’s functionalities, the input arguments required, the returned type and a simple example. To uniform the interfaces, almost all primitives use as first two arguments input and output measure type, even when these parameters are not necessary. In these cases they are marked as not used.
Most operators rely on primitives to perform array-based operations, however to execute a selected primitive, a special operator OPH_APPLY must be used.
Ophidia primitives have been developed as MySQL User Defined Functions (UDF), see development guide for more information, hence the functions can be also used in a nested fashion.
Core Array
NAME |
DESCRIPTION |
oph_append |
It concats multiple input measures into a single output measure. |
oph_concat |
It builds a new measure array concatenating the measures specified. |
oph_concat2 |
It builds a new measure array concatenating the measures specified; the primitive appends one array per row by selecting it cyclically from the set. |
oph_count_array |
It counts the number of elements into an array. |
oph_expand |
It expands an array by putting NaN in given positions. |
oph_extend |
It creates an array by concating more copies of input array. |
oph_find |
It finds the number of occurences into a measure array that are inside the interval [value-distance;value+distance]. |
oph_gsl_sort |
It orders the elements of the measure array in an ascending way using heapsort. |
oph_interlace |
It interlaces multiple input measures into a single output measure. |
oph_padding |
It appends padding values so that array size becomes a given value. |
oph_permute |
It executes a permutation of the implicit dimension order. |
oph_reverse |
It extracts a binary array of measures in a reversed order (from the last to the first). |
oph_roll_up |
It transforms an explicit dimension in implicit. |
oph_rotate |
It rotates the values inside a multidimensional measure array. |
oph_sequence |
It returns an array with a list of information regarding the sequences of non-zero consecutive values in input array. |
oph_size_array |
It computes the size of an array (length of the array in bytes). |
oph_shift |
It shifts the values inside a measure array by ‘offset’ positions using the ‘filling’ value. |
Selection
NAME |
DESCRIPTION |
oph_extract |
It returns a subset of a measure obtained using the (long long) indexes passed as ‘index. list’. |
oph_get_subarray2 |
It extracts a subset of a measure array. The subset cannot be applied on multiple dimensions. |
oph_get_subarray3 |
It extracts a subset of a measure array. The subset can also be applied on multiple dimensions. |
oph_get_subarray |
It extracts a subset of ‘count’ elements of an array starting from ‘start’. |
oph_mask_array |
It applies a mask to a measure array. |
Arithmetic
NAME |
DESCRIPTION |
oph_abs_array |
It computes the modulus of each value of measure array b and the value in the same position in measure array a. |
oph_arg_array |
It computes the phase of each value of measure array b and the value in the same position in measure array a. |
oph_compare |
It returns 0 if the two input measures are equal. |
oph_div_array |
It divides each value of measure array a for the value in the same position in measure array b. |
oph_gsl_complex_get_abs |
It computes the absolute values of a binary array of complex numbers. |
oph_gsl_complex_get_arg |
It computes the argument (phase) of a binary array of complex numbers. |
oph_gsl_complex_get_imag |
It extracts the imaginary parts from a binary array of complex numbers. |
oph_gsl_complex_get_real |
It extracts the real parts from a binary array of complex numbers. |
oph_gsl_complex_to_polar |
It converts a binary array of complex numbers expressed in cartesian coordinates into the polar form. |
oph_gsl_complex_to_rect |
It converts a binary array of complex numbers expressed in polar form into the rectangular form. |
oph_math |
It executes a scalar mathematical operation on each element of the measure array. |
oph_max_array |
It extracts the maximum between the values in the same position in measure array a and array b. |
oph_min_array |
It extracts the minimum between the values in the same position in measure array a and array b. |
oph_mul_array |
It multiplies each element of the measure array by the scalar value. |
oph_mul_scalar |
It multiplies each element of the measure array by the scalar value. |
oph_mul_scalar2 |
It multiplies each element of the measure array by a scalar value. It can operate also with complex numbers. |
oph_operator_array |
It applies an operation between the value of measure array b and the value in the same position in measure array a. |
oph_operator |
It applies an operator on the whole measure array. |
oph_sum_array |
It sums each value of measure array b to the value in the same position in measure array a. |
oph_sum_scalar |
It sums the scalar value to each element of the measure array. |
oph_sum_scalar2 |
It sums the scalar value to each element of the measure array. It can operate also with complex numbers. |
oph_sub_array |
It subtracts each value of measure array b from the value in the same position in measure array a. |
Statistical
NAME |
DESCRIPTION |
oph_aggregate_operator |
It aggregates different measure arrays performing the specified operation on each column of array elements. |
oph_aggregate_stats_final |
It computes a statistical index working vertically on columns of arrays of partial results obtained from oph_aggregate_stats_partial. |
oph_aggregate_stats_partial |
It computes partial results useful to compute a statistical index value working vertically on the columns of arrays of measures. |
oph_aggregate_stats |
It computes a statistical index based on mask value working vertically on the columns of arrays of measures. |
oph_gsl_boxplot |
It computes an array with the five indicators used for the boxplot diagram. |
oph_gsl_correlation |
It computes the Pearson coefficient of two measure arrays. |
oph_gsl_histogram |
It estimates the empiric distribution of a sample of measures contained in the array with n bins. |
oph_gsl_quantile |
It computes the quantile(s) specified as q1,q2,... on the elements of the measure array ordered in an ascending way. |
oph_gsl_sd |
It computes the standard deviation of a binary array. |
oph_gsl_stats |
It computes statistical indexes of the measure array. The type of indexes depends on a mask. |
oph_normalize |
It normalizes a measure array performing the specified operation on ‘count’ elements. |
oph_quantize |
It quantizes an array according to a binary list of quantization level and a binary list of quantization values (expressed as doubles). |
oph_reduce |
It reduces a measure array performing the specified operation on ‘count’ elements. |
oph_reduce2 |
It reduces a measure array performing the specified operation on blocks of count elements. It supports multiple implicit dimension. |
oph_reduce3 |
It reduces a measure array performing the specified operation on blocks of elements (aggregation sets). |
Mining
NAME |
DESCRIPTION |
oph_ccluster_kcluster |
It computes clusters from input data through the use of k-means or k-medians algorithms. |
Miscellaneous
NAME |
DESCRIPTION |
oph_cast |
It converts the measure array value type from input to output type. |
oph_convert_d |
It converts a binary element in a real value. |
oph_convert_l |
It converts a binary element in an integer value. |
oph_dump |
It translates a binary array into a human-readable form. |
oph_get_index_array |
It returns a binary array with values from ‘start value’ from to ‘stop value’. |
oph_to_bin |
It converts a string in a form ‘n1, n2, n3, ...’ into a binary array of measures. |
oph_value_to_bin |
It converts a value into a binary array of measures. |