Functions | |
cpl_vector * | cpl_vector_new (int n) |
Create a new cpl_vector. | |
cpl_vector * | cpl_vector_wrap (int n, double *data) |
Create a cpl_vector from existing data. | |
void | cpl_vector_delete (cpl_vector *v) |
Delete a cpl_vector. | |
void * | cpl_vector_unwrap (cpl_vector *v) |
Delete a cpl_vector except the data array. | |
void | cpl_vector_dump (const cpl_vector *v, FILE *stream) |
Dump a cpl_vector as ASCII to a stream. | |
cpl_vector * | cpl_vector_load (const char *filename) |
Read a list of values from an ASCII file and create a cpl_vector. | |
cpl_vector * | cpl_vector_duplicate (const cpl_vector *v) |
This function duplicates an existing vector and allocates memory. | |
cpl_error_code | cpl_vector_copy (cpl_vector *destination, const cpl_vector *source) |
This function copies contents of a vector into another vector. | |
int | cpl_vector_get_size (const cpl_vector *in) |
Get the size of the vector. | |
cpl_error_code | cpl_vector_set_size (cpl_vector *in, int newsize) |
Resize the vector. | |
double * | cpl_vector_get_data (const cpl_vector *in) |
Get a pointer to the data part of the vector. | |
double | cpl_vector_get (const cpl_vector *in, int index) |
Get an element of the vector. | |
cpl_error_code | cpl_vector_set (cpl_vector *in, int index, double value) |
Set an element of the vector. | |
cpl_error_code | cpl_vector_add (cpl_vector *v1, const cpl_vector *v2) |
Add a cpl_vector to another. | |
cpl_error_code | cpl_vector_subtract (cpl_vector *v1, const cpl_vector *v2) |
Subtract a cpl_vector from another. | |
cpl_error_code | cpl_vector_multiply (cpl_vector *v1, const cpl_vector *v2) |
Multiply two vectors component-wise. | |
cpl_error_code | cpl_vector_divide (cpl_vector *v1, const cpl_vector *v2) |
Divide two vectors element-wise. | |
double | cpl_vector_product (const cpl_vector *v1, const cpl_vector *v2) |
Compute the vector dot product. | |
cpl_error_code | cpl_vector_sort (cpl_vector *v, int c) |
Sort a cpl_vector by increasing/decreasing data. | |
cpl_error_code | cpl_vector_fill (cpl_vector *v, double val) |
Fill a cpl_vector. | |
cpl_error_code | cpl_vector_sqrt (cpl_vector *v) |
Compute the sqrt of a cpl_vector. | |
int | cpl_vector_find (const cpl_vector *sorted, double key) |
In a sorted vector find the element closest to the given value. | |
cpl_vector * | cpl_vector_extract (const cpl_vector *v, int istart, int istop, int istep) |
Extract a sub_vector from a vector. | |
double | cpl_vector_get_min (const cpl_vector *v) |
Get the minimum of the cpl_vector. | |
double | cpl_vector_get_max (const cpl_vector *v) |
Get the maximum of the cpl_vector. | |
double | cpl_vector_get_mean (const cpl_vector *v) |
Compute the mean value of vector elements. | |
double | cpl_vector_get_median (const cpl_vector *v) |
Compute the median of the elements of a vector. | |
double | cpl_vector_get_stdev (const cpl_vector *v) |
Compute the bias-corrected standard deviation of a vectors elements. | |
int | cpl_vector_correlate (cpl_vector *vxc, const cpl_vector *v1, const cpl_vector *v2) |
Cross-correlation of two vectors. | |
cpl_vector * | cpl_vector_filter_lowpass_create (const cpl_vector *v, cpl_lowpass filter_type, int hw) |
Apply a low-pass filter to a cpl_vector. | |
cpl_vector * | cpl_vector_filter_median_create (const cpl_vector *v, int hw) |
Apply a 1d median filter of given half-width to a cpl_vector. | |
cpl_error_code | cpl_vector_add_scalar (cpl_vector *v, double addend) |
Elementwise addition of a scalar to a vector. | |
cpl_error_code | cpl_vector_subtract_scalar (cpl_vector *v, double subtrahend) |
Elementwise subtraction of a scalar from a vector. | |
cpl_error_code | cpl_vector_multiply_scalar (cpl_vector *v, double factor) |
Elementwise multiplication of a vector with a scalar. | |
cpl_error_code | cpl_vector_divide_scalar (cpl_vector *v, double divisor) |
Elementwise division of a vector with a scalar. | |
cpl_error_code | cpl_vector_logarithm (cpl_vector *v, double base) |
Compute the element-wise logarithm. | |
cpl_error_code | cpl_vector_exponential (cpl_vector *v, double base) |
Compute the exponential of all vector elements. | |
cpl_error_code | cpl_vector_power (cpl_vector *v, double exponent) |
Compute the power of all vector elements. | |
cpl_error_code | cpl_vector_fill_kernel_profile (cpl_vector *profile, cpl_kernel type, double radius) |
Fill a vector with a kernel profile. |
A cpl_vector is an object containing a list of values (as doubles) and the (always positive) number of values. The functionalities provided here are simple ones like sorting, statistics, or simple operations. The cpl_bivector object is composed of two of these vectors.
#include "cpl_vector.h"
|
Add a cpl_vector to another.
The input vectors must have the same size. Possible _cpl_error_code_ set in this function:
|
|
Elementwise addition of a scalar to a vector.
Possible _cpl_error_code_ set in this function:
|
|
This function copies contents of a vector into another vector.
|
|
Cross-correlation of two vectors.
The length of v2 may not exceed that of v1. If the difference in length between v1 and v2 is less than half_search then this difference must be even (if the difference is odd resampling of v2 may be useful). The cross-correlation is computed with shifts ranging from -half_search to half_search. On succesful return element i (starting with 0) of vxc contains the cross- correlation at offset i-half_search. On error vxc is unmodified. The cross-correlation is in fact the dot-product of two unit-vectors and ranges therefore from -1 to 1. The cross-correlation is, in absence of rounding errors, commutative only for equal-sized vectors, i.e. changing the order of v1 and v2 will move element j in vxc to 2*half_search - j and thus change the return value from i to 2*half_search - i. If, in absence of rounding errors, more than one shift would give the maximum cross-correlation, rounding errors may cause any one of those shifts to be returned. If rounding errors have no effect the index corresponding to the shift with the smallest absolute value is returned (with preference given to the smaller of two indices that correspond to the same absolute shift). If v1 is longer than v2, the first element in v1 used for the resulting cross-correlation is max(0,shift + (cpl_vector_get_size(v1)-cpl_vector_get_size(v2))/2). Cross-correlation with half_search == 0 requires about 8n FLOPs, where n = cpl_vector_get_size(v2). Each increase of half_search by 1 requires about 4n FLOPs more, when all of v2's elements can be cross-correlated, otherwise the extra cost is about 4m, where m is the number of elements in v2 that can be cross-correlated, n - half_search <= m < n. In case of error, the _cpl_error_code_ code is set, and the returned delta and cross-correlation is undefined. Possible _cpl_error_code_ set in this function:
|
|
Delete a cpl_vector.
|
|
Divide two vectors element-wise.
Possible _cpl_error_code_ set in this function:
|
|
Elementwise division of a vector with a scalar.
Possible _cpl_error_code_ set in this function:
|
|
Dump a cpl_vector as ASCII to a stream.
Comment lines start with the hash character.
stream may be NULL in which case
|
|
This function duplicates an existing vector and allocates memory.
Possible _cpl_error_code_ set in this function:
|
|
Compute the exponential of all vector elements.
Possible _cpl_error_code_ set in this function:
|
|
Extract a sub_vector from a vector.
FIXME: Currently istop must be greater than istart. FIXME: Currently istep must equal 1. Possible _cpl_error_code_ set in this function:
|
|
Fill a cpl_vector.
Possible _cpl_error_code_ set in this function:
|
|
Fill a vector with a kernel profile.
Possible _cpl_error_code_ set in this function:
|
|
Apply a low-pass filter to a cpl_vector.
Possible _cpl_error_code_ set in this function:
|
|
Apply a 1d median filter of given half-width to a cpl_vector.
Possible _cpl_error_code_ set in this function:
|
|
In a sorted vector find the element closest to the given value.
If two (neighboring) elements with different values both minimize fabs(sorted[index] - key) the index of the larger element is returned. If the vector contains identical elements that minimize fabs(sorted[index] - key) then it is undefined which element has its index returned. Possible _cpl_error_code_ set in this function:
|
|
Get an element of the vector.
Possible _cpl_error_code_ set in this function:
|
|
Get a pointer to the data part of the vector.
|
|
Get the maximum of the cpl_vector.
|
|
Compute the mean value of vector elements.
|
|
Compute the median of the elements of a vector.
|
|
Get the minimum of the cpl_vector.
Possible _cpl_error_code_ set in this function:
|
|
Get the size of the vector.
|
|
Compute the bias-corrected standard deviation of a vectors elements.
The length of v must be at least 2. |
|
Read a list of values from an ASCII file and create a cpl_vector.
The returned object must be deallocated using cpl_vector_delete() In addition to normal files, FIFO (see man mknod) are also supported. Possible _cpl_error_code_ set in this function:
|
|
Compute the element-wise logarithm.
Possible _cpl_error_code_ set in this function:
|
|
Multiply two vectors component-wise.
|
|
Elementwise multiplication of a vector with a scalar.
Possible _cpl_error_code_ set in this function:
|
|
Create a new cpl_vector.
Possible _cpl_error_code_ set in this function:
|
|
Compute the power of all vector elements.
Possible _cpl_error_code_ set in this function:
|
|
Compute the vector dot product.
Possible _cpl_error_code_ set in this function:
|
|
Set an element of the vector.
|
|
Resize the vector.
|
|
Sort a cpl_vector by increasing/decreasing data.
Possible _cpl_error_code_ set in this function:
|
|
Compute the sqrt of a cpl_vector.
If an element in v is negative v is not modified and CPL_ERROR_ILLEGAL_INPUT is returned. Possible _cpl_error_code_ set in this function:
|
|
Subtract a cpl_vector from another.
|
|
Elementwise subtraction of a scalar from a vector.
Possible _cpl_error_code_ set in this function:
|
|
Delete a cpl_vector except the data array.
|
|
Create a cpl_vector from existing data.
Possible _cpl_error_code_ set in this function:
|