JWS C Library
C language utility library
|
Declarations for mathematical matrix block operations. More...
#include <jwsc/config.h>
#include <stdlib.h>
#include <inttypes.h>
#include "jwsc/base/error.h"
#include "jwsc/math/complex.h"
#include "jwsc/matblock/matblock.h"
Go to the source code of this file.
Functions | |
add_scalar_to_matblock | |
Adds a scalar to a matrix block. | |
void | add_scalar_to_matblock_f (Matblock_f **m_out, const Matblock_f *m_in, float a) |
Adds a scalar to a single precision matrix block. | |
void | add_scalar_to_matblock_d (Matblock_d **m_out, const Matblock_d *m_in, double a) |
Adds a scalar to a double precision matrix block. | |
void | add_scalar_to_matblock_cf (Matblock_cf **m_out, const Matblock_cf *m_in, Complex_f z) |
Adds a scalar to a single precision complex matrix block. | |
void | add_scalar_to_matblock_cd (Matblock_cd **m_out, const Matblock_cd *m_in, Complex_d z) |
Adds a scalar to a double precision complex matrix block. | |
multiply_matblock_by_scalar | |
Multiplies a matrix block by a scalar. | |
void | multiply_matblock_by_scalar_f (Matblock_f **m_out, const Matblock_f *m_in, float a) |
Multiplies a single precision matrix block by a scalar. | |
void | multiply_matblock_by_scalar_d (Matblock_d **m_out, const Matblock_d *m_in, double a) |
Multiplies a double precision matrix block by a scalar. | |
void | multiply_matblock_by_scalar_cf (Matblock_cf **m_out, const Matblock_cf *m_in, Complex_f z) |
Multiplies a single precision complex matrix block by a scalar. | |
void | multiply_matblock_by_scalar_cd (Matblock_cd **m_out, const Matblock_cd *m_in, Complex_d z) |
Multiplies a double precision complex matrix block by a scalar. | |
multiply_matblocks_elt_wise | |
Multiplies a two matrix blocks element by element. | |
Error * | multiply_matblocks_elt_wise_f (Matblock_f **m_out, const Matblock_f *m_1, const Matblock_f *m_2) |
Multiples two single precision matrix blocks element by element. | |
Error * | multiply_matblocks_elt_wise_d (Matblock_d **m_out, const Matblock_d *m_1, const Matblock_d *m_2) |
Multiples two double precision matrix blocks element by element. | |
Error * | multiply_matblocks_elt_wise_cf (Matblock_cf **m_out, const Matblock_cf *m_1, const Matblock_cf *m_2) |
Multiples two single precision complex matrix blocks element by element. | |
Error * | multiply_matblocks_elt_wise_cd (Matblock_cd **m_out, const Matblock_cd *m_1, const Matblock_cd *m_2) |
Multiples two double precision complex matrix blocks element by element. | |
add_matblocks | |
Adds two matrix blocks element-wise. | |
Error * | add_matblocks_f (Matblock_f **m_out, const Matblock_f *m_1, const Matblock_f *m_2) |
Adds two single precision matrix blocks element-wise. | |
Error * | add_matblocks_d (Matblock_d **m_out, const Matblock_d *m_1, const Matblock_d *m_2) |
Adds two double precision matrix blocks element-wise. | |
subtract_matblocks | |
Subtracts two matrix blocks element-wise. | |
Error * | subtract_matblocks_f (Matblock_f **m_out, const Matblock_f *m_1, const Matblock_f *m_2) |
Subtracts two single precision matrix blocks element-wise. | |
Error * | subtract_matblocks_d (Matblock_d **m_out, const Matblock_d *m_1, const Matblock_d *m_2) |
Subtracts two double precision matrix blocks element-wise. | |
calc_matblock_asum | |
Calculates the absolute sum of a real matrix block. | |
void | calc_matblock_asum_f (float *sum_out, const Matblock_f *m) |
Calculates the absolute value sum of a single precision matrix block. | |
void | calc_matblock_asum_d (double *sum_out, const Matblock_d *m) |
Calculates the absolute value sum of a double precision matrix block. | |
normalize_matblock_sum | |
Normalizes a real matrix block by its sum. | |
void | normalize_matblock_sum_f (Matblock_f **m_out, const Matblock_f *m_in) |
Normalizes a single precision matrix block by its sum. | |
void | normalize_matblock_sum_d (Matblock_d **m_out, const Matblock_d *m_in) |
Normalizes a double precision matrix block by its sum. | |
abs_matblock | |
Takes the absolute value of all elements of a matrix. | |
void | abs_matblock_f (Matblock_f **m_out, const Matblock_f *m_in) |
Takes the absolute value of all elements of a single precision matrix. | |
void | abs_matblock_d (Matblock_d **m_out, const Matblock_d *m_in) |
Takes the absolute value of all elements of a double precision matrix. | |
threshold_matblock | |
Thresholds a matblock by setting all values below the threshold to zero. | |
void | threshold_matblock_f (Matblock_f **m_out, const Matblock_f *m_in, float threshold) |
Thresholds a single precision matrix block by setting all values below the threshold to zero. | |
void | threshold_matblock_d (Matblock_d **m_out, const Matblock_d *m_in, double threshold) |
Thresholds a double precision matrix block by setting all values below the threshold to zero. |
Declarations for mathematical matrix block operations.
Many of the functions are accelerated if linked against an optimized BLAS library.
Definition in file matblock_math.h.
void add_scalar_to_matblock_f | ( | Matblock_f ** | m_out, |
const Matblock_f * | m_in, | ||
float | a | ||
) |
Adds a scalar to a single precision matrix block.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to add a to. |
a | Scalar to add to the values of m_in. |
Definition at line 79 of file matblock_math.c.
void add_scalar_to_matblock_d | ( | Matblock_d ** | m_out, |
const Matblock_d * | m_in, | ||
double | a | ||
) |
Adds a scalar to a double precision matrix block.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to add a to. |
a | Scalar to add to the values of m_in. |
Definition at line 115 of file matblock_math.c.
void add_scalar_to_matblock_cf | ( | Matblock_cf ** | m_out, |
const Matblock_cf * | m_in, | ||
Complex_f | z | ||
) |
Adds a scalar to a single precision complex matrix block.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to add a to. |
z | Scalar to add to the values of m_in. |
Definition at line 151 of file matblock_math.c.
void add_scalar_to_matblock_cd | ( | Matblock_cd ** | m_out, |
const Matblock_cd * | m_in, | ||
Complex_d | z | ||
) |
Adds a scalar to a double precision complex matrix block.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to add a to. |
z | Scalar to add to the values of m_in. |
Definition at line 188 of file matblock_math.c.
void multiply_matblock_by_scalar_f | ( | Matblock_f ** | m_out, |
const Matblock_f * | m_in, | ||
float | a | ||
) |
Multiplies a single precision matrix block by a scalar.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to multiply scalar with. |
a | Scalar to multiply by the values of m_in. |
Definition at line 237 of file matblock_math.c.
void multiply_matblock_by_scalar_d | ( | Matblock_d ** | m_out, |
const Matblock_d * | m_in, | ||
double | a | ||
) |
Multiplies a double precision matrix block by a scalar.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to multiply scalar with. |
a | Scalar to multiply by the values of m_in. |
Definition at line 286 of file matblock_math.c.
void multiply_matblock_by_scalar_cf | ( | Matblock_cf ** | m_out, |
const Matblock_cf * | m_in, | ||
Complex_f | z | ||
) |
Multiplies a single precision complex matrix block by a scalar.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to multiply scalar with. |
z | Scalar to multiply by the values of m_in. |
Definition at line 335 of file matblock_math.c.
void multiply_matblock_by_scalar_cd | ( | Matblock_cd ** | m_out, |
const Matblock_cd * | m_in, | ||
Complex_d | z | ||
) |
Multiplies a double precision complex matrix block by a scalar.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to multiply scalar with. |
z | Scalar to multiply by the values of m_in. |
Definition at line 389 of file matblock_math.c.
Error* multiply_matblocks_elt_wise_f | ( | Matblock_f ** | m_out, |
const Matblock_f * | m_1, | ||
const Matblock_f * | m_2 | ||
) |
Multiples two single precision matrix blocks element by element.
The matrix blocks must have the same dimensions.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_1 | First (left) matrix block in the multiply operation. |
m_2 | Second (right) matrix block in the multiply operation. |
Definition at line 462 of file matblock_math.c.
Error* multiply_matblocks_elt_wise_d | ( | Matblock_d ** | m_out, |
const Matblock_d * | m_1, | ||
const Matblock_d * | m_2 | ||
) |
Multiples two double precision matrix blocks element by element.
Definition at line 504 of file matblock_math.c.
Error* multiply_matblocks_elt_wise_cf | ( | Matblock_cf ** | m_out, |
const Matblock_cf * | m_1, | ||
const Matblock_cf * | m_2 | ||
) |
Multiples two single precision complex matrix blocks element by element.
Definition at line 546 of file matblock_math.c.
Error* multiply_matblocks_elt_wise_cd | ( | Matblock_cd ** | m_out, |
const Matblock_cd * | m_1, | ||
const Matblock_cd * | m_2 | ||
) |
Multiples two double precision complex matrix blocks element by element.
Definition at line 595 of file matblock_math.c.
Error* add_matblocks_f | ( | Matblock_f ** | m_out, |
const Matblock_f * | m_1, | ||
const Matblock_f * | m_2 | ||
) |
Adds two single precision matrix blocks element-wise.
The matrix block must have equal dimensions.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_1 | Matrix block to add. |
m_2 | Matrix block to add. |
Definition at line 671 of file matblock_math.c.
Error* add_matblocks_d | ( | Matblock_d ** | m_out, |
const Matblock_d * | m_1, | ||
const Matblock_d * | m_2 | ||
) |
Adds two double precision matrix blocks element-wise.
The matrix block must have equal dimensions.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_1 | Matrix block to add. |
m_2 | Matrix block to add. |
Definition at line 761 of file matblock_math.c.
Error* subtract_matblocks_f | ( | Matblock_f ** | m_out, |
const Matblock_f * | m_1, | ||
const Matblock_f * | m_2 | ||
) |
Subtracts two single precision matrix blocks element-wise.
The matrix block must have equal dimensions.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_1 | Matrix block to subtract. |
m_2 | Matrix block to subtract. |
Definition at line 863 of file matblock_math.c.
Error* subtract_matblocks_d | ( | Matblock_d ** | m_out, |
const Matblock_d * | m_1, | ||
const Matblock_d * | m_2 | ||
) |
Subtracts two double precision matrix blocks element-wise.
The matrix block must have equal dimensions.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_1 | Matrix block to subtract. |
m_2 | Matrix block to subtract. |
Definition at line 957 of file matblock_math.c.
void calc_matblock_asum_f | ( | float * | sum_out, |
const Matblock_f * | m | ||
) |
Calculates the absolute value sum of a single precision matrix block.
sum_out | Result parameter. Sum of the absolute values of m. |
m | Matrix block to calculate the sum of. |
Definition at line 1051 of file matblock_math.c.
void calc_matblock_asum_d | ( | double * | sum_out, |
const Matblock_d * | m | ||
) |
Calculates the absolute value sum of a double precision matrix block.
sum_out | Result parameter. Sum of the absolute values of m. |
m | Matrix block to calculate the sum of. |
Definition at line 1075 of file matblock_math.c.
void normalize_matblock_sum_f | ( | Matblock_f ** | m_out, |
const Matblock_f * | m_in | ||
) |
Normalizes a single precision matrix block by its sum.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to normalize. |
Definition at line 1114 of file matblock_math.c.
void normalize_matblock_sum_d | ( | Matblock_d ** | m_out, |
const Matblock_d * | m_in | ||
) |
Normalizes a double precision matrix block by its sum.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to normalize. |
Definition at line 1137 of file matblock_math.c.
void abs_matblock_f | ( | Matblock_f ** | m_out, |
const Matblock_f * | m_in | ||
) |
Takes the absolute value of all elements of a single precision matrix.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to take the absolute value of. |
Definition at line 1170 of file matblock_math.c.
void abs_matblock_d | ( | Matblock_d ** | m_out, |
const Matblock_d * | m_in | ||
) |
Takes the absolute value of all elements of a double precision matrix.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to take the absolute value of. |
Definition at line 1201 of file matblock_math.c.
void threshold_matblock_f | ( | Matblock_f ** | m_out, |
const Matblock_f * | m_in, | ||
float | threshold | ||
) |
Thresholds a single precision matrix block by setting all values below the threshold to zero.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to threshold. |
threshold | Elements below this value will be set to zero |
Definition at line 1243 of file matblock_math.c.
void threshold_matblock_d | ( | Matblock_d ** | m_out, |
const Matblock_d * | m_in, | ||
double | threshold | ||
) |
Thresholds a double precision matrix block by setting all values below the threshold to zero.
m_out | Result parameter. If *m_out is NULL, a matrix block is allocated; otherwise its space is re-used. |
m_in | Matrix block to threshold. |
threshold | Elements below this value will be set to zero |
Definition at line 1277 of file matblock_math.c.