308 assert(row < a->
rows);
309 assert(col < a->
cols);
312 return a->
a[row + lda * col];
324 assert(row < a->
rows);
325 assert(col < a->
cols);
328 a->
a[row + lda * col] = x;
341 assert(row < a->
rows);
342 assert(col < a->
cols);
345 return (a->
a[row + lda * col] += x);
pamatrix init_amatrix(pamatrix a, uint rows, uint cols)
Initialize an amatrix object.
void copy_colpiv_amatrix(bool atrans, pcamatrix a, const uint *colpiv, pamatrix b)
Copy a matrix into another matrix, permuting the columns, i.e., or .
real normfrob2_amatrix(pcamatrix a)
Compute the squared Frobenius norm of a matrix .
size_t longindex
Unsigned long type.
Definition: settings.h:88
void resize_amatrix(pamatrix a, uint rows, uint cols)
Change the dimensions of an amatrix object without preserving its coefficients.
void addeval_amatrix_avector(field alpha, pcamatrix a, pcavector src, pavector trg)
Multiply a matrix by a vector , .
amatrix * pamatrix
Pointer to amatrix object.
Definition: amatrix.h:26
void uninit_amatrix(pamatrix a)
Uninitialize an amatrix object.
pamatrix new_amatrix(uint rows, uint cols)
Create a new amatrix object.
pamatrix clone_amatrix(pcamatrix src)
Create a duplicate of an existing amatrix.
field * a
Matrix coefficients in column-major order, i.e., corresponds to a[i+j*ld].
Definition: amatrix.h:45
void random_amatrix(pamatrix a)
Fill a matrix with random values.
void random_invertible_amatrix(pamatrix a, real alpha)
Fill a square matrix with random values and ensure that it is invertible.
void mvm_amatrix_avector(field alpha, bool atrans, pcamatrix a, pcavector src, pavector trg)
Multiply a matrix or its adjoint by a vector, or .
uint getactives_amatrix()
Get number of currently initialized amatrix objects.
unsigned uint
Unsigned integer type.
Definition: settings.h:70
void add_amatrix(field alpha, bool atrans, pcamatrix a, pamatrix b)
Add two matrices, or .
field getentry_amatrix(pcamatrix a, uint row, uint col)
Read a matrix entry .
Definition: amatrix.h:305
real norm2diff_amatrix(pcamatrix a, pcamatrix b)
Approximate the spectral norm of the difference of two matrices and .
pamatrix new_sub_amatrix(pamatrix src, uint rows, uint roff, uint cols, uint coff)
Create a new amatrix object representing a submatrix.
void copy_sub_amatrix(bool atrans, pcamatrix a, pamatrix b)
Copy a matrix into another matrix, or .
double _Complex field
Field type.
Definition: settings.h:171
real check_ortho_amatrix(bool atrans, pcamatrix a)
Check whether a matrix or its adjoint is isometric.
void resizecopy_amatrix(pamatrix a, uint rows, uint cols)
Change the dimensions of an amatrix object while preserving as many of its coefficients as possible...
field dotprod_amatrix(pcamatrix a, pcamatrix b)
Compute the Frobenius inner product of two matrices and .
pamatrix new_identity_amatrix(uint rows, uint cols)
Create a new amatrix object representing the identity.
const amatrix * pcamatrix
Pointer to constant amatrix object.
Definition: amatrix.h:29
uint rows
Number of rows.
Definition: amatrix.h:51
#define INLINE_PREFIX
Prefix for inline functions.
Definition: settings.h:36
pamatrix new_pointer_amatrix(field *src, uint rows, uint cols)
Create a new amatrix object using a given array for the coefficients.
void conjugate_amatrix(pamatrix a)
compute the complex conjugate of a matrix .
void addevaltrans_amatrix_avector(field alpha, pcamatrix a, pcavector src, pavector trg)
Multiply the adjoint of a matrix by a vector , .
pamatrix init_sub_amatrix(pamatrix a, pamatrix src, uint rows, uint roff, uint cols, uint coff)
Initialize an amatrix object to represent a submatrix.
void clear_amatrix(pamatrix a)
Set a matrix to zero.
void del_amatrix(pamatrix a)
Delete an amatrix object.
size_t getsize_amatrix(pcamatrix a)
Get size of a given amatrix object.
void bidiagmul_amatrix(field alpha, bool atrans, pamatrix a, pcavector d, pcavector l)
Multiply a matrix by a bidiagonal matrix, or .
pamatrix init_vec_amatrix(pamatrix a, pavector src, uint rows, uint cols)
Initialize an amatrix object by a vector.
void identity_amatrix(pamatrix a)
Set a matrix to identity.
size_t getsize_heap_amatrix(pcamatrix a)
Get heap size of a given amatrix object.
void clear_lower_amatrix(pamatrix a, bool strict)
Set the lower triangular part of a matrix to zero.
void random_spd_amatrix(pamatrix a, real alpha)
Fill a matrix with random values and ensure that it is positive definite.
uint ld
Leading dimension, i.e., increment used to switch from one column to the next.
Definition: amatrix.h:48
#define HEADER_PREFIX
Prefix for function declarations.
Definition: settings.h:43
pamatrix init_pointer_amatrix(pamatrix a, pfield src, uint rows, uint cols)
Initialize an amatrix object using a given array for the coefficients.
double real
real floating point type.
Definition: settings.h:97
void scale_amatrix(field alpha, pamatrix a)
Scale a matrix by a factor , .
void addmul_amatrix(field alpha, bool atrans, pcamatrix a, bool btrans, pcamatrix b, pamatrix c)
Multiply two matrices, , , or .
void setentry_amatrix(pamatrix a, uint row, uint col, field x)
Set a matrix entry, .
Definition: amatrix.h:321
void clear_upper_amatrix(pamatrix a, bool strict)
Set the upper triangular part of a matrix to zero.
void print_amatrix(pcamatrix a)
Print a matrix.
field * pfield
Pointer to field array.
Definition: settings.h:185
void print_matlab_amatrix(pcamatrix a)
Print a matrix in Matlab format.
void copy_amatrix(bool atrans, pcamatrix a, pamatrix b)
Copy a matrix into another matrix, or .
pamatrix init_identity_amatrix(pamatrix a, uint rows, uint cols)
Initialize an amatrix object and set it to identity.
real normfrob_amatrix(pcamatrix a)
Compute the Frobenius norm of a matrix .
Representation of a matrix as an array in column-major order.
Definition: amatrix.h:43
uint cols
Number of columns.
Definition: amatrix.h:53
pamatrix init_zero_amatrix(pamatrix a, uint rows, uint cols)
Initialize an amatrix object and set it to zero.
void * owner
Points to owner of coefficient storage if this is a submatrix.
Definition: amatrix.h:56
pamatrix new_zero_amatrix(uint rows, uint cols)
Create a new amatrix object representing a zero matrix.
real norm2_amatrix(pcamatrix A)
Approximate the spectral norm of a matrix .
field addentry_amatrix(pamatrix a, uint row, uint col, field x)
Add to a matrix entry, .
Definition: amatrix.h:338
void random_selfadjoint_amatrix(pamatrix a)
Fill a matrix with random values and ensure that it is self-adjoint.