|
ScaMaC
0.8.2
A Scalable Matrix Collection
|
Vector creation and manipulation. More...
#include "scamac_inttypes.h"#include "scamac_defs.h"#include "scamac_error.h"#include <stdbool.h>#include <complex.h>Go to the source code of this file.
Functions | |
| ScamacErrorCode | scamac_vectormem_alloc (ScamacInt nv, int m, ScamacValType valtype, ScamacVectorMem **v) |
| Allocate vector(s)equivalent to calling scamac_vector_multiple_alloc with m=1. More... | |
| ScamacErrorCode | scamac_vectormem_free (ScamacVectorMem *v) |
| ScamacErrorCode | scamac_vector_view (ScamacVectorMem *vm, ScamacVector **v) |
| ScamacErrorCode | scamac_vector_view_single (ScamacVectorMem *vm, int i, ScamacVector **v) |
| ScamacErrorCode | scamac_vector_free (ScamacVector *v) |
| ScamacErrorCode | scamac_vector_sub_single (const ScamacVector *v, int i, ScamacVector **w) |
| ScamacErrorCode | scamac_vector_complement (const ScamacVector *v, ScamacVector **w) |
| ScamacErrorCode | scamac_vector_align (ScamacVector *v) |
| ScamacErrorCode | scamac_vector_assign (const char *which, ScamacVector *v) |
| ScamacErrorCode | scamac_vector_copy (const ScamacVector *v, ScamacVector *w) |
| ScamacErrorCode | scamac_vector_dot (const ScamacVector *v1, const ScamacVector *v2, double *dot) |
| ScamacErrorCode | scamac_vector_nrm2 (const ScamacVector *v, double *nrm) |
| ScamacErrorCode | scamac_vector_dotmatrix (const ScamacVector *v1, const ScamacVector *v2, double *dotm) |
| ScamacErrorCode | scamac_vector_gram (const ScamacVector *v, double *gram) |
| ScamacErrorCode | scamac_mvector_axpby (const ScamacVector *x, ScamacVector *y, const double *a, const double *b) |
| ScamacErrorCode | scamac_mvector_scal (ScamacVector *x, const double *s) |
| ScamacErrorCode | scamac_vector_transform (const ScamacVector *x, const double *a, ScamacVector *y) |
| ScamacErrorCode | scamac_vector_orthogonalize (const ScamacVector *v, ScamacVector *w, double *r, int *p) |
Vector creation and manipulation.
| ScamacErrorCode scamac_mvector_axpby | ( | const ScamacVector * | x, |
| ScamacVector * | y, | ||
| const double * | a, | ||
| const double * | b | ||
| ) |
y -> a*x + b*y
| ScamacErrorCode scamac_mvector_scal | ( | ScamacVector * | x, |
| const double * | s | ||
| ) |
x[i] -> s[i]*x[i] for all vectors i
| ScamacErrorCode scamac_vector_align | ( | ScamacVector * | v | ) |
move vectors in v to the front of vecmem - e.g. to guarantee consecutive arrangement in memory, or just to simplify bookkeeping
| ScamacErrorCode scamac_vector_assign | ( | const char * | which, |
| ScamacVector * | v | ||
| ) |
for testing purposes: assign specify types of vectors which = "Hilbert", "Nearly_Dependent", "Unit"
| ScamacErrorCode scamac_vector_complement | ( | const ScamacVector * | v, |
| ScamacVector ** | w | ||
| ) |
set w to vectors not contained in v
| ScamacErrorCode scamac_vector_copy | ( | const ScamacVector * | v, |
| ScamacVector * | w | ||
| ) |
get an actual copy of vectors v, w must be exclusive [scamac_vector_check_exclusivity(v,w) == TRUE]
| ScamacErrorCode scamac_vector_dot | ( | const ScamacVector * | v1, |
| const ScamacVector * | v2, | ||
| double * | dot | ||
| ) |
vector-by-vector dot product length v1 = length v2, length dot >= length v{1,2}
| ScamacErrorCode scamac_vector_dotmatrix | ( | const ScamacVector * | v1, |
| const ScamacVector * | v2, | ||
| double * | dotm | ||
| ) |
matrix of scalar products V1^+ V2 length dotm >= length v1 * length v2 on exit, dotm[i + j * (length v1) ] = < v1[i], v2[j] > for 0<=i < length v1, 0<=j < length v2
| ScamacErrorCode scamac_vector_free | ( | ScamacVector * | v | ) |
| ScamacErrorCode scamac_vector_gram | ( | const ScamacVector * | v, |
| double * | gram | ||
| ) |
matrix of scalar products V^+ W if V==W, this is the Gram matrix length gram >= length v ** 2 on exit, gram[i + j * (length v) ] = < v[i], v[j] > for 0<= i,j < length v
remark: identical to dotmatrix with v1=v2=v, but computes less dot products
| ScamacErrorCode scamac_vector_nrm2 | ( | const ScamacVector * | v, |
| double * | nrm | ||
| ) |
vector norm
| ScamacErrorCode scamac_vector_orthogonalize | ( | const ScamacVector * | v, |
| ScamacVector * | w, | ||
| double * | r, | ||
| int * | p | ||
| ) |
orthogonalize vectors in w against vectors in v
vectors in v must be orthogonal + normalized
if v = (v1, ..., vm) and w = (w1, ..., wn): on return, vectors in w are normalized, and the full set (v1, ..., vm, w1, ..., wn) is orthogonal
in this basis, the original input vectors in w have the expansion W = (V W_out) R P with the upper trapezoidal (m+n) x n matrix R and the n x n permutation matrix P.
[up to a permutation, R is upper triangular. The permutation is returned in P]
| ScamacErrorCode scamac_vector_sub_single | ( | const ScamacVector * | v, |
| int | i, | ||
| ScamacVector ** | w | ||
| ) |
get a (view of) a subsets of vectors
| ScamacErrorCode scamac_vector_transform | ( | const ScamacVector * | x, |
| const double * | a, | ||
| ScamacVector * | y | ||
| ) |
Y = X A, that is y_i = sum_j a_ji x_j requires matrix A = m x n, where m: number of vectors in X n: number of vectors in Y
| ScamacErrorCode scamac_vector_view | ( | ScamacVectorMem * | vm, |
| ScamacVector ** | v | ||
| ) |
construct the "identity view" of vm on first call with v, must have v==NULL
| ScamacErrorCode scamac_vector_view_single | ( | ScamacVectorMem * | vm, |
| int | i, | ||
| ScamacVector ** | v | ||
| ) |
construct a "single vector view" of vm
| ScamacErrorCode scamac_vectormem_alloc | ( | ScamacInt | nv, |
| int | m, | ||
| ScamacValType | valtype, | ||
| ScamacVectorMem ** | v | ||
| ) |
Allocate vector(s)equivalent to calling scamac_vector_multiple_alloc with m=1.
| ScamacErrorCode scamac_vectormem_free | ( | ScamacVectorMem * | v | ) |
1.8.13