Changeset 998

Show
Ignore:
Timestamp:
11/01/08 09:13:04 (2 months ago)
Author:
lebrun
Message:

Enhanced EnumerateFunction class.
Changed the computation of the computeKurtosisPerComponent() method of the NumericalSample class in order to be consistent with the getKurtosis() method of the Distribution class.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/chaos/lib/src/Base/Stat/NumericalSampleImplementation.cxx

    r968 r998  
    630630        const NumericalScalar factor1 = 1.0 / (static_cast<NumericalScalar>(size) - 1.0); 
    631631        for (UnsignedLong i = 0; i < dimension; ++i) { 
    632           // kurtosis = 1 / size sum (Xi - Xmean)^4 / (var/(size-1))^2 - 3 
     632          // kurtosis = 1 / size sum (Xi - Xmean)^4 / (var/(size-1))^2 
    633633          kurtosis[i] *= factor * pow(var[i] * factor1, -2); 
    634           kurtosis[i] -= 3.0; 
    635634        } 
    636635        return kurtosis; 
  • branches/chaos/lib/src/Uncertainty/Algorithm/OrthogonalBasis/EnumerateFunction.cxx

    r889 r998  
    9696      } 
    9797 
    98       /* The bijective association between an integer and a set of indices */ 
    99       EnumerateFunction::Indices EnumerateFunction::operator() (UnsignedLong index) const 
     98      /* The bijective association between an integer and a set of indices. 
     99         First, we look for the total degree of the associated polynom. Then, we 
     100         compute recursively the complement by looping over the degree of the remainder. 
     101       */ 
     102      EnumerateFunction::Indices EnumerateFunction::operator() (const UnsignedLong index) const 
    100103      { 
    101104        Indices result(dimension_, 0); 
     
    113116              } 
    114117            index -= binomialCoefficient; 
    115             UnsignedLong remainingDegree(findBinomialCoefficient(index, dimension_ - i - 1, binomialCoefficient)); 
     118            const UnsignedLong remainingDegree(findBinomialCoefficient(index, dimension_ - i - 1, binomialCoefficient)); 
    116119            result[i] = degree - remainingDegree; 
    117120            degree = remainingDegree; 
     
    121124      } 
    122125 
     126      /* The inverse of the association */ 
     127      UnsignedLong EnumerateFunction::inverse(const Indices indices) const 
     128      { 
     129        UnsignedLong totalDegree(0); 
     130        for (UnsignedLong i = 0; i < dimension_; ++i) totalDegree += indices[i]; 
     131        UnsignedLong result(getStrateCumulatedCardinal(totalDegree)); 
     132        for (UnsignedLong i = 0; i < dimension_ - 1; i++) 
     133          { 
     134            // Accumulate the partial degree of the lower dimensional polynomials 
     135          } 
     136        return 0; 
     137      } 
     138       
     139      /* The cardinal of the given strate */ 
     140      UnsignedLong EnumerateFunction::getStrateCardinal(const UnsignedLong strateIndex) const 
     141      { 
     142        return static_cast<UnsignedLong>(round(exp(SpecFunc::LnGamma(dimension_ + strateIndex) - SpecFunc::LnGamma(dimension_) - SpecFunc::LnGamma(strateIndex + 1)))); 
     143      } 
     144       
     145      /* The cardinal of the cumulated strate above or equal to the given strate */ 
     146      UnsignedLong EnumerateFunction::getStrateCumulatedCardinal(const UnsignedLong strateIndex) const 
     147      { 
     148        return static_cast<UnsignedLong>(round(exp(SpecFunc::LnGamma(dimension_ + strateIndex + 1) - SpecFunc::LnGamma(dimension_ + 1) - SpecFunc::LnGamma(strateIndex + 1)))); 
     149      } 
     150  
    123151 
    124152      /* Dimension accessor */ 
  • branches/chaos/lib/src/Uncertainty/Algorithm/OrthogonalBasis/EnumerateFunction.hxx

    r889 r998  
    6868 
    6969        /** The bijective association between an integer and a set of indices */ 
    70         virtual Indices operator() (UnsignedLong index) const; 
     70        virtual Indices operator() (const UnsignedLong index) const; 
    7171 
     72        /** The inverse of the association */ 
     73        virtual UnsignedLong inverse(const Indices indices) const; 
     74 
     75        /** The cardinal of the given strate */ 
     76        virtual UnsignedLong getStrateCardinal(const UnsignedLong strateIndex) const; 
     77 
     78        /** The cardinal of the cumulated strate above or equal to the given strate */ 
     79        virtual UnsignedLong getStrateCumulatedCardinal(const UnsignedLong strateIndex) const; 
     80  
    7281        /** Dimension accessor */ 
    7382        void setDimension(const UnsignedLong dimension);