52 os <<
"this is a " <<
getClassName() <<
", which is not a ChebyMap";
63 for (
auto &
val : lbnd) {
64 if (
val == AST__BAD) {
68 for (
auto &
val : ubnd) {
69 if (
val == AST__BAD) {
81 const int nin = coeff_f.getSize<1>() - 2;
82 const int ncoeff_f = coeff_f.getSize<0>();
83 const int nout = coeff_i.getSize<1>() - 2;
84 const int ncoeff_i = coeff_i.getSize<0>();
85 const bool has_fwd = ncoeff_f > 0;
86 const bool has_inv = ncoeff_i > 0;
88 if (!has_fwd and !has_inv) {
90 "Must specify forward or inverse transform (coeff_f and coeff_i both empty)");
94 os <<
"coeff_f row length = " << nin + 2
95 <<
", which is too short; length = nin + 2 and nin must be > 0";
100 os <<
"coeff_i row length " << nout + 2
101 <<
", which is too short; length = nout + 2 and nout must be > 0";
106 "number of input axes");
108 "number of input axes");
112 "number of output axes");
114 "number of output axes");
117 auto result =
reinterpret_cast<AstChebyMap *
>(astChebyMap(nin, nout, ncoeff_f, coeff_f.getData(),
118 ncoeff_i, coeff_i.getData(), lbnd_f.
data(),
120 "%s", options.
c_str()));
126 AstChebyMap *ChebyMap::_makeRawChebyMap(
ConstArray2D const &coeff_f,
int nout,
129 const int nin = coeff_f.getSize<1>() - 2;
130 const int ncoeff_f = coeff_f.getSize<0>();
131 const bool has_fwd = ncoeff_f > 0;
138 os <<
"coeff_f row length = " << nin + 2
139 <<
", which is too short; length = nin + 2 and nin must be > 0";
144 os <<
"coeff_i row length " << nout + 2
145 <<
", which is too short; length = nout + 2 and nout must be > 0";
151 return reinterpret_cast<AstChebyMap *
>(astChebyMap(nin, nout, ncoeff_f, coeff_f.getData(), 0,
nullptr,
152 lbnd_f.
data(), ubnd_f.
data(),
nullptr,
nullptr,
"%s",
ndarray::Array< const double, 2, 2 > ConstArray2D
2D array of const double; typically used for lists of const points
AstObject const * getRawPtr() const
Get the raw AST pointer.
AST wrapper classes and functions.
std::string getClassName() const
Get Class: the name of the class (e.g.
The domain over which a Chebyshev polynomial is defined; returned by ChebyMap.getDomain.
ChebyMap polyTran(bool forward, double acc, double maxacc, int maxorder, std::vector< double > const &lbnd, std::vector< double > const &ubnd) const
This function creates a new ChebyMap which is a copy of this one, in which a specified transformation...
void assertOK(AstObject *rawPtr1=nullptr, AstObject *rawPtr2=nullptr)
Throw std::runtime_error if AST's state is bad.
An abstract base class for objects which transform one set of coordinates to another.
ChebyMap(ConstArray2D const &coeff_f, ConstArray2D const &coeff_i, std::vector< double > const &lbnd_f, std::vector< double > const &ubnd_f, std::vector< double > const &lbnd_i, std::vector< double > const &ubnd_i, std::string const &options="")
Construct a ChebyMap with a specified forward and/or inverse transforms.
template AstChebyMap * polyTranImpl< AstChebyMap >(ChebyMap const &, bool, double, double, int, std::vector< double > const &, std::vector< double > const &)
A ChebyMap is a form of Mapping which performs a Chebyshev polynomial transformation.
int getNIn() const
Get NIn: the number of input axes.
void assertEqual(T1 val1, std::string const &descr1, T2 val2, std::string const &descr2)
ChebyDomain getDomain(bool forward) const
Return the bounding box of the domain of a ChebyMap.
int getNOut() const
Get NOut: the number of output axes.