mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 15:55:37 +00:00
54aec05989
but non-identity matrix l1 0 0 0 .... 0 l2 0 0 .... 0 0 l3 0 ... . . . . . . . . . And apply the multishift CG to it. Sum the poles and residues. Insist that this be the same as the exactly taken square root where l1,l2,l3 >= 0.
29 lines
800 B
C++
29 lines
800 B
C++
#ifndef MULTI_SHIFT_FUNCTION
|
|
#define MULTI_SHIFT_FUNCTION
|
|
namespace Grid {
|
|
class MultiShiftFunction {
|
|
public:
|
|
int order;
|
|
std::vector<RealD> poles;
|
|
std::vector<RealD> residues;
|
|
std::vector<RealD> tolerances;
|
|
RealD norm;
|
|
RealD lo,hi;
|
|
MultiShiftFunction(int n,RealD _lo,RealD _hi): poles(n), residues(n), lo(_lo), hi(_hi) {;};
|
|
RealD approx(RealD x);
|
|
void csv(std::ostream &out);
|
|
void gnuplot(std::ostream &out);
|
|
MultiShiftFunction(AlgRemez & remez,double tol,bool inverse) :
|
|
order(remez.getDegree()),
|
|
tolerances(remez.getDegree(),tol),
|
|
poles(remez.getDegree()),
|
|
residues(remez.getDegree())
|
|
{
|
|
remez.getBounds(lo,hi);
|
|
if ( inverse ) remez.getIPFE (&residues[0],&poles[0],&norm);
|
|
else remez.getPFE (&residues[0],&poles[0],&norm);
|
|
}
|
|
};
|
|
}
|
|
#endif
|