| Libgretl Reference Manual |
|---|
usermatusermat — |
typedef user_matrix; typedef matrix_subspec; struct matrix_subspec_; int n_user_matrices (void); const char* get_matrix_name_by_index (int idx); gretl_matrix* get_matrix_by_name (const char *name); gretl_matrix* get_matrix_by_name_at_level (const char *name, int level); gretl_matrix* user_matrix_get_matrix (user_matrix *u); user_matrix* get_user_matrix_by_name (const char *name); user_matrix* get_user_matrix_by_index (int idx); int user_matrix_add (gretl_matrix *M, const char *name); int user_matrix_destroy_by_name (const char *name, PRN *prn); int user_matrix_destroy (user_matrix *u); int user_matrix_adjust_level (user_matrix *u, int adj); const char* user_matrix_get_name (user_matrix *u); int user_matrix_set_name (user_matrix *u, const char *name); int user_matrix_replace_matrix (user_matrix *u, gretl_matrix *M); int user_matrix_replace_matrix_by_name (const char *name, gretl_matrix *M); int user_matrix_replace_submatrix (const char *name, gretl_matrix *M, matrix_subspec *spec); int add_or_replace_user_matrix (gretl_matrix *M, const char *name); int copy_named_matrix_as (const char *orig, const char *new); int copy_matrix_as (const gretl_matrix *m, const char *new); int user_matrix_set_name_and_level (const gretl_matrix *M, char *name, int level); void destroy_user_matrices (void); int destroy_user_matrices_at_level (int level); int destroy_private_matrices (void); double user_matrix_get_determinant (const gretl_matrix *m, int *err); double user_matrix_get_log_determinant (const gretl_matrix *m, int *err); gretl_matrix* user_matrix_get_inverse (const gretl_matrix *m); gretl_matrix* user_matrix_cholesky_decomp (const gretl_matrix *m); gretl_matrix* user_matrix_column_demean (const gretl_matrix *m); gretl_matrix* user_matrix_vec (const gretl_matrix *m); gretl_matrix* user_matrix_vech (const gretl_matrix *m, int *err); gretl_matrix* user_matrix_unvech (const gretl_matrix *m, int *err); gretl_matrix* user_matrix_QR_decomp (const gretl_matrix *m, const char *rname, int *err); gretl_matrix* user_matrix_SVD (const gretl_matrix *m, const char *uname, const char *vname, int *err); gretl_matrix* user_matrix_eigen_analysis (const gretl_matrix *m, const char *rname, int symm, int *err); gretl_matrix* matrix_get_submatrix (const gretl_matrix *M, matrix_subspec *spec, int *err); gretl_matrix* user_matrix_get_submatrix (const char *name, matrix_subspec *spec, int *err); int matrix_invert_in_place (gretl_matrix *m); int matrix_cholesky_in_place (gretl_matrix *m); int matrix_transpose_in_place (gretl_matrix *m); int matrix_XTX_in_place (gretl_matrix *m); void write_matrices_to_file (FILE *fp); void set_matrix_add_callback ();
gretl_matrix* get_matrix_by_name (const char *name);
Looks up a user-defined matrix by name.
name : |
name of the matrix. |
| Returns : | pointer to matrix, or NULL if not found.
|
gretl_matrix* get_matrix_by_name_at_level (const char *name, int level);
Looks up a user-defined matrix by name, at the given
level of function execution.
name : |
name of the matrix. |
level : |
level of function execution at which to search. |
| Returns : | pointer to matrix, or NULL if not found.
|
gretl_matrix* user_matrix_get_matrix (user_matrix *u);
u : |
user-matrix pointer. |
| Returns : | pointer to matrix, or NULL if not found.
|
user_matrix* get_user_matrix_by_name (const char *name);
name : |
|
| Returns : |
int user_matrix_destroy_by_name (const char *name,
PRN *prn);
name : |
|
prn : |
|
| Returns : |
int user_matrix_adjust_level (user_matrix *u, int adj);
u : |
|
adj : |
|
| Returns : |
int user_matrix_set_name (user_matrix *u, const char *name);
u : |
|
name : |
|
| Returns : |
int user_matrix_replace_matrix (user_matrix *u, gretl_matrix *M);
u : |
|
M : |
|
| Returns : |
int user_matrix_replace_matrix_by_name
(const char *name,
gretl_matrix *M);
name : |
|
M : |
|
| Returns : |
int user_matrix_replace_submatrix (const char *name,
gretl_matrix *M,
matrix_subspec *spec);
name : |
|
M : |
|
spec : |
|
| Returns : |
int add_or_replace_user_matrix (gretl_matrix *M, const char *name);
Checks whether a matrix of the given name already exists.
If so, the original matrix is replaced by M; if not, the
the matrix M is added to the stack of user-defined
matrices.
M : |
gretl matrix. |
name : |
name for the matrix. |
| Returns : | 0 on success, E_ALLOC on failure.
|
int copy_named_matrix_as (const char *orig,
const char *new);
If a saved matrix is found by the name orig, a copy of
this matrix is added to the stack of saved matrices under the
name new. This is intended for use when a matrix is given
as the argument to a user-defined function: it is copied
under the name assigned by the function's parameter list.
orig : |
the name of the original matrix. |
new : |
the name to be given to the copy. |
| Returns : | 0 on success, non-zero on error. |
int copy_matrix_as (const gretl_matrix *m, const char *new);
A copy of matrix m is added to the stack of saved matrices
under the name new. This is intended for use when a matrix is given
is given as the argument to a user-defined function: it is copied
under the name assigned by the function's parameter list.
m : |
the original matrix. |
new : |
the name to be given to the copy. |
| Returns : | 0 on success, non-zero on error. |
int user_matrix_set_name_and_level (const gretl_matrix *M, char *name, int level);
If matrix m is found on the stack of saved matrices, change
its name to newname and change its level to level.
M : |
matrix to be reconfigured. |
name : |
new name to be given to matrix. |
level : |
function execution level to be assigned to matrix. |
| Returns : | 0 on success, 1 if the matrix is not found. |
void destroy_user_matrices (void);
Frees all resources associated with the stack of user- defined matrices.
int destroy_user_matrices_at_level (int level);
Destroys and removes from the stack of user matrices all
matrices that were created at the given level. This is
part of the cleanup that is performed when a user-defined
function terminates.
level : |
stack level of function execution. |
| Returns : | 0 on success, non-zero on error. |
double user_matrix_get_determinant (const gretl_matrix *m, int *err);
m : |
|
err : |
|
| Returns : |
double user_matrix_get_log_determinant (const gretl_matrix *m, int *err);
m : |
|
err : |
|
| Returns : |
gretl_matrix* user_matrix_get_inverse (const gretl_matrix *m);
m : |
|
| Returns : |
gretl_matrix* user_matrix_cholesky_decomp (const gretl_matrix *m);
m : |
|
| Returns : |
gretl_matrix* user_matrix_column_demean (const gretl_matrix *m);
m : |
|
| Returns : |
gretl_matrix* user_matrix_vech (const gretl_matrix *m, int *err);
m : |
|
err : |
|
| Returns : |
gretl_matrix* user_matrix_unvech (const gretl_matrix *m, int *err);
m : |
|
err : |
|
| Returns : |
gretl_matrix* user_matrix_QR_decomp (const gretl_matrix *m, const char *rname, int *err);
m : |
|
rname : |
|
err : |
|
| Returns : |
gretl_matrix* user_matrix_SVD (const gretl_matrix *m, const char *uname, const char *vname, int *err);
m : |
|
uname : |
|
vname : |
|
err : |
|
| Returns : |
gretl_matrix* user_matrix_eigen_analysis (const gretl_matrix *m, const char *rname, int symm, int *err);
m : |
|
rname : |
|
symm : |
|
err : |
|
| Returns : |
gretl_matrix* matrix_get_submatrix (const gretl_matrix *M, matrix_subspec *spec, int *err);
M : |
|
spec : |
|
err : |
|
| Returns : |
gretl_matrix* user_matrix_get_submatrix (const char *name, matrix_subspec *spec, int *err);
name : |
|
spec : |
|
err : |
|
| Returns : |
| << matrix_extra | Command structures: loops and functions >> |