For working with arrays (currently mainly supports 1D vectors) (Git Repo with Notes)
struct Vector = {DataType dtype, int size, Data values}
percentile_method
percentile_vector
function to label the various methods of finding the percentile. (Currently, the function only supports INVERTED_CDF, LINEAR
)
#define LENGTH_ARR(arr) sizeof(arr) / sizeof(*arr)
void view_array(int size, precision_t arr[])
void view_vector(Vector *A)
Vector *zero_vector(DataType dtype, int size)
Returns a vector of the given type and size with all elements as zero.
Vector *A_int = zero_vector(INT, 5); Vector *A_prec = zero_vector(PREC, 5); Vector *A_str = zero_vector(STRING, 5); view_vector(A_int); view_vector(A_prec); view_vector(A_str); ```OUTPUT``` 5-element Vector {int} [ 0 , 0 , 0 , 0 , 0 ] 5-element Vector {precision_t} [ 0.000000 , 0.000000 , 0.000000 , 0.000000 , 0.000000 ] 5-element Vector {string} [ 0 , 0 , 0 , 0 , 0 ]
void free_vector(Vector *V)
Vector *ones_vector(DataType dtype, int size)
Returns a vector of the given type and size with all elements as ones.
Vector *A_int = zero_vector(INT, 5); Vector *A_prec = zero_vector(PREC, 5); Vector *A_str = zero_vector(STRING, 5); view_vector(A_int); view_vector(A_prec); view_vector(A_str); ```OUTPUT``` 5-element Vector {int} [ 1 , 1 , 1 , 1 , 1 ] 5-element Vector {precision_t} [ 1.000000 , 1.000000 , 1.000000 , 1.000000 , 1.000000 ] 5-element Vector {string} [ 1 , 1 , 1 , 1 , 1 ]