EVSL  1.1.0
EigenValues Slicing Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
dos_utils.c File Reference

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)
 

Detailed Description

A number of utility functions related to DOS functionality.

Definition in file dos_utils.c.

Function Documentation

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

Parameters
[in]cValue to increase xi's by
[in]hValue to scale xi's by
[in]*xiPoints for which to evaluate ffun at
[in]nptsNumber of points in xi to evaluate
[in]ffunFunction to evaluate
[out]yiffun evaluated at xi's

Definition at line 83 of file dos_utils.c.

References ffun().

Referenced by lsPol().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

void FreeBSolPolData ( BSolDataPol data)

Definition at line 53 of file dos_utils.c.

References _BSolDataPol::mu, and _BSolDataPol::wk.

Referenced by main().

Here is the caller graph for this function:

double isqrt ( const double  a)

Definition at line 17 of file dos_utils.c.

Referenced by SetupPolSqrt().

Here is the caller graph for this function:

int lsPol ( double(*)(double)  ffun,
BSolDataPol pol 
)

Finds the least-square polynomial approximation to function ffun in interval given by intv

Parameters
[in]ffunFunction to generate an approximation for
[in,out]polpolparams 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]muCoefficents of the cheb. polynomial (size m+1)
[in]cccc member of pol struct
[in]dddd member of pol struct
[in]mm member of pol struct
[in]vinput vector
[out]yp(A)v

Workspace

Parameters
[in,out]wWork 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().

Here is the caller graph for this function:

double rec ( const double  a)

Definition at line 15 of file dos_utils.c.

Referenced by SetupPolRec().

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function: