a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
Expanded< T > Class Template Reference

A template class for Taylor double expansion of several objects. More...

#include <Expanded.h>

Detailed Description

template<class T>
class Expanded< T >

A template class for Taylor double expansion of several objects.

Author
HEPfit Collaboration

This is a template class that implement an expansion of the object T in two generic expansion parameters. T can be double, gslpp::complex, gslpp::vector<double>, gslpp::vector<gslpp::complex>, gslpp::matrix<double>, and gslpp::matrix<gslpp::comlex>. The elements of the expansion are stored in a private std::vector<std::vector<T> >. The variables int n1 and std::vector<int> n2 contain the size of the outer and inner vectors respectively. The variables minord1 and minord2 contain the starting powers of the expansion in the two parameters. Operators +, -, *, /, ==, !=, << are defined and the proper number of terms is retained in the result.

Definition at line 55 of file Expanded.h.

Public Member Functions

template<>
Expanded< double > abs2 () const
 
Expanded< double > abs2 () const
 Method to return the squared absolute value of a Expanded<complex>. More...
 
template<>
Expanded< double > abs2 () const
 
void checkOrd (int j, int i, std::string s) const
 
template<>
Expanded< complex > conjugate () const
 
Expanded< T > conjugate () const
 Method to return the conjugate value of a Expanded<complex>. More...
 
template<>
Expanded< complexconjugate () const
 
 Expanded ()
 Empty constructor. All data initialized to zero. More...
 
 Expanded (std::vector< std::vector< T > > &dinp, int minord2_i=0, int minord1_i=0)
 Constructor of a double expansion. More...
 
 Expanded (std::vector< T > &dinp, int minord2_i=0)
 Constructor of a single expansion. More...
 
const int getMin1 () const
 Get the minimum order of the outer expansion. More...
 
const int getMin2 () const
 Get the minimum order of the inner expansion. More...
 
const int getN1 () const
 Get the number of terms in the outer expansion. More...
 
const std::vector< int > & getN2 () const
 Get the number of terms in the inner expansion. More...
 
const T & getOrd (int j) const
 Get an element of a single expansion. More...
 
const T & getOrd (int j, int i) const
 Get an element of a double expansion. More...
 
template<>
Expanded< double > inverse () const
 
template<>
Expanded< complex > inverse () const
 
Expanded< T > inverse () const
 
bool operator!= (const Expanded< T > &z) const
 
