EVSL
1.1.0
EigenValues Slicing Library
|
Computing and applying rational filters. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <complex.h>
#include <math.h>
#include "def.h"
#include "blaslapack.h"
#include "struct.h"
#include "internal_proto.h"
Go to the source code of this file.
Functions | |
void | contQuad (int method, int n, complex double *zk) |
Compute the locations of the poles. More... | |
void | ratf2p2 (int n, int *mulp, complex double *zk, complex double *alp, int m, double *z, double *xx) |
Compute the function value of the multiple pole rational filter at real locations. More... | |
void | pfe2 (complex double s1, complex double s2, int k1, int k2, complex double *alp, complex double *bet) |
Get the fraction expansion of 1/[(z-s1)^k1 (z-s2)^k2]. More... | |
complex double | integg2 (complex double s1, complex double s2, complex double *alp, int k1, complex double *bet, int k2, double a, double b) |
Integration of 1/[(z-s1)^k1 (z-s2)^k2] from a to b. More... | |
void | weights (int n, complex double *zk, int *mulp, double lambda, complex double *omega) |
Compute the LS weight for each multiple pole. More... | |
int | scaleweigthts (int n, double a, double b, complex double *zk, int *mulp, complex double *omegaM) |
Compute the weights and pole locations on [a, b]. More... | |
void | set_ratf_def (ratparams *rat) |
Sets default values for ratparams struct. More... | |
int | find_ratf (double *intv, ratparams *rat) |
void | free_rat (ratparams *rat) |
void | RatFiltApply (int n, ratparams *rat, double *b, double *x, double *w6) |
Apply rational filter R to a vetor b. More... | |
Computing and applying rational filters.
Definition in file ratfilter.c.
void contQuad | ( | int | method, |
int | n, | ||
complex double * | zk | ||
) |
Compute the locations of the poles.
----------------------— Cauchy integration-based filter -----------—
method | 0 for Guass Legendre; 1 for midpoint | |
n | Number of poles in the upper half plane | |
[out] | zk | Vector of pole locations |
Definition at line 23 of file ratfilter.c.
References DSTEV(), M_PI, and Malloc.
Referenced by find_ratf().
int find_ratf | ( | double * | intv, |
ratparams * | rat | ||
) |
intv | = an array of length 4 [intv[0], intv[1]] is the interval of desired eigenvalues [intv[2], intv[3]] is the global interval of all eigenvalues it must contain all eigenvalues of A |
OUT:
[out] | rat | these are set in rat struct: omega : expansion coefficients of rational filter zk : location of the poles used aa : adjusted left endpoint bb : adjusted right endpoint dd : half-width and.. cc : ..center of interval |
Definition at line 375 of file ratfilter.c.
References _ratparams::aa, _ratparams::ASIGBsol, _ratparams::bb, _ratparams::beta, contQuad(), Malloc, max, _ratparams::method, min, _ratparams::mulp, _ratparams::num, _ratparams::omega, _ratparams::pow, _ratparams::pw, scaleweigthts(), weights(), and _ratparams::zk.
Referenced by evsl_find_rat(), and main().
void free_rat | ( | ratparams * | rat | ) |
Definition at line 424 of file ratfilter.c.
References _ratparams::ASIGBsol, _ratparams::mulp, _ratparams::omega, and _ratparams::zk.
Referenced by evsl_free_rat(), and main().
complex double integg2 | ( | complex double | s1, |
complex double | s2, | ||
complex double * | alp, | ||
int | k1, | ||
complex double * | bet, | ||
int | k2, | ||
double | a, | ||
double | b | ||
) |
Integration of 1/[(z-s1)^k1 (z-s2)^k2] from a to b.
Definition at line 129 of file ratfilter.c.
Referenced by weights().
void pfe2 | ( | complex double | s1, |
complex double | s2, | ||
int | k1, | ||
int | k2, | ||
complex double * | alp, | ||
complex double * | bet | ||
) |
Get the fraction expansion of 1/[(z-s1)^k1 (z-s2)^k2].
Definition at line 95 of file ratfilter.c.
Referenced by weights().
void ratf2p2 | ( | int | n, |
int * | mulp, | ||
complex double * | zk, | ||
complex double * | alp, | ||
int | m, | ||
double * | z, | ||
double * | xx | ||
) |
Compute the function value of the multiple pole rational filter at real locations.
---------------—Multiple pole rational filter evaluation -----------—
n | number of the pole | |
mulp | multiplicity of the pole | |
zk | array containing the poles. | |
alp | fractional expansion coefficients | |
m | number of locations to be evaluated | |
z | real locations to be evaluated | |
[out] | xx | : function values at real locations z |
Definition at line 69 of file ratfilter.c.
Referenced by scaleweigthts(), and weights().
void RatFiltApply | ( | int | n, |
ratparams * | rat, | ||
double * | b, | ||
double * | x, | ||
double * | w6 | ||
) |
Apply rational filter R to a vetor b.
For generalized e.v problem x = L' * (A-SB) \ L*b [w:=work] x = L * b w = (A-sB) \ x x = L' * w
[in] | rat | ratparams struct |
[in] | n | Length of array |
[in] | b | x = L * b |
w6 | Work array of size 4*n for standard ev problem, size 6*n for generalized ev problem | |
[out] | x | Becomes R(A)b |
Definition at line 448 of file ratfilter.c.
References _ratparams::ASIGBsol, DAXPY(), DSCAL(), evsl_timer(), evsldata, evslstat, _evsldata::ifGenEv, _ratparams::mulp, _evslstat::n_ratAv, _ratparams::num, _ratparams::omega, and _evslstat::t_ratAv.
Referenced by RatLanNr(), and RatLanTr().
int scaleweigthts | ( | int | n, |
double | a, | ||
double | b, | ||
complex double * | zk, | ||
int * | mulp, | ||
complex double * | omegaM | ||
) |
Compute the weights and pole locations on [a, b].
---------------—Transform poles and weights computed on [-1, 1] to [a, b] -------—
n | number of poles used in the upper half plane | |
a,b | [a, b] is the interval of desired eigenvalues | |
zk | location of the poles | |
mulp | multiplicity of the poles | |
[out] | omegaM | multiple LS weights |
Definition at line 313 of file ratfilter.c.
References ratf2p2().
Referenced by find_ratf().
void set_ratf_def | ( | ratparams * | rat | ) |
Sets default values for ratparams struct.
Definition at line 345 of file ratfilter.c.
References _ratparams::aa, _ratparams::bar, _ratparams::bb, _ratparams::beta, _ratparams::method, _ratparams::num, and _ratparams::pw.
Referenced by evsl_find_rat(), and main().
void weights | ( | int | n, |
complex double * | zk, | ||
int * | mulp, | ||
double | lambda, | ||
complex double * | omega | ||
) |
Compute the LS weight for each multiple pole.
---------------—multiple pole LS rational filter weights-----------—
n | number of poles in the upper half plane | |
zk | pole locations | |
mulp | multiplicity of each pole | |
lambda | LS integration weight for [-1, 1] | |
[out] | omega | LS weight for each pole |
Definition at line 169 of file ratfilter.c.
References integg2(), Malloc, pfe2(), ratf2p2(), and ZGESV().
Referenced by find_ratf().