18 #ifndef itkMultivariateLegendrePolynomial_h
19 #define itkMultivariateLegendrePolynomial_h
25 #include "ITKPolynomialsExport.h"
105 {
return m_Dimension; }
118 {
return m_NumberOfCoefficients; }
122 {
return m_DomainSize; }
133 m_Required = required;
158 if ( m_Dimension == 2 )
160 if ( index[1] != m_PrevY )
163 double norm_y = m_NormFactor[1]
164 *
static_cast< double >( index[1] - 1 );
165 this->CalculateXCoef(norm_y, m_CoefficientArray);
171 double norm_x = m_NormFactor[0]
172 *
static_cast< double >( index[0] - 1 );
174 return LegendreSum(norm_x, m_Degree, m_CachedXCoef);
176 else if ( m_Dimension == 3 )
178 if ( index[2] != m_PrevZ )
181 double norm_z = m_NormFactor[2]
182 *
static_cast< double >( index[2] - 1 );
183 this->CalculateYCoef(norm_z, m_CoefficientArray);
187 if ( index[1] != m_PrevY )
190 double norm_y = m_NormFactor[1]
191 *
static_cast< double >( index[1] - 1 );
192 this->CalculateXCoef(norm_y, m_CachedYCoef);
197 double norm_x = m_NormFactor[0]
198 *
static_cast< double >( index[0] - 1 );
199 return this->LegendreSum(norm_x, m_Degree, m_CachedXCoef);
205 unsigned int GetNumberOfCoefficients();
208 unsigned int GetNumberOfCoefficients(
unsigned int dimension,
unsigned int degree);
220 m_MultivariateLegendrePolynomial(polynomial),
221 m_Dimension (m_MultivariateLegendrePolynomial->GetDimension()),
222 m_DomainSize (m_MultivariateLegendrePolynomial->GetDomainSize()),
225 m_Index.resize(m_Dimension);
226 std::fill(m_Index.begin(), m_Index.end(), 0);
232 for (
unsigned int dim = 0; dim < m_Dimension; dim++ )
239 {
return m_IsAtEnd; }
243 for (
unsigned int dim = 0; dim < m_Dimension; dim++ )
245 if ( m_Index[dim] < static_cast< int >( m_DomainSize[dim] - 1 ) )
252 if ( dim == m_Dimension - 1 )
267 {
return m_MultivariateLegendrePolynomial->Evaluate(m_Index); }
277 void Print(std::ostream & os);
280 void PrintSelf(std::ostream & os,
Indent indent)
const;
282 double LegendreSum(
const double x,
int n,
306 ITKPolynomials_EXPORT std::ostream &
operator<<(std::ostream & os,
DomainSizeType m_DomainSize
signed long IndexValueType
unsigned int GetDegree(void) const
MultivariateLegendrePolynomial * m_MultivariateLegendrePolynomial
DomainSizeType m_DomainSize
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
double Evaluate(IndexType &index)
Array< double > ParametersType
CoefficientArrayType m_CachedYCoef
MultivariateLegendrePolynomial Self
CoefficientArrayType m_CachedZCoef
SimpleForwardIterator(MultivariateLegendrePolynomial *polynomial)
unsigned int GetDimension(void) const
const DomainSizeType & GetDomainSize(void) const
2D and 3D multivariate Legendre Polynomial
CoefficientArrayType m_CoefficientArray
DoubleArrayType m_NormFactor
std::vector< unsigned long > ULongArrayType
std::vector< double > DoubleArrayType
unsigned int m_NumberOfCoefficients
unsigned int GetNumberOfCoefficients(void) const
CoefficientArrayType m_CachedXCoef
std::vector< long > LongArrayType
SimpleForwardIterator & operator++()
Control indentation during Print() invocation.
DoubleArrayType CoefficientArrayType
ULongArrayType DomainSizeType
Iterator which only supports forward iteration and Begin(), IsAtEnd(), and Get() method which work ju...
CoefficientVectorSizeMismatch(int given, int required)