Node vectors are defined by a gnn_node_vector structure which describes a slice of an array of gnn_node pointers. Different vectors can be created which point to the same block. A vector slice is a set of equally-spaced elements of an area of memory.
The gnn_node_vector structure contains five components, the size, the stride, a pointer to the memory where the elements are stored, data, a pointer to the block owned by the vector, block, if any, and an ownership flag, owner. The structure is very simple and looks like this,
typedef struct { size_t size; size_t stride; size_t blocksize; double * data; int owner; } gnn_node_vector;
The size corresponds to the number of vector elements. The valid indices are 0, 1, 2, ..., size-1. The stride is the step size from one element to another in physical memory, measured in sizeof(gnn_node*). The pointer data points to the first vector element. If the vector own this pointer array, i.e. if it was created and will be destroyed with it, then owner is equal to 1. If it doesn't own the array, then owner is 0, and at deallocation of the gnn_node_vector, the array isn't deallocated. The blocksize field measures the number of memory units that the vector spans.
|
||||||||||||
|
This function copies the elements of the vector
Definition at line 381 of file gnn_node_vector.c. |
|
|
This function counts the number of elements pointing to a non-NULL location.
Definition at line 248 of file gnn_node_vector.c. |
|
|
This function frees the memory of a gnn_node_vector and destroys all its pointed nodes by calling gnn_node_destroy on each one of them.
Definition at line 148 of file gnn_node_vector.c. |
|
|
This function duplicates a given vector, by creating a new fresh one pointing to the same nodes.
Definition at line 352 of file gnn_node_vector.c. |
|
|
This function frees the memory of a gnn_node_vector. The pointed nodes won't be destroyed.
Definition at line 128 of file gnn_node_vector.c. |
|
||||||||||||
|
This function returns the pointer located at the i-th position.
Definition at line 177 of file gnn_node_vector.c. |
|
|
This function returns 1 if all elements are equal to NULL.
Definition at line 223 of file gnn_node_vector.c. |
|
|
This function creates a new vector with NULL pointers of size
Definition at line 86 of file gnn_node_vector.c. |
|
|
Definition at line 327 of file gnn_node_vector.c. |
|
||||||||||||||||
|
This function sets a new value for the element located at the i-th position. It should be a pointer to a valid gnn_node or NULL. You should be carefull and not delete a needed pointer in order to not lose memory.
Definition at line 201 of file gnn_node_vector.c. |
|
||||||||||||||||
|
This function creates a subvector view of the given vector, starting at
gnn_node_vector_view view; gnn_node_vector *w; // v is a pointer to a gnn_node_vector view = gnn_node_vector_subvector (v, 2, 5); // get a pointer w = &(view.vector);
Definition at line 431 of file gnn_node_vector.c. |
|
||||||||||||||||||||
|
This function creates a subvector view of the given vector, starting at
gnn_node_vector_view view; gnn_node_vector *w; // obtain a view of the first 5 odd elements of the vector v view = gnn_node_vector_subvector_with_stride (v, 1, 2, 5); // get a pointer w = &(view.vector);
Definition at line 464 of file gnn_node_vector.c. |
|
||||||||||||
|
This function swaps the elements of the node vectors. This is accomplished by interchanging its underlying arrays.
Definition at line 276 of file gnn_node_vector.c. |
|
||||||||||||||||
|
This function swaps the element located at
Definition at line 303 of file gnn_node_vector.c. |
1.2.18