JWS C Library
C language utility library
|
Declarations for mathematical vector operations. More...
#include <jwsc/config.h>
#include <stdlib.h>
#include "jwsc/base/error.h"
#include "jwsc/math/complex.h"
#include "jwsc/vector/vector.h"
Go to the source code of this file.
Functions | |
add_scalar_to_vector | |
Adds a scalar to a vector. | |
void | add_scalar_to_vector_f (Vector_f **v_out, const Vector_f *v_in, float a) |
Adds a scalar to a single precision vector. | |
void | add_scalar_to_vector_d (Vector_d **v_out, const Vector_d *v_in, double a) |
Adds a scalar to a double precision vector. | |
void | add_scalar_to_vector_cf (Vector_cf **v_out, const Vector_cf *v_in, Complex_f z) |
Adds a scalar to a single precision complex vector. | |
void | add_scalar_to_vector_cd (Vector_cd **v_out, const Vector_cd *v_in, Complex_d z) |
Adds a scalar to a double precision complex vector. | |
multiply_vector_by_scalar | |
Multiplies a vector by a scalar. | |
void | multiply_vector_by_scalar_f (Vector_f **v_out, const Vector_f *v_in, float a) |
Multiplies a single precision vector by a scalar. | |
void | multiply_vector_by_scalar_d (Vector_d **v_out, const Vector_d *v_in, double a) |
Multiplies a double precision vector by a scalar. | |
void | multiply_vector_by_scalar_cf (Vector_cf **v_out, const Vector_cf *v_in, Complex_f z) |
Multiplies a single precision complex vector by a scalar. | |
void | multiply_vector_by_scalar_cd (Vector_cd **v_out, const Vector_cd *v_in, Complex_d z) |
Multiplies a double precision complex vector by a scalar. | |
calc_vector_dot_prod | |
Calculates the dot product of two real vectors. | |
Error * | calc_vector_dot_prod_f (float *dp_out, const Vector_f *v_1, const Vector_f *v_2) |
Calculates the dot product of two single precision vectors. | |
Error * | calc_vector_dot_prod_d (double *dp_out, const Vector_d *v_1, const Vector_d *v_2) |
Calculates the dot product of two double precision vectors. | |
calc_3d_vector_cross_prod | |
Calculates the cross product of two R^3 vectors. | |
Error * | calc_3d_vector_cross_prod_f (Vector_f **v_out, const Vector_f *v_1, const Vector_f *v_2) |
Calculates the cross product of two single precision R^3 vectors. | |
Error * | calc_3d_vector_cross_prod_d (Vector_d **v_out, const Vector_d *v_1, const Vector_d *v_2) |
Calculates the cross product of two double precision R^3 vectors. | |
calc_vector_asum | |
Calculates the absolute sum of a real vector. | |
void | calc_vector_asum_f (float *sum_out, const Vector_f *v) |
Calculates the absolute value sum of a single precision vector. | |
void | calc_vector_asum_d (double *sum_out, const Vector_d *v) |
Calculates the absolute value sum of a double precision vector. | |
calc_vector_mag | |
Calculates the magnitude of a real vector. | |
void | calc_vector_mag_f (float *mag_out, const Vector_f *v) |
Calculates the magnitude of a single precision vector. | |
void | calc_vector_mag_d (double *mag_out, const Vector_d *v) |
Calculates the magnitude of a double precision vector. | |
normalize_vector_sum | |
Normalizes a real vector by its sum. | |
void | normalize_vector_sum_f (Vector_f **v_out, const Vector_f *v_in) |
Normalizes a single precision vector by its sum. | |
void | normalize_vector_sum_d (Vector_d **v_out, const Vector_d *v_in) |
Normalizes a double precision vector by its sum. | |
normalize_vector_mag | |
Normalizes a real vector by its magnitude. | |
void | normalize_vector_mag_f (Vector_f **v_out, const Vector_f *v_in) |
Normalizes a single precision vector by its magnitude. | |
void | normalize_vector_mag_d (Vector_d **v_out, const Vector_d *v_in) |
Normalizes a double precision vector by its magnitude. | |
add_vectors | |
Adds two vectors element-wise. | |
Error * | add_vectors_f (Vector_f **v_out, const Vector_f *v_1, const Vector_f *v_2) |
Adds two single precision vectors element-wise. | |
Error * | add_vectors_d (Vector_d **v_out, const Vector_d *v_1, const Vector_d *v_2) |
Adds two double precision vectors element-wise. | |
Error * | add_vectors_cf (Vector_cf **v_out, const Vector_cf *v_1, const Vector_cf *v_2) |
Adds two single precision complex vectors element-wise. | |
Error * | add_vectors_cd (Vector_cd **v_out, const Vector_cd *v_1, const Vector_cd *v_2) |
Adds two double precision complex vectors element-wise. | |
subtract_vectors | |
Subtracts two vectors element-wise. | |
Error * | subtract_vectors_f (Vector_f **v_out, const Vector_f *v_1, const Vector_f *v_2) |
Subtracts two single precision vectors element-wise. | |
Error * | subtract_vectors_d (Vector_d **v_out, const Vector_d *v_1, const Vector_d *v_2) |
Subtracts two double precision vectors element-wise. | |
Error * | subtract_vectors_cf (Vector_cf **v_out, const Vector_cf *v_1, const Vector_cf *v_2) |
Subtracts two single precision complex vectors element-wise. | |
Error * | subtract_vectors_cd (Vector_cd **v_out, const Vector_cd *v_1, const Vector_cd *v_2) |
Subtracts two double precision complex vectors element-wise. |
Declarations for mathematical vector operations.
Definition in file vector_math.h.
Adds a scalar to a single precision vector.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to add scalar to. |
a | Scalar to add to the values of v_in. |
Definition at line 78 of file vector_math.c.
Adds a scalar to a double precision vector.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to add scalar to. |
a | Scalar to add to the values of v_in. |
Definition at line 106 of file vector_math.c.
Adds a scalar to a single precision complex vector.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to add scalar to. |
z | Scalar to add to the values of v_in. |
Definition at line 135 of file vector_math.c.
Adds a scalar to a double precision complex vector.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to add scalar to. |
z | Scalar to add to the values of v_in. |
Definition at line 169 of file vector_math.c.
Multiplies a single precision vector by a scalar.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to multiply scalar by. |
a | Scalar to multiply the values of v_in by. |
Definition at line 215 of file vector_math.c.
Multiplies a double precision vector by a scalar.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to multiply scalar by. |
a | Scalar to multiply the values of v_in by. |
Definition at line 263 of file vector_math.c.
Multiplies a single precision complex vector by a scalar.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to multiply scalar by. |
z | Scalar to multiply the values of v_in by. |
Definition at line 311 of file vector_math.c.
Multiplies a double precision complex vector by a scalar.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to multiply scalar by. |
z | Scalar to multiply the values of v_in by. |
Definition at line 364 of file vector_math.c.
Calculates the dot product of two single precision vectors.
The vectors must have equal dimensions.
dp_out | Result parameter. |
v_1 | Dot product vector. |
v_2 | Dot product vector. |
Definition at line 432 of file vector_math.c.
Calculates the dot product of two double precision vectors.
The vectors must have equal dimensions.
dp_out | Result parameter. |
v_1 | Dot product vector. |
v_2 | Dot product vector. |
Definition at line 475 of file vector_math.c.
Error* calc_3d_vector_cross_prod_f | ( | Vector_f ** | v_out, |
const Vector_f * | v_1, | ||
const Vector_f * | v_2 | ||
) |
Calculates the cross product of two single precision R^3 vectors.
The Vector must have 3 dimensions.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_1 | First vector in the cross product operation. |
v_2 | Second vector in the cross product operation. |
Definition at line 534 of file vector_math.c.
Error* calc_3d_vector_cross_prod_d | ( | Vector_d ** | v_out, |
const Vector_d * | v_1, | ||
const Vector_d * | v_2 | ||
) |
Calculates the cross product of two double precision R^3 vectors.
The Vector must have 3 dimensions.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_1 | First vector in the cross product operation. |
v_2 | Second vector in the cross product operation. |
Definition at line 582 of file vector_math.c.
void calc_vector_asum_f | ( | float * | sum_out, |
const Vector_f * | v | ||
) |
Calculates the absolute value sum of a single precision vector.
sum_out | Result parameter. Sum of the absolute values of v. |
v | Vector to calculate the sum of. |
Definition at line 630 of file vector_math.c.
void calc_vector_asum_d | ( | double * | sum_out, |
const Vector_d * | v | ||
) |
Calculates the absolute value sum of a double precision vector.
sum_out | Result parameter. Sum of the absolute values of v. |
v | Vector to calculate the sum of. |
Definition at line 652 of file vector_math.c.
void calc_vector_mag_f | ( | float * | mag_out, |
const Vector_f * | v | ||
) |
Calculates the magnitude of a single precision vector.
mag_out | Result parameter. Magnitude of v. |
v | Vector to calculate the magnitude of. |
Definition at line 686 of file vector_math.c.
void calc_vector_mag_d | ( | double * | mag_out, |
const Vector_d * | v | ||
) |
Calculates the magnitude of a double precision vector.
mag_out | Result parameter. Magnitude of v. |
v | Vector to calculate the magnitude of. |
Definition at line 710 of file vector_math.c.
Normalizes a single precision vector by its sum.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to normalize. |
Definition at line 749 of file vector_math.c.
Normalizes a double precision vector by its sum.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to normalize. |
Definition at line 772 of file vector_math.c.
Normalizes a single precision vector by its magnitude.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to normalize. |
Definition at line 807 of file vector_math.c.
Normalizes a double precision vector by its magnitude.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_in | Vector to normalize. |
Definition at line 830 of file vector_math.c.
Adds two single precision vectors element-wise.
The Vector must have equal dimensions.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_1 | Vector to add. |
v_2 | Vector to add. |
Definition at line 874 of file vector_math.c.
Adds two double precision vectors element-wise.
The Vector must have equal dimensions.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_1 | Vector to add. |
v_2 | Vector to add. |
Definition at line 955 of file vector_math.c.
Adds two single precision complex vectors element-wise.
The Vector must have equal dimensions.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_1 | Vector to add. |
v_2 | Vector to add. |
Definition at line 1036 of file vector_math.c.
Adds two double precision complex vectors element-wise.
The Vector must have equal dimensions.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_1 | Vector to add. |
v_2 | Vector to add. |
Definition at line 1121 of file vector_math.c.
Subtracts two single precision vectors element-wise.
The Vector must have equal dimensions.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_1 | Vector to subtract. |
v_2 | Vector to subtract. |
Definition at line 1218 of file vector_math.c.
Subtracts two double precision vectors element-wise.
The Vector must have equal dimensions.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_1 | Vector to subtract. |
v_2 | Vector to subtract. |
Definition at line 1303 of file vector_math.c.
Subtracts two single precision complex vectors element-wise.
The Vector must have equal dimensions.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_1 | Vector to subtract. |
v_2 | Vector to subtract. |
Definition at line 1388 of file vector_math.c.
Subtracts two double precision complex vectors element-wise.
The Vector must have equal dimensions.
v_out | Result parameter. If *v_out is NULL, a vector is allocated; otherwise its space is re-used. |
v_1 | Vector to subtract. |
v_2 | Vector to subtract. |
Definition at line 1477 of file vector_math.c.