85 #define AA_DVEC_REF(v,i) ((v)->data[(i) * (v)->inc])
94 #define AA_DMAT_REF(M,i,j) (((M)->data)[(M)->ld*(j) + (i)])
119 #define AA_VEC_ARGS(X) (X->data), ((int)(X->inc))
124 #define AA_MAT_ARGS(X) (X->data), ((int)(X->ld))
265 #define AA_MAT_DIAG(VEC,MAT) \
266 aa_dvec_view((VEC), (MAT)->cols, (MAT)->data, 1+(MAT)->ld);
431 double alpha,
const struct aa_dmat *A,
433 double beta,
struct aa_dvec *y );
446 double alpha,
const struct aa_dmat *A,
448 double beta,
struct aa_dmat *C );
#define AA_API
calling and name mangling convention for functions
AA_API void aa_dvec_set(struct aa_dvec *vec, double alpha)
Fill a vector.
AA_API void aa_dmat_view_block(struct aa_dmat *dst, const struct aa_dmat *src, aa_la_size row_start, aa_la_size col_start, aa_la_size rows, aa_la_size cols)
View a block of a matrix.
AA_API void aa_dvec_view(struct aa_dvec *vec, aa_la_size len, double *data, aa_la_size inc)
Fill in a vector descriptor.
AA_API struct aa_dvec * aa_dvec_dup(struct aa_mem_region *reg, const struct aa_dvec *src)
Duplicate vector out of region.
AA_API void aa_dmat_zero(struct aa_dmat *mat)
Zero a matrix.
static struct aa_dmat AA_DMAT_INIT(aa_la_size rows, aa_la_size cols, double *data, aa_la_size ld)
Fill in a matrix descriptor.
AA_API void aa_dmat_scal(struct aa_dmat *A, double alpha)
Scale the matrix A by alpha.
AA_API void aa_dvec_inc(double alpha, struct aa_dvec *x)
Increment x by alpha.
static struct aa_dvec AA_DVEC_INIT(aa_la_size len, double *data, aa_la_size inc)
Fill in a vector descriptor.
AA_API void aa_dmat_diag_vec(const struct aa_dmat *src, struct aa_dvec *dst)
View the diagonal of a matrix as a vector.
AA_API struct aa_dmat * aa_dmat_dup(struct aa_mem_region *reg, const struct aa_dmat *src)
Duplicate matrix out of region.
AA_API struct aa_dvec * aa_dvec_alloc(struct aa_mem_region *reg, aa_la_size len)
Region-allocate a vector.
void() aa_la_err_fun(const char *message)
Callback type for linear algebra errors.
AA_API struct aa_dmat * aa_dmat_malloc(aa_la_size rows, aa_la_size cols)
Heap-allocate a matrix.
AA_API struct aa_dvec * aa_dvec_malloc(aa_la_size len)
Heap-allocate a vector.
AA_API void aa_dmat_gemv(AA_CBLAS_TRANSPOSE trans, double alpha, const struct aa_dmat *A, const struct aa_dvec *x, double beta, struct aa_dvec *y)
General Matrix-Vector multiply.
AA_API void aa_dmat_inc(struct aa_dmat *A, double alpha)
Increment the matrix A by alpha.
AA_API void aa_dmat_lacpy(const char uplo[1], const struct aa_dmat *A, struct aa_dmat *B)
Copies all or part of a two-dimensional matrix A to another matrix B.
AA_API void aa_la_err(const char *message)
Default handler function for linear algebra errors.
AA_API void aa_dvec_scal(double alpha, struct aa_dvec *x)
Scale x by alpha.
AA_API void aa_dmat_set(struct aa_dmat *A, double alpha, double beta)
Fill a matrix diagonal and off-diagonal elements.
AA_API double aa_dvec_nrm2(const struct aa_dvec *x)
Euclidean Norm.
AA_API void aa_dmat_view(struct aa_dmat *mat, aa_la_size rows, aa_la_size cols, double *data, aa_la_size ld)
Fill in a matrix descriptor.
static void AA_DMAT_VIEW(struct aa_dmat *mat, aa_la_size rows, aa_la_size cols, double *data, aa_la_size ld)
Fill in a matrix descriptor.
AA_API void aa_dmat_block(const struct aa_dmat *src, aa_la_size row_start, aa_la_size col_start, aa_la_size row_end, aa_la_size col_end, struct aa_dmat *dst)
View a block of a matrix.
AA_API void aa_dmat_gemm(AA_CBLAS_TRANSPOSE transA, AA_CBLAS_TRANSPOSE transB, double alpha, const struct aa_dmat *A, const struct aa_dmat *B, double beta, struct aa_dmat *C)
General Matrix-Matrix multiply.
AA_API double aa_dvec_dot(const struct aa_dvec *x, struct aa_dvec *y)
Dot product.
AA_API void aa_dmat_copy(const struct aa_dmat *A, struct aa_dmat *B)
Copy a matrix.
AA_API void aa_dmat_col_vec(const struct aa_dmat *src, aa_la_size col, struct aa_dvec *dst)
View a column of a matrix as a vector.
AA_API void aa_dvec_copy(const struct aa_dvec *x, struct aa_dvec *y)
Copy x to y.
AA_API void aa_dmat_trans(const struct aa_dmat *A, struct aa_dmat *At)
Matrix transpose.
AA_API double aa_dmat_ssd(const struct aa_dmat *x, const struct aa_dmat *y)
sum-square-differences of two matrices
AA_API struct aa_dmat * aa_dmat_alloc(struct aa_mem_region *reg, aa_la_size rows, aa_la_size cols)
Region-allocate a matrix.
AA_API void aa_dmat_row_vec(const struct aa_dmat *src, aa_la_size row, struct aa_dvec *dst)
View a row of a matrix as a vector.
static void AA_DVEC_VIEW(struct aa_dvec *vec, aa_la_size len, double *data, aa_la_size inc)
Fill in a vector descriptor.
AA_API int aa_dmat_inv(struct aa_dmat *A)
Matrix inverse, in-place.
AA_API void aa_dvec_zero(struct aa_dvec *vec)
Zero a vector.
AA_API double aa_dvec_ssd(const struct aa_dvec *x, const struct aa_dvec *y)
sum-square-differences of two vectors
AA_API int aa_dmat_dpinv(const struct aa_dmat *A, double k, struct aa_dmat *As)
Damped pseudo-inverse.
size_t aa_la_size
Type for sizes of vectors and matrices.
AA_API int aa_dmat_dzdpinv(const struct aa_dmat *A, double s_min, struct aa_dmat *As)
Dead-zone damped pseudo-inverse.
AA_API struct aa_dmat * aa_dmat_mdup(const struct aa_dmat *src)
Duplicate matrix in the heap.
AA_API void aa_la_set_err(aa_la_err_fun *fun)
Set the handler function for linear algebra errors.
AA_API int aa_dmat_pinv(const struct aa_dmat *A, double tol, struct aa_dmat *As)
Pseudo-inverse.
AA_API struct aa_dvec * aa_dvec_mdup(const struct aa_dvec *src)
Duplicate vector in the heap.
AA_API void aa_dmat_axpy(double alpha, const struct aa_dmat *X, struct aa_dmat *Y)
Y += alpha * X.
AA_API double aa_dmat_nrm2(const struct aa_dmat *x)
Euclidean Norm.
AA_API void aa_dvec_slice(const struct aa_dvec *src, aa_la_size start, aa_la_size stop, aa_la_size step, struct aa_dvec *dst)
View a slice of a vector.
AA_API void aa_dvec_axpy(double a, const struct aa_dvec *x, struct aa_dvec *y)
Alpha x plus y.
AA_API void aa_dvec_swap(struct aa_dvec *x, struct aa_dvec *y)
Swap x and y.
Descriptor for a block matrix.
aa_la_size rows
number of rows in matrix
aa_la_size cols
number of columns
aa_la_size ld
Leading dimension of matrix.
double * data
Pointer to matrix data.
aa_la_size len
Number of elements in vector.
aa_la_size inc
Increment between successive vector elements.
double * data
Pointer to data.
Data Structure for Region-Based memory allocation.