~ubuntu-branches/ubuntu/maverick/openturns/maverick

« back to all changes in this revision

Viewing changes to lib/src/Base/Stat/CovarianceMatrix.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2010-05-10 17:27:55 UTC
  • mfrom: (1.1.4 upstream) (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100510172755-cb5ynskknqqi5rhp
Tags: 0.13.2-2ubuntu1
* Merge with Debian testing. No changes left.
* ubuntu_fix-python-2.6.patch: fix detection of python 2.6 libs, to not use
  LOCALMODLIBS. This pulls a dependency on SSL and makes the package FTBFS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *  @file  CovarianceMatrix.cxx
4
4
 *  @brief The class CovarianceMatrix implements blank free samples
5
5
 *
6
 
 *  (C) Copyright 2005-2007 EDF-EADS-Phimeca
 
6
 *  (C) Copyright 2005-2010 EDF-EADS-Phimeca
7
7
 *
8
8
 *  This library is free software; you can redistribute it and/or
9
9
 *  modify it under the terms of the GNU Lesser General Public
20
20
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21
21
 *
22
22
 *  @author: $LastChangedBy: dutka $
23
 
 *  @date:   $LastChangedDate: 2009-05-28 14:47:53 +0200 (jeu. 28 mai 2009) $
24
 
 *  Id:      $Id: CovarianceMatrix.cxx 1262 2009-05-28 12:47:53Z dutka $
 
23
 *  @date:   $LastChangedDate: 2010-02-04 16:44:49 +0100 (jeu. 04 févr. 2010) $
 
24
 *  Id:      $Id: CovarianceMatrix.cxx 1473 2010-02-04 15:44:49Z dutka $
25
25
 */
26
26
#include "CovarianceMatrix.hxx"
27
27
 
44
44
      }
45
45
      
46
46
      /* Constructor with size (dim, which is the same for nbRows_ and nbColumns_ )*/
47
 
      CovarianceMatrix::CovarianceMatrix(UnsignedLong dim)
 
47
      CovarianceMatrix::CovarianceMatrix(const UnsignedLong dim)
48
48
        : SymmetricMatrix(dim)
49
49
      {
50
 
        // Nothing to do
 
50
        // Initialize the correlation matrix to the identity matrix
 
51
        for(UnsignedLong i = 0; i < dim; ++i)
 
52
          operator()(i, i) = 1.0;
51
53
      }
52
54
      
53
55
      /* Constructor from external collection */
54
56
      /* If the dimensions of the matrix and of the collection */
55
57
      /* do not match, either the collection is truncated */
56
58
      /* or the rest of the matrix is filled with zeros */
57
 
      CovarianceMatrix::CovarianceMatrix(UnsignedLong dim, 
 
59
      CovarianceMatrix::CovarianceMatrix(const UnsignedLong dim, 
58
60
                                         const OT::Base::Type::Collection<NumericalScalar> &elementsValues)
59
61
        : SymmetricMatrix(dim,elementsValues)
60
62
      {
84
86
      }
85
87
      
86
88
      /* CovarianceMatrix addition (must have the same dimensions) */
87
 
      CovarianceMatrix CovarianceMatrix::operator + (const CovarianceMatrix & m) const throw(InvalidDimensionException)
 
89
      CovarianceMatrix CovarianceMatrix::operator + (const CovarianceMatrix & m) const /* throw(InvalidDimensionException) */
88
90
      {
89
91
        checkSymmetry();
90
92
        return CovarianceMatrix(new Type::MatrixImplementation(*getImplementation() + *(m.getImplementation()) ));
91
93
      }
92
94
      
93
95
      /* CovarianceMatrix multiplication (must have consistent dimensions) */
94
 
      CovarianceMatrix CovarianceMatrix::operator * (const IdentityMatrix & m) const throw(InvalidDimensionException)
 
96
      CovarianceMatrix CovarianceMatrix::operator * (const IdentityMatrix & m) const /* throw(InvalidDimensionException) */
95
97
      {
96
98
        return *this;
97
99
      }