template<class Q >
std::enable_if< isSc(T, double)||(isSc(T, complex) &&isComp(Q))||(isMat(T, double) &&!isS(Q))||(isMat(T, complex) &&(isVec(Q, complex)||isMat(Q, complex))), Expanded< Q > >::type operator* (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if<(!isSc(T, double) &&isSc(Q, double))||(!isS(T) &&!isMat(T, double) &&isMat(Q, double))||((isMat(T, complex)||isVec(T, complex)) &&isSc(Q, complex))||(isVec(T, complex) &&isMat(Q, complex)), Expanded< T > >::type operator* (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if<(isVec(T, double) &&isSc(Q, complex))||(isVec(T, double) &&isMat(Q, complex)), Expanded< vector< complex > > >::type operator* (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if<(isSc(T, complex) &&isVec(Q, double))||(isMat(T, complex) &&isVec(Q, double)), Expanded< vector< complex > > >::type operator* (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if<(isVec(T, double) &&isVec(Q, complex))||(isVec(T, complex) &&isVec(Q, double))||(isVec(T, complex) &&isVec(Q, complex)), Expanded< complex > >::type operator* (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if<(isMat(T, double) &&isSc(Q, complex)), Expanded< matrix< complex > > >::type operator* (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if<(isSc(T, complex) &&isMat(Q, double)), Expanded< matrix< complex > > >::type operator* (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if< isVec(T, double) &&isVec(Q, double), Expanded< double > >::type operator* (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if<(std::is_same< T, Q >::value &&!isV(T))||isSc(Q, double)||(!isS(T) &&isMat(Q, double))||((isMat(T, complex)||isVec(T, complex)) &&isS(Q))||(isVec(T, complex) &&isMat(Q, complex))||(isV(T) &&isSc(Q, double))||(isMat(T, double) &&isSc(Q, double)), Expanded< T > >::type operator* (const Q &z) const
 
template<class Q >
std::enable_if< isVec(T, double) &&isVec(Q, double), Expanded< double > >::type operator* (const Q &z) const
 
template<class Q >
std::enable_if<(isSc(T, double) &&isSc(Q, complex))||(isV(T) &&isV(Q) &&!(isVec(T, double) &&isVec(Q, double))), Expanded< complex > >::type operator* (const Q &z) const
 
template<class Q >
std::enable_if< isVec(Q, double) &&(isSc(T, double)||isMat(T, double)), Expanded< vector< double > > >::type operator* (const Q &z) const
 
template<class Q >
std::enable_if<(isVec(Q, complex) &&(isS(T)||isM(T)))||(isVec(Q, double) &&(isSc(T, complex)||isMat(T, complex))), Expanded< vector< complex > > >::type operator* (const Q &z) const
 
template<class Q >
std::enable_if< isVec(T, double) &&(isSc(Q, complex)||isMat(Q, complex)), Expanded< vector< complex > > >::type operator* (const Q &z) const
 
template<class Q >
std::enable_if<(isSc(T, double) &&isMat(Q, double)), Expanded< matrix< double > > >::type operator* (const Q &z) const
 
template<class Q >
std::enable_if<(isS(T) &&isMat(Q, complex))||(isSc(T, complex) &&isMat(Q, double))||(isMat(T, double) &&isMat(Q, complex)), Expanded< matrix< complex > > >::type operator* (const Q &z) const
 
template<class Q >
std::enable_if< isMat(T, double) &&isSc(Q, complex), Expanded< matrix< complex > > >::type operator* (const Q &z) const
 
template<class Q >
std::enable_if< sameType(T, Q) &&isComp(T), Expanded< T > >::type operator+ (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if< sameType(T, Q) &&!isComp(T), Expanded< Q > >::type operator+ (const Expanded< Q > &z) const
 
Expanded< T > operator- () const
 
template<class Q >
std::enable_if< sameType(T, Q) &&isComp(T), Expanded< T > >::type operator- (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if< sameType(T, Q) &&!isComp(T), Expanded< Q > >::type operator- (const Expanded< Q > &z) const
 
Expanded< T > operator/ (const double &z) const
 
template<class Q >
std::enable_if< isSc(Q, double), Expanded< T > >::type operator/ (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if< isSc(Q, complex) &&isS(T), Expanded< complex > >::type operator/ (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if< isSc(Q, complex) &&isV(T), Expanded< vector< complex > > >::type operator/ (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if< isSc(Q, complex) &&isM(T), Expanded< matrix< complex > > >::type operator/ (const Expanded< Q > &z) const
 
template<class Q >
std::enable_if< isComp(T) &&isSc(Q, complex), Expanded< T > >::type operator/ (const Q &z) const
 
template<class Q >
std::enable_if< isSc(T, double) &&isSc(Q, complex), Expanded< complex > >::type operator/ (const Q &z) const
 
template<class Q >
std::enable_if< isVec(T, double) &&isSc(Q, complex), Expanded< vector< complex > > >::type operator/ (const Q &z) const
 
template<class Q >
std::enable_if< isMat(T, double) &&isSc(Q, complex), Expanded< matrix< complex > > >::type operator/ (const Q &z) const
 
bool operator== (const Expanded< T > &z) const
 
template<>
Expanded< double > real () const
 
Expanded< double > real () const
 Method to return the real part of a complex Expanded. More...
 
template<>
Expanded< double > real () const
 
Series (int ord2, double als2=1.)
 Method to sum an expansion up to a given order. More...
 
Series (std::vector< int > ord2, int ord1, double als2=1., double als1=1.)
 Method to sum a double expansion up to a given order. More...
 
template<class Q >
std::enable_if< isMat(T, Q), void >::type setMatrixElement (int j, int h, int k, Q x)
 Set an element of a matrix in a single Expanded<matrix<*> > More...
 
template<class Q >
std::enable_if< isMat(T, Q), void >::type setMatrixElement (int j, int i, int h, int k, Q x)
 Set an element of a matrix in a double Expanded<matrix<*> > More...
 
void setOrd (int j, int i, T value)
 Set an element of a double expansion. More...
 
void setOrd (int j, T value)
 Set an element of a single expansion. More...
 
template<class Q >
std::enable_if< isVec(T, Q), void >::type setVectorElement (int j, int h, Q x)
 Set an element of a matrix in a single Expanded<vector<*> > More...
 
template<class Q >
std::enable_if< isVec(T, Q), void >::type setVectorElement (int j, int i, int h, Q x)
 Set an element of a matrix in a double Expanded<vector<*> > More...
 
template<>
Expanded< matrix< double > > transpose () const
 
template<>
Expanded< matrix< complex > > transpose () const
 
Expanded< T > transpose () const
 Method to transpose a Expanded<matrix<double> > or a Expanded<matrix<complex> >. More...
 
template<>
Expanded< matrix< double > > transpose () const
 
template<>
Expanded< matrix< complex > > transpose () const
 
Expanded< T > truncate (int n2max)
 Method to truncate a single expansion. More...
 
Expanded< T > truncate (std::vector< int > n2max, int n1max)
 Method to truncate a double expansion. More...
 
template<>
matrix< double > Zero () const
 
template<>
matrix< complex > Zero () const
 
template<>
vector< double > Zero () const
 
template<>
vector< complex > Zero () const
 
Zero () const
 Return an empty instance of class T. More...
 
template<>
matrix< double > Zero () const
 
template<>
matrix< complexZero () const
 
template<>
vector< double > Zero () const
 
template<>
vector< complexZero () const
 

Private Member Functions

template<>
double invCoeff (int i, int j) const
 
template<>
complex invCoeff (int i, int j) const
 
invCoeff (int i, int j) const
 Return the (i-th, j-th) coefficient of the expansion of 1/Expanded. More...
 

Private Attributes

std::vector< std::vector< T > > data
 
int minord1
 
int minord2
 
int n1
 
std::vector< int > n2
 

Friends

Expanded< T > operator* (const double &ue, const Expanded< T > &ex)
 
std::ostream & operator<< (std::ostream &output, const Expanded< T > z)
 

Constructor & Destructor Documentation

◆ Expanded() [1/3]

template<class T >
template Expanded< T >::Expanded ( )

Empty constructor. All data initialized to zero.

Definition at line 11 of file Expanded.cpp.

11  {
12  minord1 = 0;
13  minord2 = 0;
14  n1 = 0;
15 }

◆ Expanded() [2/3]

template<class T>
Expanded< T >::Expanded ( std::vector< T > &  dinp,
int  minord2_i = 0 
)

Constructor of a single expansion.

Parameters
[in]dinpa std::vector<T> with the elements of the expansion.
[in]minord2_ian int containing the starting power of the expansion, default to 0.

Definition at line 25 of file Expanded.cpp.

26 {
27  minord1 = 0;
28  n1 = 1;
29  minord2 = minord2_i;
30  n2.push_back(dinp.size());
31  data.push_back(dinp);
32 }

◆ Expanded() [3/3]

template<class T>
Expanded< T >::Expanded ( std::vector< std::vector< T > > &  dinp,
int  minord2_i = 0,
int  minord1_i = 0 
)

Constructor of a double expansion.

Parameters
[in]dinpa std::vector<std::vector<T> > with the elements of the expansion.
[in]minord2_ian int containing the starting power of the inner expansion, default to 0.
[in]minord1_ian int containing the starting power of the outer expansion, default to 0.

Member Function Documentation

◆ abs2() [1/3]

template<>
Expanded< double > Expanded< complex >::abs2 ( ) const

Definition at line 106 of file Expanded.cpp.

107 {
108  return ((*this) * ((*this).conjugate())).real();
109 }

◆ abs2() [2/3]

template<class T>
Expanded<double> Expanded< T >::abs2 ( ) const

Method to return the squared absolute value of a Expanded<complex>.

Returns
the squared absolute value of this Expanded<complex>

◆ abs2() [3/3]

template<>
Expanded< double > Expanded< complex >::abs2 ( ) const

◆ checkOrd()

template<class T>
void Expanded< T >::checkOrd ( int  j,
int  i,
std::string  s 
) const
inline

Definition at line 727 of file Expanded.h.

727  {
728  if (i < minord1 || i >= minord1 + n1 || j < minord2 || j >= minord2 + n2.at(i - minord1))
729  throw std::runtime_error(s);
730  }

◆ conjugate() [1/3]

template<>
Expanded< complex > Expanded< complex >::conjugate ( ) const

Definition at line 58 of file Expanded.cpp.

59 {
60  std::vector<std::vector<complex> > res;
61  for (int i = 0; i < n1; i++)
62  {
63  res.push_back(std::vector<complex>(n2.at(i)));
64  for (int j = 0; j < n2.at(i); j++)
65  res[i][j] = data[i][j].conjugate();
66  }
67  return Expanded<complex>(res, minord2, minord1);
68 }

◆ conjugate() [2/3]

template<class T>
Expanded<T> Expanded< T >::conjugate ( ) const

Method to return the conjugate value of a Expanded<complex>.

Returns
the conjugate of this Expanded<complex>

◆ conjugate() [3/3]

template<>
Expanded< complex > Expanded< complex >::conjugate ( ) const

◆ getMin1()

template<class T>
const int Expanded< T >::getMin1 ( ) const
inline

Get the minimum order of the outer expansion.

Returns
value of the minimum order of the outer expansion.

Definition at line 787 of file Expanded.h.

787  {
788  return minord1;
789  }

◆ getMin2()

template<class T>
const int Expanded< T >::getMin2 ( ) const
inline

Get the minimum order of the inner expansion.

Returns
value of the minimum order of the inner expansion.

Definition at line 795 of file Expanded.h.

795  {
796  return minord2;
797  }

◆ getN1()

template<class T>
const int Expanded< T >::getN1 ( ) const
inline

Get the number of terms in the outer expansion.

Returns
value of the minimum order of the outer expansion.

Definition at line 803 of file Expanded.h.

803  {
804  return n1;
805  }

◆ getN2()

template<class T>
const std::vector<int>& Expanded< T >::getN2 ( ) const
inline

Get the number of terms in the inner expansion.

Returns
values of the minimum order of the inner expansion, contains n1 terms.

Definition at line 812 of file Expanded.h.

812  {
813  return n2;
814  }

◆ getOrd() [1/2]

template<class T>
const T& Expanded< T >::getOrd ( int  j) const
inline

Get an element of a single expansion.

Parameters
[in]jorder of the requested element.
Returns
the j-th element of the expansion.

Definition at line 694 of file Expanded.h.

694  {
695  return getOrd(j, minord1);
696  }

◆ getOrd() [2/2]

template<class T>
const T& Expanded< T >::getOrd ( int  j,
int  i 
) const
inline

Get an element of a double expansion.

Parameters
[in]jorder of the requested element in the inner expansion.
[in]iorder of the requested element in the outer expansion.
Returns
the (i-th, j-th) element of the double expansion.

Definition at line 704 of file Expanded.h.

704  {
705  checkOrd(j, i, "Expanded::getOrd(): order non present in Expanded");
706  return data[i - minord1][j - minord2];
707  }

◆ invCoeff() [1/3]

template<>
double Expanded< double >::invCoeff ( int  i,
int  j 
) const
private

Definition at line 146 of file Expanded.cpp.

146  {
147  if(i == 0 && j == 0) return (1. / data[0][0]);
148  double res = 0.;
149  for(int n = 0; n <= i; n++)
150  for(int m = 0; m <= j; m++) {
151  if(n == i && m == j) continue;
152  res -= invCoeff(n, m) * data[i - n][j - m];
153  }
154  return (res / data[0][0]);
155 }

◆ invCoeff() [2/3]

template<>
complex Expanded< complex >::invCoeff ( int  i,
int  j 
) const
private

Definition at line 158 of file Expanded.cpp.

158  {
159  if(i == 0 && j == 0) return (1. / data[0][0]);
160  complex res = 0.;
161  for(int n = 0; n <= i; n++)
162  for(int m = 0; m <= j; m++) {
163  if(n == i && m == j) continue;
164  res -= invCoeff(n, m) * data[i - n][j - m];
165  }
166  return (res / data[0][0]);
167 }

◆ invCoeff() [3/3]

template<class T>
T Expanded< T >::invCoeff ( int  i,
int  j 
) const
inlineprivate

Return the (i-th, j-th) coefficient of the expansion of 1/Expanded.

Returns
the (i-th, j-th) coefficient of the expansion of 1/Expanded.

Definition at line 832 of file Expanded.h.

832  {
833  throw std::runtime_error("Expanded::invCoeff: method not implemented");
834  }

◆ inverse() [1/3]

template<>
Expanded< double > Expanded< double >::inverse ( ) const

Definition at line 170 of file Expanded.cpp.

171 {
172  std::vector<std::vector<double> > res;
173  for (int i1 = 0; i1 < n1; i1++)
174  {
175  res.push_back(std::vector<double> (n2.at(i1), 0.));
176  for (int i2 = 0; i2 < n2.at(i1); i2++)
177  res[i1][i2] = invCoeff(i1, i2);
178  }
179  return Expanded<double>(res, -minord2, -minord1);
180 }

◆ inverse() [2/3]

template<>
Expanded< complex > Expanded< complex >::inverse ( ) const

Definition at line 183 of file Expanded.cpp.

184 {
185  std::vector<std::vector<complex> > res;
186  for (int i1 = 0; i1 < n1; i1++)
187  {
188  res.push_back(std::vector<complex> (n2.at(i1), 0.));
189  for (int i2 = 0; i2 < n2.at(i1); i2++)
190  res[i1][i2] = invCoeff(i1, i2);
191  }
192  return Expanded<complex>(res, -minord2, -minord1);
193 }

◆ inverse() [3/3]

template<class T>
Expanded<T> Expanded< T >::inverse ( ) const
inline

Definition at line 322 of file Expanded.h.

322  {
323  throw std::runtime_error("Expanded::inverse: method not implemented");
324  }

◆ operator!=()

template<class T>
bool Expanded< T >::operator!= ( const Expanded< T > &  z) const
inline

Definition at line 374 of file Expanded.h.

374  {
375  return !(z == *this);
376  }

◆ operator*() [1/17]

template<class T>
template<class Q >
std::enable_if< isSc(T, double) || (isSc(T, complex) && isComp(Q)) || (isMat(T, double) && !isS(Q)) || (isMat(T, complex) && (isVec(Q, complex) || isMat(Q, complex))), Expanded<Q> >::type Expanded< T >::operator* ( const Expanded< Q > &  z) const
inline

Definition at line 86 of file Expanded.h.

86  {
87  int min1 = minord1 + z.getMin1();
88  int min2 = minord2 + z.getMin2();
89  int up1 = std::min(n1, z.getN1());
90  std::vector<std::vector<Q> > res;
91  for (int i1 = 0; i1 < up1; i1++) {
92  int up2 = std::min(n2.at(i1), z.getN2().at(i1));
93  res.push_back(std::vector<Q>(up2, z.Zero()));
94  for (int i2 = 0; i2 < up2; i2++)
95  for (int j1 = 0; j1 <= i1; j1++)
96  for (int j2 = 0; j2 <= i2; j2++)
97  res[i1][i2] += data[j1][j2] * z.getOrd(i2 - j2 + z.getMin2(), i1 - j1 + z.getMin1());
98  }
99  return Expanded<Q>(res, min2, min1);
100  }

◆ operator*() [2/17]

template<class T>
template<class Q >
std::enable_if< (!isSc(T, double) && isSc(Q, double)) || (!isS(T) && !isMat(T, double) && isMat(Q, double)) || ((isMat(T, complex) || isVec(T, complex)) && isSc(Q, complex)) || (isVec(T, complex) && isMat(Q, complex)), Expanded<T> >::type Expanded< T >::operator* ( const Expanded< Q > &  z) const
inline

Definition at line 108 of file Expanded.h.

108  {
109  int min1 = minord1 + z.getMin1();
110  int min2 = minord2 + z.getMin2();
111  int up1 = std::min(n1, z.getN1());
112  std::vector<std::vector<T> > res;
113  for (int i1 = 0; i1 < up1; i1++) {
114  int up2 = std::min(n2.at(i1), z.getN2().at(i1));
115  res.push_back(std::vector<T>(up2, Zero()));
116  for (int i2 = 0; i2 < up2; i2++)
117  for (int j1 = 0; j1 <= i1; j1++)
118  for (int j2 = 0; j2 <= i2; j2++)
119  res[i1][i2] += data[j1][j2] * z.getOrd(i2 - j2 + z.getMin2(), i1 - j1 + z.getMin1());
120  }
121  return Expanded<T>(res, min2, min1);
122  }

◆ operator*() [3/17]

template<class T>
template<class Q >
std::enable_if< (isVec(T, double) && isSc(Q, complex)) || (isVec(T, double) && isMat(Q, complex)), Expanded<vector<complex> > >::type Expanded< T >::operator* ( const Expanded< Q > &  z) const
inline

Definition at line 128 of file Expanded.h.

128  {
129  int min1 = minord1 + z.getMin1();
130  int min2 = minord2 + z.getMin2();
131  int up1 = std::min(n1, z.getN1());
132  std::vector<std::vector<vector<complex> > > res;
133  for (int i1 = 0; i1 < up1; i1++) {
134  int up2 = std::min(n2.at(i1), z.getN2().at(i1));
135  res.push_back(std::vector<vector<complex> >(up2, Zero()));
136  for (int i2 = 0; i2 < up2; i2++)
137  for (int j1 = 0; j1 <= i1; j1++)
138  for (int j2 = 0; j2 <= i2; j2++)
139  res[i1][i2] += data[j1][j2] * z.getOrd(i2 - j2 + z.getMin2(), i1 - j1 + z.getMin1());
140  }
141  return Expanded<vector<complex> >(res, min2, min1);
142  }

◆ operator*() [4/17]

template<class T>
template<class Q >
std::enable_if< (isSc(T, complex) && isVec(Q, double)) || (isMat(T, complex) && isVec(Q, double)), Expanded<vector<complex> > >::type Expanded< T >::operator* ( const Expanded< Q > &  z) const
inline

Definition at line 148 of file Expanded.h.

148  {
149  int min1 = minord1 + z.getMin1();
150  int min2 = minord2 + z.getMin2();
151  int up1 = std::min(n1, z.getN1());
152  std::vector<std::vector<vector<complex> > > res;
153  for (int i1 = 0; i1 < up1; i1++) {
154  int up2 = std::min(n2.at(i1), z.getN2().at(i1));
155  res.push_back(std::vector<vector<complex> >(up2, z.Zero()));
156  for (int i2 = 0; i2 < up2; i2++)
157  for (int j1 = 0; j1 <= i1; j1++)
158  for (int j2 = 0; j2 <= i2; j2++)
159  res[i1][i2] += data[j1][j2] * z.getOrd(i2 - j2 + z.getMin2(), i1 - j1 + z.getMin1());
160  }
161  return Expanded<vector<complex> >(res, min2, min1);
162  }

◆ operator*() [5/17]

template<class T>
template<class Q >
std::enable_if< (isVec(T, double) && isVec(Q, complex)) || (isVec(T, complex) && isVec(Q, double)) || (isVec(T, complex) && isVec(Q, complex)), Expanded<complex> >::type Expanded< T >::operator* ( const Expanded< Q > &  z) const
inline

Definition at line 169 of file Expanded.h.

169  {
170  int min1 = minord1 + z.getMin1();
171  int min2 = minord2 + z.getMin2();
172  int up1 = std::min(n1, z.getN1());
173  std::vector<std::vector<complex> > res;
174  for (int i1 = 0; i1 < up1; i1++) {
175  int up2 = std::min(n2.at(i1), z.getN2().at(i1));
176  res.push_back(std::vector<complex>(up2, 0.));
177  for (int i2 = 0; i2 < up2; i2++)
178  for (int j1 = 0; j1 <= i1; j1++)
179  for (int j2 = 0; j2 <= i2; j2++)
180  res[i1][i2] += data[j1][j2] * z.getOrd(i2 - j2 + z.getMin2(), i1 - j1 + z.getMin1());
181  }
182  return Expanded<complex>(res, min2, min1);
183  }

◆ operator*() [6/17]

template<class T>
template<class Q >
std::enable_if< (isMat(T, double) && isSc(Q, complex)), Expanded<matrix<complex> > >::type Expanded< T >::operator* ( const Expanded< Q > &  z) const
inline

Definition at line 188 of file Expanded.h.

188  {
189  int min1 = minord1 + z.getMin1();
190  int min2 = minord2 + z.getMin2();
191  int up1 = std::min(n1, z.getN1());
192  std::vector<std::vector<matrix<complex> > > res;
193  for (int i1 = 0; i1 < up1; i1++) {
194  int up2 = std::min(n2.at(i1), z.getN2().at(i1));
195  res.push_back(std::vector<matrix<complex> >(up2, Zero()));
196  for (int i2 = 0; i2 < up2; i2++)
197  for (int j1 = 0; j1 <= i1; j1++)
198  for (int j2 = 0; j2 <= i2; j2++)
199  res[i1][i2] += data[j1][j2] * z.getOrd(i2 - j2 + z.getMin2(), i1 - j1 + z.getMin1());
200  }
201  return Expanded<matrix<complex> >(res, min2, min1);
202  }

◆ operator*() [7/17]

template<class T>
template<class Q >
std::enable_if< (isSc(T, complex) && isMat(Q, double)), Expanded<matrix<complex> > >::type Expanded< T >::operator* ( const Expanded< Q > &  z) const
inline

Definition at line 207 of file Expanded.h.

207  {
208  int min1 = minord1 + z.getMin1();
209  int min2 = minord2 + z.getMin2();
210  int up1 = std::min(n1, z.getN1());
211  std::vector<std::vector<matrix<complex> > > res;
212  for (int i1 = 0; i1 < up1; i1++) {
213  int up2 = std::min(n2.at(i1), z.getN2().at(i1));
214  res.push_back(std::vector<matrix<complex> >(up2, z.Zero()));
215  for (int i2 = 0; i2 < up2; i2++)
216  for (int j1 = 0; j1 <= i1; j1++)
217  for (int j2 = 0; j2 <= i2; j2++)
218  res[i1][i2] += data[j1][j2] * z.getOrd(i2 - j2 + z.getMin2(), i1 - j1 + z.getMin1());
219  }
220  return Expanded<matrix<complex> >(res, min2, min1);
221  }

◆ operator*() [8/17]

template<class T>
template<class Q >
std::enable_if< isVec(T, double) && isVec(Q, double), Expanded<double> >::type Expanded< T >::operator* ( const Expanded< Q > &  z) const
inline

Definition at line 226 of file Expanded.h.

226  {
227  int min1 = minord1 + z.getMin1();
228  int min2 = minord2 + z.getMin2();
229  int up1 = std::min(n1, z.getN1());
230  std::vector<std::vector<double> > res;
231  for (int i1 = 0; i1 < up1; i1++) {
232  int up2 = std::min(n2.at(i1), z.getN2().at(i1));
233  res.push_back(std::vector<double>(up2, 0.));
234  for (int i2 = 0; i2 < up2; i2++)
235  for (int j1 = 0; j1 <= i1; j1++)
236  for (int j2 = 0; j2 <= i2; j2++)
237  res[i1][i2] += data[j1][j2] * z.getOrd(i2 - j2 + z.getMin2(), i1 - j1 + z.getMin1());
238  }
239  return Expanded<double>(res, min2, min1);
240  }

◆ operator*() [9/17]

template<class T>
template<class Q >
std::enable_if< (std::is_same<T, Q>::value && !isV(T)) || isSc(Q, double) || (!isS(T) && isMat(Q, double)) || ((isMat(T, complex) || isVec(T, complex)) && isS(Q)) || (isVec(T, complex) && isMat(Q, complex)) || (isV(T) && isSc(Q, double)) || (isMat(T, double) && isSc(Q, double)), Expanded<T> >::type Expanded< T >::operator* ( const Q &  z) const
inline

Definition at line 393 of file Expanded.h.

393  {
394  std::vector<std::vector<T> > res;
395  for (int i1 = 0; i1 < n1; i1++) {
396  res.push_back(std::vector<T>(n2.at(i1), Zero()));
397  for (int i2 = 0; i2 < n2.at(i1); i2++)
398  res[i1][i2] = data[i1][i2] * z;
399  }
400  return Expanded<T>(res, minord2, minord1);
401  }

◆ operator*() [10/17]

template<class T>
template<class Q >
std::enable_if< isVec(T, double) && isVec(Q, double), Expanded<double> >::type Expanded< T >::operator* ( const Q &  z) const
inline

Definition at line 408 of file Expanded.h.

408  {
409  std::vector<std::vector<double> > res;
410  for (int i1 = 0; i1 < n1; i1++) {
411  res.push_back(std::vector<double>(n2.at(i1), 0.));
412  for (int i2 = 0; i2 < n2.at(i1); i2++)
413  res[i1][i2] = data[i1][i2] * z;
414  }
415  return Expanded<double>(res, minord2, minord1);
416  }

◆ operator*() [11/17]

template<class T>
template<class Q >
std::enable_if< (isSc(T, double) && isSc(Q, complex)) || (isV(T) && isV(Q) && !(isVec(T, double) && isVec(Q, double))), Expanded<complex> >::type Expanded< T >::operator* ( const Q &  z) const
inline

Definition at line 424 of file Expanded.h.

424  {
425  std::vector<std::vector<complex> > res;
426  for (int i1 = 0; i1 < n1; i1++) {
427  res.push_back(std::vector<complex>(n2.at(i1), 0.));
428  for (int i2 = 0; i2 < n2.at(i1); i2++)
429  res[i1][i2] = data[i1][i2] * z;
430  }
431  return Expanded<complex>(res, minord2, minord1);
432  }

◆ operator*() [12/17]

template<class T>
template<class Q >
std::enable_if< isVec(Q, double) && (isSc(T, double) || isMat(T, double)), Expanded<vector<double> > >::type Expanded< T >::operator* ( const Q &  z) const
inline

Definition at line 438 of file Expanded.h.

438  {
439  std::vector<std::vector<vector<double> > > res;
440  for (int i1 = 0; i1 < n1; i1++) {
441  res.push_back(std::vector<vector<double> >(n2.at(i1), vector<double>(z.size(), 0.)));
442  for (int i2 = 0; i2 < n2.at(i1); i2++)
443  res[i1][i2] = data[i1][i2] * z;
444  }
445  return Expanded<vector<double> >(res, minord2, minord1);
446  }

◆ operator*() [13/17]

template<class T>
template<class Q >
std::enable_if< (isVec(Q, complex) && (isS(T) || isM(T))) || (isVec(Q, double) && (isSc(T, complex) || isMat(T, complex))), Expanded<vector<complex> > >::type Expanded< T >::operator* ( const Q &  z) const
inline

Definition at line 455 of file Expanded.h.

455  {
456  std::vector<std::vector<vector<complex> > > res;
457  for (int i1 = 0; i1 < n1; i1++) {
458  res.push_back(std::vector<vector<complex> >(n2.at(i1), vector<complex>(z.size(), 0.)));
459  for (int i2 = 0; i2 < n2.at(i1); i2++)
460  res[i1][i2] = data[i1][i2] * z;
461  }
462  return Expanded<vector<complex> >(res, minord2, minord1);
463  }

◆ operator*() [14/17]

template<class T>
template<class Q >
std::enable_if< isVec(T, double) && (isSc(Q, complex) || isMat(Q, complex)), Expanded<vector<complex> > >::type Expanded< T >::operator* ( const Q &  z) const
inline

Definition at line 468 of file Expanded.h.

468  {
469  std::vector<std::vector<vector<complex> > > res;
470  for (int i1 = 0; i1 < n1; i1++) {
471  res.push_back(std::vector<vector<complex> >(n2.at(i1), vector<complex>(data[0][0].size(), 0.)));
472  for (int i2 = 0; i2 < n2.at(i1); i2++)
473  res[i1][i2] = data[i1][i2] * z;
474  }
475  return Expanded<vector<complex> >(res, minord2, minord1);
476  }

◆ operator*() [15/17]

template<class T>
template<class Q >
std::enable_if< (isSc(T, double) && isMat(Q, double)), Expanded<matrix<double> > >::type Expanded< T >::operator* ( const Q &  z) const
inline

Definition at line 483 of file Expanded.h.

483  {
484  std::vector<std::vector<matrix<double> > > res;
485  for (int i1 = 0; i1 < n1; i1++) {
486  res.push_back(std::vector<matrix<double> >(n2.at(i1), matrix<double>(z.size_i(), z.size_j(), 0.)));
487  for (int i2 = 0; i2 < n2.at(i1); i2++)
488  res[i1][i2] = data[i1][i2] * z;
489  }
490  return Expanded<matrix<double> >(res, minord2, minord1);
491  }

◆ operator*() [16/17]

template<class T>
template<class Q >
std::enable_if< (isS(T) && isMat(Q, complex)) || (isSc(T, complex) && isMat(Q, double)) || (isMat(T, double) && isMat(Q, complex)), Expanded<matrix<complex> > >::type Expanded< T >::operator* ( const Q &  z) const
inline

Definition at line 500 of file Expanded.h.

500  {
501  std::vector<std::vector<matrix<complex> > > res;
502  for (int i1 = 0; i1 < n1; i1++) {
503  res.push_back(std::vector<matrix<complex> >(n2.at(i1), matrix<complex>(z.size_i(), z.size_j(), 0.)));
504  for (int i2 = 0; i2 < n2.at(i1); i2++)
505  res[i1][i2] = data[i1][i2] * z;
506  }
507  return Expanded<matrix<complex> >(res, minord2, minord1);
508  }

◆ operator*() [17/17]

template<class T>
template<class Q >
std::enable_if< isMat(T, double) && isSc(Q, complex), Expanded<matrix<complex> > >::type Expanded< T >::operator* ( const Q &  z) const
inline

Definition at line 513 of file Expanded.h.

513  {
514  std::vector<std::vector<matrix<complex> > > res;
515  for (int i1 = 0; i1 < n1; i1++) {
516  res.push_back(std::vector<matrix<complex> >(n2.at(i1), matrix<complex>(data[0][0].size_i(), data[0][0].size_j(), 0.)));
517  for (int i2 = 0; i2 < n2.at(i1); i2++)
518  res[i1][i2] = data[i1][i2] * z;
519  }
520  return Expanded<matrix<complex> >(res, minord2, minord1);
521  }

◆ operator+() [1/2]

template<class T>
template<class Q >
std::enable_if< sameType(T, Q) && isComp(T), Expanded<T> >::type Expanded< T >::operator+ ( const Expanded< Q > &  z) const
inline

Definition at line 247 of file Expanded.h.

247  {
248  int min1 = std::min(minord1, z.getMin1());
249  int min2 = std::min(minord2, z.getMin2());
250  int up1 = std::min(n1 + minord1, z.getN1() + z.getMin1()) - min1;
251  std::vector<std::vector<T> > res;
252  for (int i1 = 0; i1 < up1; i1++) {
253  int up2 = std::min(n2.at(i1) + minord2, z.getN2().at(i1) + z.getMin2()) - min2;
254  res.push_back(std::vector<T>(up2, z.Zero()));
255  for (int i2 = 0; i2 < up2; i2++) {
256  if (i1 + min1 >= minord1 && i2 + min2 >= minord2) res[i1][i2] += data[i1 + min1 - minord1][i2 + min2 - minord2];
257  if (i1 + min1 >= z.getMin1() && i2 + min2 >= z.getMin2()) res[i1][i2] += z.getOrd(i2 + min2, i1 + min1);
258  }
259  }
260  return Expanded<T>(res, min2, min1);
261  }

◆ operator+() [2/2]

template<class T>
template<class Q >
std::enable_if< sameType(T, Q) && !isComp(T), Expanded<Q> >::type Expanded< T >::operator+ ( const Expanded< Q > &  z) const
inline

Definition at line 266 of file Expanded.h.

266  {
267  int min1 = std::min(minord1, z.getMin1());
268  int min2 = std::min(minord2, z.getMin2());
269  int up1 = std::min(n1 + minord1, z.getN1() + z.getMin1()) - min1;
270  std::vector<std::vector<Q> > res;
271  for (int i1 = 0; i1 < up1; i1++) {
272  int up2 = std::min(n2.at(i1) + minord2, z.getN2().at(i1) + z.getMin2()) - min2;
273  res.push_back(std::vector<Q>(up2, z.Zero()));
274  for (int i2 = 0; i2 < up2; i2++) {
275  if (i1 + min1 >= minord1 && i2 + min2 >= minord2) res[i1][i2] += data[i1 + min1 - minord1][i2 + min2 - minord2];
276  if (i1 + min1 >= z.getMin1() && i2 + min2 >= z.getMin2()) res[i1][i2] += z.getOrd(i2 + min2, i1 + min1);
277  }
278  }
279  return Expanded<Q>(res, min2, min1);
280  }

◆ operator-() [1/3]

template<class T>
Expanded<T> Expanded< T >::operator- ( ) const
inline

Definition at line 326 of file Expanded.h.

326  {
327  std::vector<std::vector<T> > res;
328  for (int i1 = 0; i1 < n1; i1++) {
329  res.push_back(std::vector<T>(n2.at(i1), Zero()));
330  for (int i2 = 0; i2 < n2.at(i1); i2++)
331  res[i1][i2] = -data[i1][i2];
332  }
333  return Expanded<T>(res, minord2, minord1);
334  }

◆ operator-() [2/3]

template<class T>
template<class Q >
std::enable_if< sameType(T, Q) && isComp(T), Expanded<T> >::type Expanded< T >::operator- ( const Expanded< Q > &  z) const
inline

Definition at line 287 of file Expanded.h.

287  {
288  int min1 = std::min(minord1, z.getMin1());
289  int min2 = std::min(minord2, z.getMin2());
290  int up1 = std::min(n1 + minord1, z.getN1() + z.getMin1()) - min1;
291  std::vector<std::vector<T> > res;
292  for (int i1 = 0; i1 < up1; i1++) {
293  int up2 = std::min(n2.at(i1) + minord2, z.getN2().at(i1) + z.getMin2()) - min2;
294  res.push_back(std::vector<T>(up2, z.Zero()));
295  for (int i2 = 0; i2 < up2; i2++) {
296  if (i1 + min1 >= minord1 && i2 + min2 >= minord2) res[i1][i2] += data[i1 + min1 - minord1][i2 + min2 - minord2];
297  if (i1 + min1 >= z.getMin1() && i2 + min2 >= z.getMin2()) res[i1][i2] -= z.getOrd(i2 + min2, i1 + min1);
298  }
299  }
300  return Expanded<T>(res, min2, min1);
301  }

◆ operator-() [3/3]

template<class T>
template<class Q >
std::enable_if< sameType(T, Q) && !isComp(T), Expanded<Q> >::type Expanded< T >::operator- ( const Expanded< Q > &  z) const
inline

Definition at line 306 of file Expanded.h.

306  {
307  int min1 = std::min(minord1, z.getMin1());
308  int min2 = std::min(minord2, z.getMin2());
309  int up1 = std::min(n1 + minord1, z.getN1() + z.getMin1()) - min1;
310  std::vector<std::vector<Q> > res;
311  for (int i1 = 0; i1 < up1; i1++) {
312  int up2 = std::min(n2.at(i1) + minord2, z.getN2().at(i1) + z.getMin2()) - min2;
313  res.push_back(std::vector<Q>(up2, z.Zero()));
314  for (int i2 = 0; i2 < up2; i2++) {
315  if (i1 + min1 >= minord1 && i2 + min2 >= minord2) res[i1][i2] += data[i1 + min1 - minord1][i2 + min2 - minord2];
316  if (i1 + min1 >= z.getMin1() && i2 + min2 >= z.getMin2()) res[i1][i2] -= z.getOrd(i2 + min2, i1 + min1);
317  }
318  }
319  return Expanded<Q>(res, min2, min1);
320  }

◆ operator/() [1/9]

template<class T>
Expanded<T> Expanded< T >::operator/ ( const double &  z) const
inline

Definition at line 528 of file Expanded.h.

528  {
529  std::vector<std::vector<T> > res;
530  for (int i1 = 0; i1 < n1; i1++) {
531  res.push_back(std::vector<T>(n2.at(i1), Zero()));
532  for (int i2 = 0; i2 < n2.at(i1); i2++)
533  res[i1][i2] = data[i1][i2] / z;
534  }
535  return Expanded<T>(res, minord2, minord1);
536  }

◆ operator/() [2/9]

template<class T>
template<class Q >
std::enable_if< isSc(Q,double) , Expanded<T> >::type Expanded< T >::operator/ ( const Expanded< Q > &  z) const
inline

Definition at line 338 of file Expanded.h.

338  {
339  return (*this)*z.inverse();
340  }

◆ operator/() [3/9]

template<class T>
template<class Q >
std::enable_if< isSc(Q,complex) && isS(T) , Expanded<complex> >::type Expanded< T >::operator/ ( const Expanded< Q > &  z) const
inline

Definition at line 344 of file Expanded.h.

344  {
345  return (*this)*z.inverse();
346  }

◆ operator/() [4/9]

template<class T>
template<class Q >
std::enable_if< isSc(Q,complex) && isV(T) , Expanded<vector<complex> > >::type Expanded< T >::operator/ ( const Expanded< Q > &  z) const
inline

Definition at line 350 of file Expanded.h.

350  {
351  return (*this)*z.inverse();
352  }

◆ operator/() [5/9]

template<class T>
template<class Q >
std::enable_if< isSc(Q,complex) && isM(T) , Expanded<matrix<complex> > >::type Expanded< T >::operator/ ( const Expanded< Q > &  z) const
inline

Definition at line 356 of file Expanded.h.

356  {
357  return (*this)*z.inverse();
358  }

◆ operator/() [6/9]

template<class T>
template<class Q >
std::enable_if<isComp(T) && isSc(Q, complex), Expanded<T> >::type Expanded< T >::operator/ ( const Q &  z) const
inline

Definition at line 540 of file Expanded.h.

540  {
541  std::vector<std::vector<T> > res;
542  for (int i1 = 0; i1 < n1; i1++) {
543  res.push_back(std::vector<T>(n2.at(i1), Zero()));
544  for (int i2 = 0; i2 < n2.at(i1); i2++)
545  res[i1][i2] = data[i1][i2] / z;
546  }
547  return Expanded<T>(res, minord2, minord1);
548  }

◆ operator/() [7/9]

template<class T>
template<class Q >
std::enable_if<isSc(T, double) && isSc(Q, complex), Expanded<complex > >::type Expanded< T >::operator/ ( const Q &  z) const
inline

Definition at line 552 of file Expanded.h.

552  {
553  std::vector<std::vector<complex> > res;
554  for (int i1 = 0; i1 < n1; i1++) {
555  res.push_back(std::vector<complex>(n2.at(i1), 0.));
556  for (int i2 = 0; i2 < n2.at(i1); i2++)
557  res[i1][i2] = data[i1][i2] / z;
558  }
559  return Expanded<complex>(res, minord2, minord1);
560  }

◆ operator/() [8/9]

template<class T>
template<class Q >
std::enable_if<isVec(T, double) && isSc(Q, complex), Expanded<vector<complex> > >::type Expanded< T >::operator/ ( const Q &  z) const
inline

Definition at line 564 of file Expanded.h.

564  {
565  std::vector<std::vector<vector<complex> > > res;
566  for (int i1 = 0; i1 < n1; i1++) {
567  res.push_back(std::vector<vector<complex> >(n2.at(i1), vector<complex>(data[0][0].size(), 0.)));
568  for (int i2 = 0; i2 < n2.at(i1); i2++)
569  res[i1][i2] = data[i1][i2] / z;
570  }
571  return Expanded<vector<complex> >(res, minord2, minord1);
572  }

◆ operator/() [9/9]

template<class T>
template<class Q >
std::enable_if<isMat(T, double) && isSc(Q, complex), Expanded<matrix<complex> > >::type Expanded< T >::operator/ ( const Q &  z) const
inline

Definition at line 576 of file Expanded.h.

576  {
577  std::vector<std::vector<matrix<complex> > > res;
578  for (int i1 = 0; i1 < n1; i1++) {
579  res.push_back(std::vector<matrix<complex> >(n2.at(i1), matrix<complex>(data[0][0].size_i(), data[0][0].size_j(), 0.)));
580  for (int i2 = 0; i2 < n2.at(i1); i2++)
581  res[i1][i2] = data[i1][i2] / z;
582  }
583  return Expanded<matrix<complex> >(res, minord2, minord1);
584  }

◆ operator==()

template<class T>
bool Expanded< T >::operator== ( const Expanded< T > &  z) const
inline

Definition at line 360 of file Expanded.h.

360  {
361 
362  if (minord1 != z.getMin1() || minord2 != z.getMin2() || n1 != z.getN1()) return false;
363 
364  for (int i1 = 0; i1 < n1; i1++)
365  {
366  if(n2.at(i1) != z.getN2().at(i1)) return false;
367  for (int i2 = 0; i2 < n2.at(i1); i2++)
368  if (z.getOrd(i2 + z.getMin2(), i1 + z.getMin1()) != data[i1][i2]) return false;
369  }
370 
371  return true;
372  }

◆ real() [1/3]

template<>
Expanded< double > Expanded< complex >::real ( ) const

Definition at line 94 of file Expanded.cpp.

95 {
96  std::vector<std::vector<double> > res;
97  for (int i = 0; i < n1; i++)
98  {
99  res.push_back(std::vector<double>(n2.at(i), 0.));
100  for (int j = 0; j < n2.at(i); j++)
101  res[i][j] = data[i][j].real();
102  }
103  return Expanded<double>(res, minord2, minord1);
104 }

◆ real() [2/3]

template<class T>
Expanded<double> Expanded< T >::real ( ) const

Method to return the real part of a complex Expanded.

Returns
the real part of this Expanded

◆ real() [3/3]

template<>
Expanded< double > Expanded< complex >::real ( ) const

◆ Series() [1/2]

template<class T>
T Expanded< T >::Series ( int  ord2,
double  als2 = 1. 
)
inline

Method to sum an expansion up to a given order.

Parameters
[in]ord2a int with the maximum order of the expansion in the sum.
[in]als2a double with the value of the expansion parameter. Default to 1.
Returns
a instance of a class T containing the expansion summed to the requested orders.

Definition at line 677 of file Expanded.h.

677  {
678  return Series(std::vector<int> (1, ord2), 0, als2);
679  }

◆ Series() [2/2]

template<class T>
T Expanded< T >::Series ( std::vector< int >  ord2,
int  ord1,
double  als2 = 1.,
double  als1 = 1. 
)
inline

Method to sum a double expansion up to a given order.

Parameters
[in]ord2a std::vector<int> with the maximum order of the inner expansion in the sum.
[in]ord1a int with the maximum order of the outer expansion in the sum.
[in]als2a double with the value of the inner expansion parameter. Default to 1.
[in]als1a double with the value of the outer expansion parameter. Default to 1.
Returns
a instance of a class T containing the expansion summed to the requested orders.

Definition at line 657 of file Expanded.h.

657  {
658  T res;
659  if (ord1 >= minord1)
660  {
661  for (int i = 0; i <= std::min(n1, ord1 - minord1); i++)
662  {
663  if (ord2.at(i) >= minord2)
664  for (int j = 0; j <= std::min(ord2.at(i) - minord2, n2.at(i)); j++)
665  res += data[i][j] * pow(als1, (double) (minord1 + i)) * pow(als2, (double) (minord2 + j));
666  }
667  }
668  return res;
669  }

◆ setMatrixElement() [1/2]

template<class T>
template<class Q >
std::enable_if<isMat(T, Q), void>::type Expanded< T >::setMatrixElement ( int  j,
int  h,
int  k,
x 
)
inline

Set an element of a matrix in a single Expanded<matrix<*> >

Parameters
[in]jorder in the inner expansion of the matrix whose element has to be set.
[in]hrow index of the element to be set in the matrix.
[in]kcolumn index of the element to be set in the matrix.
[in]xvalue to be assigned.

Definition at line 753 of file Expanded.h.

753  {
754  setMatrixElement(j, minord1, h, k, x);
755  }

◆ setMatrixElement() [2/2]

template<class T>
template<class Q >
std::enable_if<isMat(T, Q), void>::type Expanded< T >::setMatrixElement ( int  j,
int  i,
int  h,
int  k,
x 
)
inline

Set an element of a matrix in a double Expanded<matrix<*> >

Parameters
[in]jorder in the inner expansion of the matrix whose element has to be set.
[in]iorder in the outer expansion of the matrix whose element has to be set.
[in]hrow index of the element to be set in the matrix.
[in]kcolumn index of the element to be set in the matrix.
[in]xvalue to be assigned.

Definition at line 741 of file Expanded.h.

741  {
742  checkOrd(j, i, "Expanded::setMatrixElement(): order non present in Expanded");
743  data[i - minord1][j - minord2].assign(h, k, x);
744  }

◆ setOrd() [1/2]

template<class T>
void Expanded< T >::setOrd ( int  j,
int  i,
value 
)
inline

Set an element of a double expansion.

Parameters
[in]jorder of the element to be set in the inner expansion.
[in]iorder of the element to be set in the outer expansion.

Definition at line 722 of file Expanded.h.

722  {
723  checkOrd(j, i, "Expanded::setOrd(): order non present in Expanded");
724  data[i - minord1][j - minord2] = value;
725  }

◆ setOrd() [2/2]

template<class T>
void Expanded< T >::setOrd ( int  j,
value 
)
inline

Set an element of a single expansion.

Parameters
[in]jorder of the element to be set.

Definition at line 713 of file Expanded.h.

713  {
714  setOrd(j, minord1, value);
715  }

◆ setVectorElement() [1/2]

template<class T>
template<class Q >
std::enable_if<isVec(T, Q), void>::type Expanded< T >::setVectorElement ( int  j,
int  h,
x 
)
inline

Set an element of a matrix in a single Expanded<vector<*> >

Parameters
[in]jorder in the inner expansion of the vector whose element has to be set.
[in]hindex of the element to be set in the vector.
[in]xvalue to be assigned.

Definition at line 779 of file Expanded.h.

779  {
780  setVectorElement(j, minord1, h, x);
781  }

◆ setVectorElement() [2/2]

template<class T>
template<class Q >
std::enable_if<isVec(T, Q), void>::type Expanded< T >::setVectorElement ( int  j,
int  i,
int  h,
x 
)
inline

Set an element of a matrix in a double Expanded<vector<*> >

Parameters
[in]jorder in the inner expansion of the vector whose element has to be set.
[in]iorder in the outer expansion of the vector whose element has to be set.
[in]hindex of the element to be set in the vector.
[in]xvalue to be assigned.

Definition at line 765 of file Expanded.h.

765  {
766  checkOrd(j, i, "Expanded::setVectorElement(): order non present in Expanded");
767  //THERE IS NO ASSIGN METHOD FOR VECTORS
768  //data[i - minord1][j - minord2].assign(h, x);
769  data[i - minord1][j - minord2](h) = x;
770  }

◆ transpose() [1/5]

template<>
Expanded< matrix< double > > Expanded< matrix< double > >::transpose ( ) const

Definition at line 70 of file Expanded.cpp.

71 {
72  std::vector<std::vector<matrix<double> > > res;
73  for (int i1 = 0; i1 < n1; i1++)
74  {
75  res.push_back(std::vector<matrix<double> >(n2.at(i1), matrix<double>(data[0][0].size_i(), data[0][0].size_j(), 0.)));
76  for (int i2 = 0; i2 < n2.at(i1); i2++)
77  res[i1][i2] = data[i1][i2].transpose();
78  }
80 }

◆ transpose() [2/5]

template<>
Expanded< matrix< complex > > Expanded< matrix< complex > >::transpose ( ) const

Definition at line 82 of file Expanded.cpp.

83 {
84  std::vector<std::vector<matrix<complex> > > res;
85  for (int i1 = 0; i1 < n1; i1++)
86  {
87  res.push_back(std::vector<matrix<complex> >(n2.at(i1), matrix<complex>(data[0][0].size_i(), data[0][0].size_j(), 0.)));
88  for (int i2 = 0; i2 < n2.at(i1); i2++)
89  res[i1][i2] = data[i1][i2].transpose();
90  }
92 }

◆ transpose() [3/5]

template<class T>
Expanded<T> Expanded< T >::transpose ( ) const

Method to transpose a Expanded<matrix<double> > or a Expanded<matrix<complex> >.

Returns
the transpose of this Expanded<matrix<*> >.

◆ transpose() [4/5]

template<>
Expanded< matrix< double > > Expanded< matrix< double > >::transpose ( ) const

◆ transpose() [5/5]

template<>
Expanded< matrix< complex > > Expanded< matrix< complex > >::transpose ( ) const

◆ truncate() [1/2]

template<class T>
Expanded<T> Expanded< T >::truncate ( int  n2max)
inline

Method to truncate a single expansion.

Parameters
[in]n2maxa int with the maximum order of the expansion.
Returns
a new Expanded<T> with the truncated expansion.

Definition at line 643 of file Expanded.h.

643  {
644  if(n1 >= 1 || minord1 > 0)
645  throw std::runtime_error("Expanded::truncate(): wrong method, please use truncate(std::vector<int>, int)");
646  return truncate(std::vector<int>(1, n2max), 0);
647  }

◆ truncate() [2/2]

template<class T>
Expanded<T> Expanded< T >::truncate ( std::vector< int >  n2max,
int  n1max 
)
inline

Method to truncate a double expansion.

Parameters
[in]n2maxa std::vector<int> with the maximum order of the inner expansion. n1max + 1 entries have to be provided.
[in]n1maxa int with the maximum order of the outer expansion.
Returns
a new Expanded<T> with the truncated expansion.

Definition at line 624 of file Expanded.h.

624  {
625  if (n1max < minord1 || n1max >= minord1 + n1)
626  throw std::runtime_error("Expanded::truncate(): order of the outer expansion not present in Expanded");
627  std::vector<std::vector<T> > res;
628  for (int i1 = 0; i1 <= n1max - minord1; i1++) {
629  std::vector<T> tmp;
630  if (n2max.at(i1) >= minord2 + n2.at(i1))
631  throw std::runtime_error("Expanded::truncate(): order of the inner expansion not present in Expanded");
632  for (int j1 = 0; j1 <= n2max.at(i1) - minord2; j1++)
633  tmp.push_back(data[i1][j1]);
634  res.push_back(tmp);
635  }
636  return Expanded<T>(res, minord2, minord1);
637  }

◆ Zero() [1/9]

template<>
matrix< double > Expanded< matrix< double > >::Zero ( ) const

Definition at line 112 of file Expanded.cpp.

113 {
114  int id, jd;
115  id = data[0][0].size_i();
116  jd = data[0][0].size_j();
117  return matrix<double>(id, jd, 0.);
118 }

◆ Zero() [2/9]

template<>
matrix< complex > Expanded< matrix< complex > >::Zero ( ) const

Definition at line 121 of file Expanded.cpp.

122 {
123  int id, jd;
124  id = data[0][0].size_i();
125  jd = data[0][0].size_j();
126  return matrix<complex>(id, jd, 0.);
127 }

◆ Zero() [3/9]

template<>
vector< double > Expanded< vector< double > >::Zero ( ) const

Definition at line 130 of file Expanded.cpp.

131 {
132  int id;
133  id = data[0][0].size();
134  return vector<double>(id, 0.);
135 }

◆ Zero() [4/9]

template<>
vector< complex > Expanded< vector< complex > >::Zero ( ) const

Definition at line 138 of file Expanded.cpp.

139 {
140  int id;
141  id = data[0][0].size();
142  return vector<complex>(id, 0.);
143 }

◆ Zero() [5/9]

template<class T>
T Expanded< T >::Zero ( ) const
inline

Return an empty instance of class T.

Returns
An empty instance of class T.

Definition at line 685 of file Expanded.h.

685  {
686  return T();
687  }

◆ Zero() [6/9]

template<>
matrix< double > Expanded< matrix< double > >::Zero ( ) const

◆ Zero() [7/9]

template<>
matrix< complex > Expanded< matrix< complex > >::Zero ( ) const

◆ Zero() [8/9]

template<>
vector< double > Expanded< vector< double > >::Zero ( ) const

◆ Zero() [9/9]

template<>
vector< complex > Expanded< vector< complex > >::Zero ( ) const

Friends And Related Function Documentation

◆ operator*

template<class T>
Expanded<T> operator* ( const double &  ue,
const Expanded< T > &  ex 
)
friend

Definition at line 588 of file Expanded.h.

588  {
589  return (ex * ue);
590  }

◆ operator<<

template<class T>
std::ostream& operator<< ( std::ostream &  output,
const Expanded< T >  z 
)
friend

Definition at line 816 of file Expanded.h.

816  {
817  for (int i = 0; i < z.getN1(); i++)
818  for (int j = 0; j < z.getN2().at(i); j++) {
819  output << "Order (" << z.getMin2() + j << "," << z.getMin1() + i << "): " << z.getOrd(j + z.getMin2(), i + z.getMin1());
820  if (i != (z.getN1() - 1) || j != (z.getN2().at(i) - 1))
821  output << std::endl;
822  }
823  return output;
824  }

Member Data Documentation

◆ data

template<class T>
std::vector<std::vector<T> > Expanded< T >::data
private

Definition at line 838 of file Expanded.h.

◆ minord1

template<class T>
int Expanded< T >::minord1
private

Definition at line 836 of file Expanded.h.

◆ minord2

template<class T>
int Expanded< T >::minord2
private

Definition at line 836 of file Expanded.h.

◆ n1

template<class T>
int Expanded< T >::n1
private

Definition at line 836 of file Expanded.h.

◆ n2

template<class T>
std::vector<int> Expanded< T >::n2
private

Definition at line 837 of file Expanded.h.


The documentation for this class was generated from the following files:
Expanded::real
Expanded< double > real() const
Method to return the real part of a complex Expanded.
Expanded::getOrd
const T & getOrd(int j) const
Get an element of a single expansion.
Definition: Expanded.h:694
gslpp::vector< complex >
A class for constructing and defining operations on complex vectors.
Definition: gslpp_vector_complex.h:33
Expanded::setMatrixElement
std::enable_if< isMat(T, Q), void >::type setMatrixElement(int j, int i, int h, int k, Q x)
Set an element of a matrix in a double Expanded<matrix<*> >
Definition: Expanded.h:741
Expanded::n2
std::vector< int > n2
Definition: Expanded.h:837
gslpp::matrix< double >
A class for constructing and defining operations on real matrices.
Definition: gslpp_matrix_double.h:48
Expanded::getMin2
const int getMin2() const
Get the minimum order of the inner expansion.
Definition: Expanded.h:795
Expanded::conjugate
Expanded< T > conjugate() const
Method to return the conjugate value of a Expanded<complex>.
Expanded::getN1
const int getN1() const
Get the number of terms in the outer expansion.
Definition: Expanded.h:803
Expanded::transpose
Expanded< T > transpose() const
Method to transpose a Expanded<matrix<double> > or a Expanded<matrix<complex> >.
Expanded::minord2
int minord2
Definition: Expanded.h:836
Expanded::Series
T Series(std::vector< int > ord2, int ord1, double als2=1., double als1=1.)
Method to sum a double expansion up to a given order.
Definition: Expanded.h:657
Expanded::minord1
int minord1
Definition: Expanded.h:836
gslpp::pow
complex pow(const complex &z1, const complex &z2)
Definition: gslpp_complex.cpp:395
Expanded
A template class for Taylor double expansion of several objects.
Definition: Expanded.h:55
Expanded::getMin1
const int getMin1() const
Get the minimum order of the outer expansion.
Definition: Expanded.h:787
Expanded::truncate
Expanded< T > truncate(std::vector< int > n2max, int n1max)
Method to truncate a double expansion.
Definition: Expanded.h:624
Expanded::setOrd
void setOrd(int j, T value)
Set an element of a single expansion.
Definition: Expanded.h:713
gslpp::vector< double >
A class for constructing and defining operations on real vectors.
Definition: gslpp_vector_double.h:33
Expanded::n1
int n1
Definition: Expanded.h:836
Expanded::inverse
Expanded< T > inverse() const
Definition: Expanded.h:322
Expanded::getN2
const std::vector< int > & getN2() const
Get the number of terms in the inner expansion.
Definition: Expanded.h:812
Expanded::data
std::vector< std::vector< T > > data
Definition: Expanded.h:838
Expanded::setVectorElement
std::enable_if< isVec(T, Q), void >::type setVectorElement(int j, int i, int h, Q x)
Set an element of a matrix in a double Expanded<vector<*> >
Definition: Expanded.h:765
Expanded::checkOrd
void checkOrd(int j, int i, std::string s) const
Definition: Expanded.h:727
Expanded::invCoeff
T invCoeff(int i, int j) const
Return the (i-th, j-th) coefficient of the expansion of 1/Expanded.
Definition: Expanded.h:832
Expanded::Zero
T Zero() const
Return an empty instance of class T.
Definition: Expanded.h:685
gslpp::matrix< complex >
A class for constructing and defining operations on complex matrices.
Definition: gslpp_matrix_complex.h:45