EVSL
1.1.0
EigenValues Slicing Library
|
A number of utility functions related to DOS functionality. More...
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "blaslapack.h"
#include "def.h"
#include "evsl.h"
#include "internal_proto.h"
#include "struct.h"
Go to the source code of this file.
Functions | |
double | rec (const double a) |
double | isqrt (const double a) |
void | SetupBPol (int n, int max_deg, double tol, double lmin, double lmax, double(*ffun)(double), BSolDataPol *data) |
void | SetupPolRec (int n, int max_deg, double tol, double lmin, double lmax, BSolDataPol *data) |
void | SetupPolSqrt (int n, int max_deg, double tol, double lmin, double lmax, BSolDataPol *data) |
void | FreeBSolPolData (BSolDataPol *data) |
void | BSolPol (double *b, double *x, void *data) |
int | apfun (const double c, const double h, const double *const xi, double(*ffun)(double), const int npts, double *yi) |
int | pnav (double *mu, const int m, const double cc, const double dd, double *v, double *y, double *w) |
int | lsPol (double(*ffun)(double), BSolDataPol *pol) |
A number of utility functions related to DOS functionality.
Definition in file dos_utils.c.
int apfun | ( | const double | c, |
const double | h, | ||
const double *const | xi, | ||
double(*)(double) | ffun, | ||
const int | npts, | ||
double * | yi | ||
) |
Evalutes ffun at the xi's. Assumes a transformation of original inetrval [a b] into [-1, 1] so: the xi's are between -1 and 1
[in] | c | Value to increase xi's by |
[in] | h | Value to scale xi's by |
[in] | *xi | Points for which to evaluate ffun at |
[in] | npts | Number of points in xi to evaluate |
[in] | ffun | Function to evaluate |
[out] | yi | ffun evaluated at xi's |
Definition at line 83 of file dos_utils.c.
References ffun().
Referenced by lsPol().
void BSolPol | ( | double * | b, |
double * | x, | ||
void * | data | ||
) |
Definition at line 61 of file dos_utils.c.
References _BSolDataPol::cc, _BSolDataPol::dd, _BSolDataPol::deg, _BSolDataPol::mu, pnav(), and _BSolDataPol::wk.
Referenced by main().
void FreeBSolPolData | ( | BSolDataPol * | data | ) |
Definition at line 53 of file dos_utils.c.
References _BSolDataPol::mu, and _BSolDataPol::wk.
Referenced by main().
double isqrt | ( | const double | a | ) |
Definition at line 17 of file dos_utils.c.
Referenced by SetupPolSqrt().
int lsPol | ( | double(*)(double) | ffun, |
BSolDataPol * | pol | ||
) |
Finds the least-square polynomial approximation to function ffun in interval given by intv
[in] | ffun | Function to generate an approximation for |
[in,out] | pol | polparams struct \ Contains: cc = (a + b) / 2 \ dd = (b - a) / 2 \ mu = coefficients \ max_deg = number of coefficients |
Definition at line 168 of file dos_utils.c.
References apfun(), _BSolDataPol::cc, chebxPltd(), _BSolDataPol::dd, _BSolDataPol::deg, ffun(), _BSolDataPol::intv, linspace(), Malloc, _BSolDataPol::max_deg, _BSolDataPol::mu, and PI.
Referenced by SetupBPol().
int pnav | ( | double * | mu, |
const int | m, | ||
const double | cc, | ||
const double | dd, | ||
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.
[in] | mu | Coefficents of the cheb. polynomial (size m+1) |
[in] | cc | cc member of pol struct |
[in] | dd | dd member of pol struct |
[in] | m | m member of pol struct |
[in] | v | input vector |
[out] | y | p(A)v |
Workspace
[in,out] | w | Work vector of length 3*n [allocate before call |
Definition at line 109 of file dos_utils.c.
References evsldata, and _evsldata::n.
Referenced by BSolPol().
double rec | ( | const double | a | ) |
Definition at line 15 of file dos_utils.c.
Referenced by SetupPolRec().
void SetupBPol | ( | int | n, |
int | max_deg, | ||
double | tol, | ||
double | lmin, | ||
double | lmax, | ||
double(*)(double) | ffun, | ||
BSolDataPol * | data | ||
) |
Definition at line 22 of file dos_utils.c.
References Calloc, ffun(), _BSolDataPol::intv, lsPol(), Malloc, _BSolDataPol::max_deg, _BSolDataPol::mu, _BSolDataPol::tol, and _BSolDataPol::wk.
Referenced by SetupPolRec(), and SetupPolSqrt().
void SetupPolRec | ( | int | n, |
int | max_deg, | ||
double | tol, | ||
double | lmin, | ||
double | lmax, | ||
BSolDataPol * | data | ||
) |
Definition at line 37 of file dos_utils.c.
References rec(), and SetupBPol().
Referenced by main().
void SetupPolSqrt | ( | int | n, |
int | max_deg, | ||
double | tol, | ||
double | lmin, | ||
double | lmax, | ||
BSolDataPol * | data | ||
) |
Definition at line 45 of file dos_utils.c.
References isqrt(), and SetupBPol().
Referenced by main().