29 extern double zero_tolerance;
48 #define RC_VECTOR_INITIALIZER {\
int rc_vector_cross_product(rc_vector_t v1, rc_vector_t v2, rc_vector_t *p)
Computes the cross-product of two vectors, each of length 3.
Definition: vector.c:364
int rc_vector_alloc(rc_vector_t *v, int length)
Allocates memory for vector v to have specified length.
Definition: vector.c:30
struct rc_vector_t rc_vector_t
Struct containing the state of a vector and a pointer to dynamically allocated memory to hold its con...
int rc_vector_sum(rc_vector_t v1, rc_vector_t v2, rc_vector_t *s)
Populates vector s with the sum of vectors v1 and v2.
Definition: vector.c:386
double rc_vector_mean(rc_vector_t v)
Returns the mean (average) of all values in vector v or -1.0f on error.
Definition: vector.c:313
int rc_vector_max(rc_vector_t v)
Returns the index of the maximum value in v.
Definition: vector.c:251
int rc_vector_sum_inplace(rc_vector_t *v1, rc_vector_t v2)
Adds vector v2 to v1 and leaves the result in v1.
Definition: vector.c:407
int rc_vector_duplicate(rc_vector_t a, rc_vector_t *b)
Duplicates the contents of vector a and into a new vector b.
Definition: vector.c:157
int rc_vector_random(rc_vector_t *v, int length)
Resizes vector v and fills with random numbers between -1.0 and 1.0.
Definition: vector.c:114
int rc_vector_print_sci(rc_vector_t v)
Prints to stdout the contents of vector v in one line.
Definition: vector.c:187
int rc_vector_from_array(rc_vector_t *v, double *ptr, int length)
Resizes vector v and populates with values from specified array ptr.
Definition: vector.c:139
int rc_vector_free(rc_vector_t *v)
Frees the memory allocated for vector v.
Definition: vector.c:56
int rc_vector_ones(rc_vector_t *v, int length)
Resizes vector v and fills with ones.
Definition: vector.c:102
double rc_vector_norm(rc_vector_t v, double p)
Returns the vector norm defined by sum(abs(v)^p)^(1/p), where p is any positive real value.
Definition: vector.c:222
int rc_vector_projection(rc_vector_t v, rc_vector_t e, rc_vector_t *p)
Populates vector p with the projection of vector v onto e.
Definition: vector.c:327
int rc_vector_times_scalar(rc_vector_t *v, double s)
Multiplies every entry in vector v by scalar s.
Definition: vector.c:210
int rc_vector_zeros(rc_vector_t *v, int length)
Resizes vector v and fills with zeros.
Definition: vector.c:78
int rc_vector_fibonnaci(rc_vector_t *v, int length)
Resizes vector v and fills with Fibonnaci sequence.
Definition: vector.c:125
rc_vector_t rc_vector_empty(void)
Returns an rc_vector_t with no allocated memory and the initialized flag set to 0.
Definition: vector.c:71
int rc_vector_subtract(rc_vector_t v1, rc_vector_t v2, rc_vector_t *s)
Populates vector s with the difference v1 - v2.
Definition: vector.c:424
double rc_vector_dot_product(rc_vector_t v1, rc_vector_t v2)
Calculates the dot product of two equal-length vectors.
Definition: vector.c:350
int rc_vector_zero_out(rc_vector_t *v)
Sets all values of an already-allocated vector to 0.
Definition: vector.c:199
int rc_vector_min(rc_vector_t v)
Returns the index of the minimum value in v.
Definition: vector.c:270
double rc_vector_std_dev(rc_vector_t v)
Returns the standard deviation of the values in a vector.
Definition: vector.c:289
int rc_vector_print(rc_vector_t v)
Prints to stdout the contents of vector v in one line.
Definition: vector.c:175
Struct containing the state of a vector and a pointer to dynamically allocated memory to hold its con...
Definition: vector.h:41
int len
number of elements in the vector
Definition: vector.h:42
double * d
pointer to dynamically allocated data
Definition: vector.h:43
int initialized
initialization flag
Definition: vector.h:44