1 #ifndef GRASS_GMATHDEFS_H 2 #define GRASS_GMATHDEFS_H 21 extern int fft(
int,
double *[2],
int,
int,
int);
22 extern int fft2(
int,
double (*)[2],
int,
int,
int);
37 extern int del2g(
double *[2],
int,
double);
40 extern int getg(
double,
double *[2],
int);
46 extern int G_math_complex_mult (
double *v1[2],
int size1,
double *v2[2],
int size2,
double *v3[2],
int size3);
49 extern int G_ludcmp(
double **,
int,
int *,
double *);
50 extern void G_lubksb(
double **a,
int n,
int *indx,
double b[]);
53 extern int G_math_findzc(
double conv[],
int size,
double zc[],
double thresh,
int num_orients);
61 extern void G_math_solvtd(
double *,
double *,
double *,
double *,
int);
71 extern int G_math_svduv(
double *,
double **,
double **,
int,
double **,
int);
72 extern int G_math_sv2uv(
double *,
double **,
double **,
int,
double **,
int);
73 extern int G_math_svdu1v(
double *,
double **,
int,
double **,
int);
96 extern void G_math_Ax_sband(
double ** A,
double *
x,
double *y,
int rows,
int bandwidth);
104 extern int G_math_solver_gs(
double **,
double *,
double *,
int ,
int ,
double ,
double );
106 extern int G_math_solver_pcg(
double **,
double *,
double *,
int ,
int ,
double ,
int );
107 extern int G_math_solver_cg(
double **,
double *,
double *,
int ,
int ,
double );
132 extern void G_math_d_ax_by(
double *,
double *,
double *,
double ,
double ,
int );
139 extern void G_math_f_ax_by(
float *,
float *,
float *,
float ,
float ,
int );
146 extern void G_math_i_ax_by(
int *,
int *,
int *,
int ,
int ,
int );
150 extern double G_math_ddot(
double *,
double *,
int );
163 extern void G_math_daxpy(
double *,
double *,
double ,
int );
164 extern void G_math_saxpy(
float *,
float *,
float ,
int );
167 extern void G_math_d_Ax(
double **,
double *,
double *,
int ,
int );
168 extern void G_math_f_Ax(
float **,
float *,
float *,
int ,
int );
171 extern void G_math_d_aAx_by(
double **,
double *,
double *,
double ,
double ,
double *,
int ,
int );
172 extern void G_math_f_aAx_by(
float **,
float *,
float *,
float ,
float ,
float *,
int ,
int );
177 extern void G_math_d_aA_B(
double **,
double **,
double ,
double **,
int ,
int );
178 extern void G_math_f_aA_B(
float **,
float **,
float ,
float **,
int ,
int );
179 extern void G_math_d_AB(
double **,
double **,
double **,
int ,
int ,
int );
180 extern void G_math_f_AB(
float **,
float **,
float **,
int ,
int ,
int );
void G_math_solver_cholesky_sband(double **, double *, double *, int, int)
Cholesky symmetric band matrix solver for linear equation systems of type Ax = b. ...
void G_math_eigen(double **, double *, int)
Compute the eigenvalues and eigenvectors of a real symmetric matrix A.
double G_math_dnrm2(double *, int)
Compute the euclidean norm of vector x using the ATLAS routine cblas_dnrm2.
void G_math_i_x_dot_y(int *, int *, double *, int)
Compute the dot product of vector x and y.
double G_math_ddot(double *, double *, int)
Compute the dot product of vector x and y using the ATLAS routine cblas_ddot.
int * G_alloc_ivector(size_t)
Vector matrix memory allocation.
int ** G_alloc_imatrix(int, int)
Matrix memory allocation.
double G_math_evmax(double **, double *, int)
void G_math_d_AB(double **, double **, double **, int, int, int)
Matrix multiplication.
int G_math_solver_cholesky(double **, double *, double *, int, int)
The choleksy decomposition solver for quardatic, symmetric positiv definite matrices.
void G_math_backward_substitution(double **, double *, double *, int)
backward substitution
int fft2(int, double(*)[2], int, int, int)
Fast Fourier Transform for two-dimensional array.
void G_math_forward_substitution(double **, double *, double *, int)
forward substitution
G_math_spvector * G_math_alloc_spvector(int)
Allocate memory for a sparse vector.
void G_free_vector(double *)
Vector memory deallocation.
The row vector of the sparse matrix.
int G_math_solver_bicgstab(double **, double *, double *, int, int, double)
The iterative biconjugate gradients solver with stabilization for unsymmetric non-definite matrices...
int G_math_solver_sparse_gs(G_math_spvector **, double *, double *, int, int, double, double)
The iterative gauss seidel solver for sparse matrices.
int del2g(double *[2], int, double)
double ** G_math_Asp_to_A(G_math_spvector **, int)
Convert a sparse matrix into a quadratic matrix.
int G_math_psinv(double **, int)
Invert (in place) a symmetric real matrix, V -> Inv(V).
void G_math_d_aA_B(double **, double **, double, double **, int, int)
Add two matrices and scale matrix A with the scalar a.
int G_math_solvru(double **, double *, int)
float * G_alloc_fvector(size_t)
Floating point vector memory allocation.
int G_math_f_A_T(float **A, int rows)
Compute the transposition of matrix A. Matrix A will be overwritten.
int G_math_solver_sparse_pcg(G_math_spvector **, double *, double *, int, int, double, int)
The iterative preconditioned conjugate gradients solver for sparse symmetric positive definite matric...
double G_math_idamax(double *, int)
Compute the maximum norm of vector x using the ATLAS routine cblas_idamax.
void G_math_free_spmatrix(G_math_spvector **, int)
Release the memory of the sparse matrix.
int G_math_solver_pcg(double **, double *, double *, int, int, double, int)
The iterative preconditioned conjugate gradients solver for symmetric positive definite matrices...
void G_math_f_x_dot_y(float *, float *, float *, int)
Compute the dot product of vector x and y.
void G_math_daxpy(double *, double *, double, int)
Scale vector x with scalar a and add it to y.
void G_math_cholesky_sband_substitution(double **, double *, double *, int, int)
Forward and backward substitution of a lower tringular symmetric band matrix of A from system Ax = b...
void G_math_d_max_norm(double *, double *, int)
Compute the maximum norm of vector x.
void G_math_free_spvector(G_math_spvector *)
Release the memory of the sparse vector.
double ** G_math_Asp_to_sband_matrix(G_math_spvector **, int, int)
Convert a symmetric sparse matrix into a symmetric band matrix.
int getg(double, double *[2], int)
void G_math_d_copy(double *, double *, int)
Copy the vector x to y.
G_math_spvector ** G_math_A_to_Asp(double **, int, double)
Convert a quadratic matrix into a sparse matrix.
int G_math_solver_lu(double **, double *, double *, int)
The LU solver for quardatic matrices.
double ** G_alloc_matrix(int, int)
Matrix memory allocation.
void G_math_d_ax_by(double *, double *, double *, double, double, int)
Scales vectors x and y with the scalars a and b and adds them.
void G_math_d_x_dot_y(double *, double *, double *, int)
Compute the dot product of vector x and y.
G_math_spvector ** G_math_sband_matrix_to_Asp(double **, int, int, double)
Convert a symmetric band matrix into a sparse matrix.
void G_math_eigval(double **, double *, int)
Compute the eigenvalues of a real symmetric matrix A.
void G_math_f_ax_by(float *, float *, float *, float, float, int)
Scales vectors x and y with the scalars a and b and adds them.
int G_math_svdu1v(double *, double **, int, double **, int)
Compute the singular value transformation with A overloaded by the partial U-matrix.
float G_math_snrm2(float *, int)
Compute the euclidean norm of vector x using the ATLAS routine cblas_dnrm2.
float G_math_sasum(float *, int)
Compute the absolute sum norm of vector x using the ATLAS routine cblas_dasum.
void G_math_i_max_norm(int *, int *, int)
Compute the maximum norm of vector x.
void G_math_f_x_dyad_y(float *, float *, float **, int, int)
Compute the dyadic product of two vectors. The result is stored in the matrix A.
void G_math_srand(int)
Seed the pseudo-random number generator.
void G_math_Ax_sparse(G_math_spvector **, double *, double *, int)
Compute the matrix - vector product of sparse matrix **Asp and vector x.
void G_math_i_copy(int *, int *, int)
Copy the vector x to y.
double ** G_math_matrix_to_sband_matrix(double **, int, int)
Convert a symmetrix matrix into a symmetric band matrix.
int G_math_ruinv(double **, int)
Invert an upper right triangular matrix T -> Inv(T).
int G_math_svduv(double *, double **, double **, int, double **, int)
void G_math_f_Ax(float **, float *, float *, int, int)
Compute the matrix - vector product of matrix A and vector x.
int G_math_srand_auto(void)
Seed the pseudo-random number generator from the time and PID.
void G_math_f_copy(float *, float *, int)
Copy the vector x to y.
void G_math_f_aA_B(float **, float **, float, float **, int, int)
Add two matrices and scale matrix A with the scalar a.
void G_math_sscal(float *, float, int)
Scale vector x with scalar a using the ATLAS routine cblas_dscal.
void G_free_imatrix(int **)
Matrix memory deallocation.
float G_math_isamax(float *, int)
Compute the maximum norm of vector x using the ATLAS routine cblas_idamax.
int G_math_sv2val(double *, double **, int, int)
Compute singular values when m >> n.
int G_math_cholesky_decomposition(double **, int, int)
cholesky decomposition for symmetric, positiv definite matrices with bandwidth optimization ...
void G_math_f_asum_norm(float *, float *, int)
Compute the asum norm of vector x.
double * G_alloc_vector(size_t)
Vector matrix memory allocation.
void G_math_gauss_elimination(double **, double *, int)
Gauss elimination.
int G_math_solver_jacobi(double **, double *, double *, int, int, double, double)
The iterative jacobi solver for quadratic matrices.
void G_free_fvector(float *)
Vector memory deallocation.
double G_math_rand_gauss(double)
void G_math_print_spmatrix(G_math_spvector **, int)
print the sparse matrix Asp to stdout
long G_math_max_pow2(long n)
Finds least power of 2 >= n
int G_math_egvorder(double *, double **, long)
long G_math_min_pow2(long n)
Finds largest power of 2 <= n
void G_math_dcopy(double *, double *, int)
Copy vector x to vector y.
void G_math_f_euclid_norm(float *, float *, int)
Compute the euclid norm of vector x.
void G_math_saxpy(float *, float *, float, int)
Scale vector x with scalar a and add it to y.
void G_math_f_aAx_by(float **, float *, float *, float, float, float *, int, int)
Compute the scaled matrix - vector product of matrix A and vectors x and y.
void G_math_f_max_norm(float *, float *, int)
Compute the maximum norm of vector x.
int G_ludcmp(double **, int, int *, double *)
LU decomposition.
int G_math_solver_cg(double **, double *, double *, int, int, double)
The iterative conjugate gradients solver for symmetric positive definite matrices.
int G_math_solver_cg_sband(double **, double *, double *, int, int, int, double)
The iterative conjugate gradients solver for symmetric positive definite band matrices.
double G_math_dasum(double *, int)
Compute the absolute sum norm of vector x using the ATLAS routine cblas_dasum.
int G_math_sv2uv(double *, double **, double **, int, double **, int)
Compute the singular value transformation when m >> n.
int G_math_solv(double **, double *, int)
Solve a general linear system A*x = b.
G_math_spvector ** G_math_alloc_spmatrix(int)
Allocate memory for a sparse matrix.
int G_math_findzc(double conv[], int size, double zc[], double thresh, int num_orients)
Finds locations and orientations of zero crossings.
void G_math_f_AB(float **, float **, float **, int, int, int)
Matrix multiplication.
void G_math_d_x_dyad_y(double *, double *, double **, int, int)
Compute the dyadic product of two vectors. The result is stored in the matrix A.
int G_math_svdval(double *, double **, int, int)
Compute the singular values of a real m by n matrix A.
void G_math_lu_decomposition(double **, double *, int)
lu decomposition
void G_math_dscal(double *, double, int)
Scale vector x with scalar a using the ATLAS routine cblas_dscal.
void G_math_i_ax_by(int *, int *, int *, int, int, int)
Scales vectors x and y with the scalars a and b and adds them.
int G_math_d_A_T(double **A, int rows)
Compute the transposition of matrix A. Matrix A will be overwritten.
int G_math_solver_sparse_jacobi(G_math_spvector **, double *, double *, int, int, double, double)
The iterative jacobi solver for sparse matrices.
int G_math_minv(double **, int)
Invert (in place) a general real matrix A -> Inv(A).
int G_math_solver_gauss(double **, double *, double *, int)
The gauss elimination solver for quardatic matrices.
float G_math_sdot(float *, float *, int)
Compute the dot product of vector x and y using the ATLAS routine cblas_sdot.
void G_math_d_euclid_norm(double *, double *, int)
Compute the euclid norm of vector x.
void G_math_scopy(float *, float *, int)
Copy vector x to vector y.
double ** G_math_sband_matrix_to_matrix(double **, int, int)
Convert a symmetric band matrix into a symmetric matrix.
void G_free_ivector(int *)
Vector memory deallocation.
void G_math_cholesky_sband_decomposition(double **, double **, int, int)
Cholesky decomposition of a symmetric band matrix.
void G_lubksb(double **a, int n, int *indx, double b[])
LU backward substitution.
void G_math_d_asum_norm(double *, double *, int)
Compute the asum norm of vector x.
float G_math_sdsdot(float *, float *, float, int)
Compute the dot product of vector x and y using the ATLAS routine cblas_sdsdot.
void G_free_matrix(double **)
Matrix memory deallocation.
void G_math_i_euclid_norm(int *, double *, int)
Compute the euclid norm of vector x.
int G_math_solvps(double **, double *, int)
Solve a symmetric positive definite linear system S*x = b.
void G_math_d_Ax(double **, double *, double *, int, int)
Compute the matrix - vector product of matrix A and vector x.
void G_math_solvtd(double *, double *, double *, double *, int)
Solve a tridiagonal linear system M*x = y.
void G_free_fmatrix(float **)
Floating point matrix memory deallocation.
void G_math_i_asum_norm(int *, double *, int)
Compute the asum norm of vector x.
void G_math_d_aAx_by(double **, double *, double *, double, double, double *, int, int)
Compute the scaled matrix - vector product of matrix double **A and vector x and y.
int fft(int, double *[2], int, int, int)
Fast Fourier Transform for two-dimensional array.
float ** G_alloc_fmatrix(int, int)
Floating point matrix memory allocation.
int G_math_solver_gs(double **, double *, double *, int, int, double, double)
The iterative gauss seidel solver for quadratic matrices.
int G_math_solver_sparse_cg(G_math_spvector **, double *, double *, int, int, double)
The iterative conjugate gradients solver for sparse symmetric positive definite matrices.
int G_math_add_spvector(G_math_spvector **, G_math_spvector *, int)
Adds a sparse vector to a sparse matrix at position row.
int G_math_complex_mult(double *v1[2], int size1, double *v2[2], int size2, double *v3[2], int size3)
Multiply two complex vectors, point by point.
int G_math_solver_sparse_bicgstab(G_math_spvector **, double *, double *, int, int, double)
The iterative biconjugate gradients solver with stabilization for unsymmetric non-definite matrices...
void G_math_Ax_sband(double **A, double *x, double *y, int rows, int bandwidth)
Compute the matrix - vector product of symmetric band matrix A and vector x.