MAOS
Multithreaded Adaptive Optics Simulator
|
Macros | |
#define | AOS_LIB_TYPE |
#define | AOS_LMAT(A) l##A |
Functions | |
lmat * | lnew (long nx, long ny) |
lmat * | lnew_file (long nx, long ny, const char *keywords, const char *format,...) |
lmat * | lnew_do (long nx, long ny, long *p, mem_t *mem) |
lmat * | lmat_cast (const void *A) |
int | linit (lmat **A, long nx, long ny) |
void | lfree_content (lmat *A) |
void | lfree_do (lmat *A) |
lmat * | lref (const lmat *in) |
lmat * | lref_reshape (const lmat *in, long nx, long ny) |
lmat * | lrefcols (const lmat *in, long icol, long ncol) |
void | lcols (lmat *out, const lmat *in, long icol, long ncol) |
int | lresize (lmat *A, long nx, long ny) |
lmat * | lsub (const lmat *in, long sx, long nx, long sy, long ny) |
lmat * | lcat (const lmat *in1, const lmat *in2, int dim) |
lmat * | ldup (const lmat *in) |
void | lzero (lmat *A) |
int | lzerocol (lmat *A, int icol) |
uint32_t | lhash (const lmat *A, uint32_t key) |
void | lcp (lmat **out0, const lmat *in) |
lmat * | ltrans (const lmat *A) |
void | lset (lmat *A, const long val) |
void | lshow (const lmat *A, const char *format,...) |
void | lvecperm (lmat *out, const lmat *in, const long *perm) |
void | lvecpermi (lmat *out, const lmat *in, const long *perm) |
int | lflip (lmat *A, int axis) |
long | lvecsum (const long *__restrict p, long np) |
long | lsum (const lmat *A) |
void | lnormalize_sum (lmat *A, long sum) |
void | lnormalize_sumabs (lmat *A, long sum) |
long | lmean (const lmat *A) |
long | ltrace (const lmat *A) |
void | lsort (lmat *A, int ascend) |
void | lvecmaxmin (const long *__restrict p, long N, long *max, long *min) |
long | lvecdot (const long *__restrict p1, const long *__restrict p2, const long *__restrict p3, long n) |
void | lvecnormalize_sum (long *__restrict p, long nloc, long norm) |
void | lvecnormalize_sumabs (long *__restrict p, long nloc, long norm) |
long | lvecmaxabs (const long *__restrict p, long n) |
void | lmaxmin (const lmat *A, long *max, long *min) |
long | lmax (const lmat *A) |
long | lmaxabs (const lmat *A) |
long | lmin (const lmat *A) |
long | lsumabs (const lmat *in) |
long | lsumsq (const lmat *in) |
long | lsumdiffsq (const lmat *A, const lmat *B) |
void | lfftshift (lmat *A) |
int | lcpcorner2center (lmat *A, const lmat *B) |
int | lshift (lmat **B0, const lmat *A, int sx, int sy) |
lcell * | lcell_cast (const cell *A) |
lcell * | lcellnew2 (const lcell *A) |
lcell * | lcellnew3 (long nx, long ny, long *nnx, long *nny) |
lcell * | lcellnew_same (long nx, long ny, long mx, long my) |
lcell * | lcellnew_file (long nx, long ny, long *nnx, long *nny, const char *keywords, const char *format,...) |
lcell * | lcellnewsame_file (long nx, long ny, long mx, long my, const char *keywords, const char *format,...) |
void | lcellzero (lcell *dc) |
void | lcellset (lcell *dc, long alpha) |
lcell * | lcelltrans (const lcell *A) |
lcell * | lcellref (const lcell *in) |
lcell * | lcelldup (const lcell *in) |
void | lcellcp (lcell **out0, const lcell *in) |
lcell * | lcellreduce (const lcell *A, int dim) |
lcell * | lcellcat (const lcell *A, const lcell *B, int dim) |
void | lcellcat2 (lcell **A, const lcell *B, int dim) |
lcell * | lcellcat_each (const lcell *A, const lcell *B, int dim) |
lcell * | l2cellref (const lmat *A, long *dims, long ndim) |
void | l2cell (lcell **B, const lmat *A, const lcell *ref) |
lmat * | lcell_col (lcell *input, long icol) |
long | lcellsum (const lcell *A) |
lmat * | lcellsum_each (const lcell *A) |
uint32_t | lcellhash (const lcell *A, uint32_t key) |
void | lwritedata (file_t *fp, const lmat *A, long ncol) |
lmat * | lreaddata (file_t *fp, header_t *header) |
lmat * | lnew_mmap (long nx, long ny, const char *keywords, const char *format,...) |
lcell * | lcellnew_mmap (long nx, long ny, long *nnx, long *nny, const char *keywords, const char *format,...) |
lcell * | lcellnewsame_mmap (long nx, long ny, long mx, long my, const char *keywords, const char *format,...) |
lmat * | lread_mmap (const char *format,...) |
lcell * | lcellread_mmap (const char *format,...) |
Calls LX(new) with a filename to be saved to.
lmat* lmat_cast | ( | const void * | A | ) |
check and cast an object to matrix
check the size of matrix if exist. Otherwise create it. content is not zeroed if already exists.
void lfree_content | ( | lmat * | A | ) |
free content of a matrix object.
void lfree_do | ( | lmat * | A | ) |
free a matrix object.
creat a reference to an existing matrix. header is duplicated if exists.
create an new reference another with different shape.
creat a new matrix referencing columns in existing matrix. reference counted.
Override a stack matrix struct with pointers to columns of another matrix. Does not add reference count the original data.
Resize a matrix by adding or removing columns or rows. Data is kept whenever possible.
Create a new sub matrix of nx*ny starting from(sx,sy) and copy the data.
Concatenate two matrixes into 1 along "dim" (1 for x, 2 for y)
void lzero | ( | lmat * | A | ) |
Set elements to zero.
int lzerocol | ( | lmat * | A, |
int | icol | ||
) |
Set column elements to zero.
uint32_t lhash | ( | const lmat * | A, |
uint32_t | key | ||
) |
Compute the hashlittle
void lshow | ( | const lmat * | A, |
const char * | format, | ||
... | |||
) |
display a matrix.
Permute the vector so that out(:)=in(p);
Reverse permute the vector so that out(p)=in(:);
int lflip | ( | lmat * | A, |
int | axis | ||
) |
Flip the matrix along the set axis. 0 to flip both, 1 along x, 2 along y.
void lsort | ( | lmat * | A, |
int | ascend | ||
) |
Sort all columns of A, in ascending order if ascend is non zero, otherwise in descending order.
void lfftshift | ( | lmat * | A | ) |
shift frequency components by n/2
reorder B and embed/crop into center of A .
4 * * 3 * * * * * * * * 2 * * 1
to
1 2 3 4
cyclic shift A by nx and ny to B.
4 3 1 2 2 1 to 3 4
create an new cell similar to A in shape. When a cell is empty, it is created with an emtry matrix and cannot be overriden.
Create an new cell with matrix specified. Each block is stored continuously in memory.
Create an new cell with matrix specified. Each block is stored continuously in memory.
lcell* lcellnew_file | ( | long | nx, |
long | ny, | ||
long * | nnx, | ||
long * | nny, | ||
const char * | keywords, | ||
const char * | format, | ||
... | |||
) |
Calls cellnew3 with a filename to be saved to.
lcell* lcellnewsame_file | ( | long | nx, |
long | ny, | ||
long | mx, | ||
long | my, | ||
const char * | keywords, | ||
const char * | format, | ||
... | |||
) |
Calls cellnew_same with a filename to be saved to.
creat a cell reference an existing cell by referencing the elements.
reduce nx*ny cell matrix to 1*ny if dim=1 and nx*1 if dim=2 by merging the cells.
convert a vector to cell using dimensions specified in dims. Reference the vector
make A a cell array using shape information from ref if *B is NULL.
Notice that empty cells may be replaced by zeros if it is within valid column or row.
input is nsa*ncol cell. each cell has npix=nx*ny elements. Extract icol of cell as npix*nsa array.
uint32_t lcellhash | ( | const lcell * | A, |
uint32_t | key | ||
) |
Compute the hashlittle
Routines for input/output to bin/fits file. Function to write dense matrix data into a file pointer. Generally used by library developer
Function to read dense matrix into memory from file pointer. Generally used by library developer.
Create a new LX(mat) matrix object, mmapped from file. The file is truncated if already exists in rw mode.
lcell* lcellnew_mmap | ( | long | nx, |
long | ny, | ||
long * | nnx, | ||
long * | nny, | ||
const char * | keywords, | ||
const char * | format, | ||
... | |||
) |
Create a new dense matrix cell object, mmapped from file. The file is truncated if already exists.
lcell* lcellnewsame_mmap | ( | long | nx, |
long | ny, | ||
long | mx, | ||
long | my, | ||
const char * | keywords, | ||
const char * | format, | ||
... | |||
) |
Create a new dense matrix cell object, with identical blocks, mmapped from file. be aware that the data is not 8-byte aligned. The file is truncated if already exists.
lmat* lread_mmap | ( | const char * | format, |
... | |||
) |
Map the file to memory in read only, shared mode.
lcell* lcellread_mmap | ( | const char * | format, |
... | |||
) |
Map the file to memory in read only, shared mode.