Files | |
| file | psVector.h |
| Contains basic vector definitions and operations. | |
Data Structures | |
| struct | psVector |
| An vector to support primitive types. More... | |
Defines | |
| #define | P_PSVECTOR_SET_NALLOC(vec, n) *(long*)&(vec->nalloc) = n |
| #define | PS_ASSERT_VECTOR_NON_NULL(NAME, RVAL) PS_ASSERT_GENERAL_VECTOR_NON_NULL(NAME, return RVAL) |
| #define | PS_ASSERT_GENERAL_VECTOR_NON_NULL(NAME, CLEANUP) |
| #define | PS_ASSERT_VECTOR_NON_EMPTY(NAME, RVAL) PS_ASSERT_GENERAL_VECTOR_NON_EMPTY(NAME, return RVAL) |
| #define | PS_ASSERT_GENERAL_VECTOR_NON_EMPTY(NAME, CLEANUP) |
| #define | PS_ASSERT_VECTOR_TYPE_F32_OR_F64(NAME, RVAL) |
| #define | PS_ASSERT_VECTOR_TYPE_S16_S32_F32(NAME, RVAL) |
| #define | PS_ASSERT_VECTOR_TYPE(NAME, TYPE, RVAL) |
| #define | PS_ASSERT_VECTORS_SIZE_EQUAL(VEC1, VEC2, RVAL) |
| #define | PS_ASSERT_VECTOR_SIZE(VEC, SIZE, RVAL) |
| #define | PS_ASSERT_VECTOR_TYPE_EQUAL(VEC1, VEC2, RVAL) |
| #define | PS_VECTOR_PRINT_F32(NAME) |
| #define | PS_VECTOR_PRINT_F64(NAME) |
Functions | |
| bool | psMemCheckVector (psPtr ptr) |
| Checks the type of a particular pointer. | |
| psVector * | psVectorAlloc (long nalloc, psElemType type) |
| Allocate a vector. | |
| psVector * | psVectorRealloc (psVector *vector, long nalloc) |
| Reallocate a vector. | |
| psVector * | psVectorExtend (psVector *vector, long delta, long nExtend) |
| Extend a vector's length. | |
| psVector * | psVectorRecycle (psVector *vector, long nalloc, psElemType type) |
| Recycle a vector. | |
| psVector * | psVectorCopy (psVector *output, const psVector *input, psElemType type) |
| Copy a vector, converting types. | |
| psVector * | psVectorSort (psVector *outVector, const psVector *inVector) |
| Sort an array of floats. | |
| psVector * | psVectorSortIndex (psVector *outVector, const psVector *inVector) |
| Creates an array of indices based on sort ordered of array. | |
| char * | psVectorToString (psVector *vector, int maxLength) |
| Creates a string from a psVector's values in the form "[x0,x1,x2]". | |
| psF64 | p_psVectorGetElementF64 (psVector *vector, int position) |
| Returns an element in the vector as a psF64 value. | |
| bool | p_psVectorPrint (int fd, psVector *a, char *name) |
| Print a vector to a stream. | |
| bool | psVectorInit (psVector *vector,...) |
| Initializes the vector with the given value. | |
| psVector * | psVectorCreate (psVector *input, double lower, double upper, double delta, psElemType type) |
| Creates a new vector, or reallocates the provided vector if input is not NULL. | |
| bool | psVectorSet (psVector *input, long position, double complex value) |
| Sets the value of the input vector at the specified position to value. | |
| double complex | psVectorGet (const psVector *input, long position) |
| Returns the value of the input vector at the specified position. | |
| long | psVectorCountPixelMask (psVector *mask, psMaskType value) |
| Returns the number of pixels in the vector which satisfy any of the mask bits. | |
| long | psVectorLength (const psVector *vector) |
| Get the number of elements in use from a specified psVector. | |
|
|
Definition at line 57 of file psVector.h. |
|
|
Value: if ((NAME)->n < 1) { \ psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ "Unallowable operation: psVector %s has no elements.", \ #NAME); \ CLEANUP; \ } \ Definition at line 285 of file psVector.h. |
|
|
Value: if ((NAME) == NULL || (NAME)->data.U8 == NULL) { \ psError(PS_ERR_BAD_PARAMETER_NULL, true, \ "Unallowable operation: psVector %s or its data is NULL.", \ #NAME); \ CLEANUP; \ } \ Definition at line 276 of file psVector.h. |
|
|
Definition at line 284 of file psVector.h. |
|
|
Definition at line 275 of file psVector.h. |
|
|
Value: if (VEC->n != SIZE) { \ psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ "psVector %s has size %d, should be %d.", \ #VEC, VEC->n, SIZE); \ return(RVAL); \ } Definition at line 325 of file psVector.h. |
|
|
Value: if ((NAME)->type.type != TYPE) { \ psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ "Unallowable operation: psVector %s has incorrect type.", \ #NAME); \ return(RVAL); \ } Definition at line 309 of file psVector.h. |
|
|
Value: if (VEC1->type.type != VEC2->type.type) { \ psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ "psVector %s has size %d, psVector %s has size %d.", \ #VEC1, VEC1->type.type, #VEC2, VEC2->type.type); \ return(RVAL); \ } Definition at line 333 of file psVector.h. |
|
|
Value: if (((NAME)->type.type != PS_TYPE_F32) && ((NAME)->type.type != PS_TYPE_F64)) { \ psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ "psVector %s: bad type(%d)", \ #NAME, NAME->type.type); \ return(RVAL); \ } \ Definition at line 293 of file psVector.h. |
|
|
Value: if (((NAME)->type.type != PS_TYPE_S16) && ((NAME)->type.type != PS_TYPE_S32) && ((NAME)->type.type != PS_TYPE_F32)) { \ psError(PS_ERR_BAD_PARAMETER_TYPE, true, \ "psVector %s: bad type(%d)", \ #NAME, NAME->type.type); \ return(RVAL); \ } \ Definition at line 301 of file psVector.h. |
|
|
Value: if (VEC1->n != VEC2->n) { \ psError(PS_ERR_BAD_PARAMETER_SIZE, true, \ "psVector %s has size %d, psVector %s has size %d.", \ #VEC1, VEC1->n, #VEC2, VEC2->n); \ return(RVAL); \ } Definition at line 317 of file psVector.h. |
|
|
Value: if (NAME != NULL) { \ for (int my_i=0;my_i<(NAME)->n;my_i++) { \ printf("%s->data.F32[%d] is %f\n", #NAME, my_i, (NAME)->data.F32[my_i]); \ } \ printf("\n"); \ } else {\ printf("MACRO WARNING: vector %s is NULL.\n", #NAME); \ }\ Definition at line 341 of file psVector.h. |
|
|
Value: if (NAME != NULL) { \ for (int my_i=0;my_i<(NAME)->n;my_i++) { \ printf("%s->data.F64[%d] is %f\n", #NAME, my_i, (NAME)->data.F64[my_i]); \ } \ printf("\n"); \ } else {\ printf("MACRO WARNING: vector %s is NULL.\n", #NAME); \ }\ Definition at line 351 of file psVector.h. |
|
||||||||||||
|
Returns an element in the vector as a psF64 value.
|
|
||||||||||||||||
|
Print a vector to a stream.
|
|
|
Checks the type of a particular pointer. Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
|
|
||||||||||||
|
Allocate a vector. Uses psLib memory allocation functions to create a vector collection of data as defined by the psType type.
|
|
||||||||||||||||
|
Copy a vector, converting types. Performs a deep copy of the elements of one psVector to a new psVector, converting numeric types to a specified type.
|
|
||||||||||||
|
Returns the number of pixels in the vector which satisfy any of the mask bits. An error (eg, invalid vector) results in a return value of -1. The vector must be U8.
|
|
||||||||||||||||||||||||
|
Creates a new vector, or reallocates the provided vector if input is not NULL. The created vector consists of the data range starting at lower, running to upper, in steps of delta. The upper-end value is exclusive; the sequence is equivalent to for (x = lower; x <= upper - 1; x += delta).
|
|
||||||||||||||||
|
Extend a vector's length. Increments a vector's length, n, by the specified number of elements. If the allocated storage is less than the current vector's length plus twice the number of elements to be added, it is reallocated larger by a given amount.
|
|
||||||||||||
|
Returns the value of the input vector at the specified position. A negative position means index from the end.
|
|
||||||||||||
|
Initializes the vector with the given value. The input data is cast to match the vector datatype, allowing for integers to be preserved.
|
|
|
Get the number of elements in use from a specified psVector. (vector.n)
|
|
||||||||||||
|
Reallocate a vector. Uses psLib memory allocation functions to reallocate a vector collection of data. The vector is reallocated according to the psType type member contained within the vector.
|
|
||||||||||||||||
|
Recycle a vector. Uses psLib memory allocation functions to reallocate a vector collection of data. The vector is reallocated according to the psElemType type parameter.
|
|
||||||||||||||||
|
Sets the value of the input vector at the specified position to value. A negative position means index from the end.
|
|
||||||||||||
|
Sort an array of floats. Sorts an array of floats in ascending order. This function is valid for all non-complex data types.
|
|
||||||||||||
|
Creates an array of indices based on sort ordered of array. Sorts a vector and creates an integer array holding indices of sorted float values based on pre-sort index positions.
|
|
||||||||||||
|
Creates a string from a psVector's values in the form "[x0,x1,x2]".
|
1.4.4