Minimal linear algebra for matrix vector operations, binomials and factorials.
More...
#include "tools.h"
#include <math.h>
#include <stdbool.h>
#include <stdlib.h>
|
|
#define | EPS ldexp(1, -32) |
| | Minimal distance of two vector elements considered unequal.
|
| |
|
| void | transpose (unsigned int dim, double *m) |
| | Square matrix transpose.
|
| |
| bool | equals (unsigned int dim, const double *v1, const double *v2) |
| | Check if two vectors are equal.
|
| |
| void | invert (unsigned int dim, double *m, int *p, double *r) |
| | Invert matrix.
|
| |
| double | inf_norm (unsigned int dim, const double *m) |
| | Compute infinity norm (maximum sum row norm).
|
| |
| unsigned int | mult_abs (unsigned int dim, const unsigned int *alpha) |
| | Compute absolute value of multi-index, that is the sum of its components.
|
| |
| unsigned long long | binom (unsigned long long n, unsigned long long k) |
| | Compute the binomial coefficient bionm(n,k).
|
| |
| double * | vectorProj (unsigned int dim, const double *m, const double *m_invt, const double *v) |
| | calculate projection of vector to elementary lattice cell.
|
| |
Minimal linear algebra for matrix vector operations, binomials and factorials.
◆ binom()
| unsigned long long binom |
( |
unsigned long long | n, |
|
|
unsigned long long | k ) |
Compute the binomial coefficient bionm(n,k).
- Parameters
-
| [in] | n | non-negative integer greater or equal k. |
| [in] | k | non-negative integer smaller or equal n. |
- Returns
- binom(n)(k).
◆ equals()
| bool equals |
( |
unsigned int | dim, |
|
|
const double * | v1, |
|
|
const double * | v2 ) |
Check if two vectors are equal.
check if two vectors are equal.
- Parameters
-
| [in] | dim | dimension of the vectors. |
| [in] | v1 | first vector. |
| [in] | v2 | second vector. |
- Returns
- true if the vectors are equal, false if the vectors are not equal.
◆ inf_norm()
| double inf_norm |
( |
unsigned int | dim, |
|
|
const double * | m ) |
Compute infinity norm (maximum sum row norm).
- Parameters
-
| [in] | dim | dimension of the vectors. |
| [in] | m | matrix to compute infinity norm of. |
◆ invert()
| void invert |
( |
unsigned int | dim, |
|
|
double * | m, |
|
|
int * | p, |
|
|
double * | r ) |
Invert matrix.
- Precondition
- dim > 0
- Parameters
-
| [in] | dim | dimension of the vectors. |
| [in,out] | m | matrix to invert. overwritten bei LU-decomposition. |
| [out] | p | permutation vector. |
| [out] | r | where inverse matrix is stored. |
◆ mult_abs()
| unsigned int mult_abs |
( |
unsigned int | dim, |
|
|
const unsigned int * | alpha ) |
Compute absolute value of multi-index, that is the sum of its components.
- Parameters
-
| [in] | dim | dimension of alpha end vec. |
| [in] | alpha | multi-index. |
- Returns
- absolute values of alpha.
-
absolute values of alpha.
◆ transpose()
| void transpose |
( |
unsigned int | dim, |
|
|
double * | m ) |
Square matrix transpose.
square matrix transpose.
- Parameters
-
| [in] | dim | dimension of the square matrix. |
| [in,out] | m | square matrix. |
◆ vectorProj()
| double * vectorProj |
( |
unsigned int | dim, |
|
|
const double * | m, |
|
|
const double * | m_invt, |
|
|
const double * | v ) |
calculate projection of vector to elementary lattice cell.
- Parameters
-
| [in] | dim | dimension of the input vectors |
| [in] | m | matrix that transforms the lattice in the function. |
| [in] | m_invt | inverse of m. |
| [in] | v | vector for which the projection to the elementary lattice cell is needet. |
- Returns
- projection of v to the elementary lattice cell.