EVSL
1.1.0
EigenValues Slicing Library
|
Computing and applying polynomial filters. More...
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <float.h>
#include <string.h>
#include "def.h"
#include "blaslapack.h"
#include "struct.h"
#include "internal_proto.h"
Go to the source code of this file.
Functions | |
void | set_pol_def (polparams *pol) |
set default values for polparams struct. More... | |
int | dampcf (int m, int damping, double *jac) |
Computes damping coefficient for cheb. expansions. More... | |
double | dif_eval (double *v, int m, double thc, double *jac) |
function dif_eval(v, m, thc, jac) evaluates the difference between the right and left values of the polynomial expressed in chebyshev expansion More... | |
int | chebxPltd (int m, double *mu, int npts, double *xi, double *yi) |
function yi = chebxPltd computes yi = p_mu (xi), More... | |
void | chext (polparams *pol, double aIn, double bIn) |
Determines polynomial for end interval cases. More... | |
int | indexofSmallestElement (double *array, int size) |
Find the indexofSmallestElement in array. More... | |
int | rootchb (int m, double *v, double *jac, double tha, double thb, double *mu, double *thcOut) |
Finds the roots of linear combination of chebyshev polynomials. More... | |
int | find_pol (double *intv, polparams *pol) |
Sets the values in pol. More... | |
void | free_pol (polparams *pol) |
int | ChebAv (polparams *pol, double *v, double *y, double *w) |
Computes y=P(A) v, where pn is a Cheb. polynomial expansion More... | |
Computing and applying polynomial filters.
Definition in file chebpoly.c.
int ChebAv | ( | polparams * | pol, |
double * | v, | ||
double * | y, | ||
double * | w | ||
) |
Computes y=P(A) v, where pn is a Cheb. polynomial expansion
This explicitly calls matvec, so it can be useful for implementing user-specific matrix-vector multiplication.
pol | Struct containing the paramenters and expansion coefficient of the polynomail. | |
v | input vector | |
[out] | y | p(A)v |
Workspace
w | Work vector of length 3*n [allocate before call] |
v | is untouched |
Definition at line 510 of file chebpoly.c.
References _polparams::cc, DAXPY(), _polparams::dd, _polparams::deg, DSCAL(), evsl_timer(), evsldata, evslstat, _evsldata::ifGenEv, _polparams::mu, _evsldata::n, _evslstat::n_polAv, _evslstat::t_polAv, and _evslstat::t_sth.
Referenced by ChebLanNr(), ChebLanTr(), and ChebSI().
int chebxPltd | ( | int | m, |
double * | mu, | ||
int | npts, | ||
double * | xi, | ||
double * | yi | ||
) |
function yi = chebxPltd computes yi = p_mu (xi),
where xi is a vectors of values. This can used for plotting the filter given by mu for example – Jackson (or other) dampings is not explicitly used here but is assumed to be multiplied by mu outside this routine.
m | degree of the polynomial = length(mu)-1 |
mu | Chev. expansion coefficients in KPM method |
npts | = number of points in xi, yi |
xi | = a vector of values where p(xi) is to be computed. |
[out] | yi | = pn(xi(:) ) |
Definition at line 106 of file chebpoly.c.
References DAXPY(), Malloc, and vecset().
Referenced by find_pol(), and lsPol().
void chext | ( | polparams * | pol, |
double | aIn, | ||
double | bIn | ||
) |
Determines polynomial for end interval cases.
In these cases, polynomial is just a scaled Chebyshev polynomial. However we need to express it in the same basis as in the other (middle interval) cases. This function determines this expansion
aIn | The start index of the transformed interval |
bIn | The end index of the transformed interval |
pol | A struct containing the parameters of polynomial. |
Modifies mu Expansion coefficients of best polynomial found. deg: Degree of polynomial gam: Site of delta function that is expanded. Accurate 'balancing' is done: If p(t) is best approximation to delta function at gam then gam is selected so that p(a)=p(b) - within the tolerance tolBal (set in this function to 1.e-10) bar: If bar, accept eigenvalue as belonging to interval; else reject.
Definition at line 171 of file chebpoly.c.
References _polparams::bar, Calloc, _polparams::deg, _polparams::gam, _polparams::max_deg, _polparams::mu, and _polparams::thresh_ext.
Referenced by find_pol().
int dampcf | ( | int | m, |
int | damping, | ||
double * | jac | ||
) |
Computes damping coefficient for cheb. expansions.
damping | == 0 –> no damping == 1 –> Jackson == 2 –> Lanczos sigma damping | |
m | degree of the polynomial | |
[out] | jac | output array of dampened coefficients |
Definition at line 40 of file chebpoly.c.
References PI.
Referenced by find_pol(), and kpmdos().
double dif_eval | ( | double * | v, |
int | m, | ||
double | thc, | ||
double * | jac | ||
) |
function dif_eval(v, m, thc, jac) evaluates the difference between the right and left values of the polynomial expressed in chebyshev expansion
v | vector of coefficients [see paper] |
m | degree |
thc | angle theta corresponding to peak of polynomial |
jac | vector of damping coefficients |
Definition at line 79 of file chebpoly.c.
Referenced by rootchb().
int find_pol | ( | double * | intv, |
polparams * | pol | ||
) |
Sets the values in pol.
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. |
pol | The polynomial struct to set the values of. |
Definition at line 361 of file chebpoly.c.
References _polparams::bar, _polparams::cc, chebxPltd(), chext(), dampcf(), _polparams::damping, _polparams::dd, _polparams::deg, _polparams::gam, _polparams::intvtol, Malloc, max, _polparams::max_deg, min, _polparams::min_deg, _polparams::mu, rootchb(), _polparams::thresh_int, and _polparams::type.
Referenced by evsl_find_pol(), and main().
void free_pol | ( | polparams * | pol | ) |
Definition at line 488 of file chebpoly.c.
References _polparams::mu.
Referenced by evsl_free_pol(), and main().
int indexofSmallestElement | ( | double * | array, |
int | size | ||
) |
Find the indexofSmallestElement in array.
array | Array to find the smallest index of |
size | size of the arry |
Definition at line 268 of file chebpoly.c.
int rootchb | ( | int | m, |
double * | v, | ||
double * | jac, | ||
double | tha, | ||
double | thb, | ||
double * | mu, | ||
double * | thcOut | ||
) |
Finds the roots of linear combination of chebyshev polynomials.
m | degree of polynomial | |
v | difference between cosines on left and right [(3.12) in paper] | |
jac | damping coefficients | |
tha | theta_a [refer to paper] | |
thb | theta_b [refer to paper] | |
mu | expansion coefficients. | |
[out] | thcOut | value of theta_c |
Definition at line 287 of file chebpoly.c.
References dif_eval().
Referenced by find_pol().
void set_pol_def | ( | polparams * | pol | ) |
set default values for polparams struct.
Definition at line 18 of file chebpoly.c.
References _polparams::damping, _polparams::deg, _polparams::intvtol, _polparams::max_deg, _polparams::min_deg, _polparams::mu, _polparams::thresh_ext, _polparams::thresh_int, and _polparams::tol.
Referenced by evsl_find_pol(), and main().