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

« back to all changes in this revision

Viewing changes to lib/src/Base/Type/Tensor.hxx

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2008-11-18 06:32:22 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20081118063222-pa0qncclrerrqkg2
Tags: 0.12.2-1
* New upstream release
* Bug fix: "New upstream release available (0.12.2)", thanks to Jerome
  Robert (Closes: #506005).
* Applied patch by J. Robert.
* debian/control: build-depends on libxml2

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21
21
 *
22
22
 *  @author: $LastChangedBy: dutka $
23
 
 *  @date:   $LastChangedDate: 2007-05-02 14:59:25 +0200 (mer, 02 mai 2007) $
24
 
 *  Id:      $Id: Tensor.hxx 424 2007-05-02 12:59:25Z dutka $
 
23
 *  @date:   $LastChangedDate: 2008-10-31 11:52:04 +0100 (ven 31 oct 2008) $
 
24
 *  Id:      $Id: Tensor.hxx 995 2008-10-31 10:52:04Z dutka $
25
25
 */
26
26
#ifndef OPENTURNS_TENSOR_HXX
27
27
#define OPENTURNS_TENSOR_HXX
28
28
 
 
29
#include "TensorImplementation.hxx"
29
30
#include "TypedInterfaceObject.hxx"
30
 
#include "TensorImplementation.hxx"
31
31
 
32
32
 
33
33
namespace OpenTURNS
39
39
    namespace Type
40
40
    {
41
41
 
 
42
      class TensorImplementation;
 
43
 
42
44
      /**
43
45
       * @class Tensor
44
46
       *
53
55
        
54
56
      public:
55
57
        
56
 
        typedef Common::InvalidDimensionException InvalidDimensionException ;
57
 
        typedef Common::InvalidArgumentException InvalidArgumentException ;
58
 
        typedef Common::TypedInterfaceObject<TensorImplementation>::Implementation Implementation ;
 
58
        typedef Common::InvalidDimensionException                                  InvalidDimensionException;
 
59
        typedef Common::InvalidArgumentException                                   InvalidArgumentException;
 
60
        typedef Common::TypedInterfaceObject<TensorImplementation>::Implementation Implementation;
59
61
        
60
62
        /** Default constructor */
61
 
        Tensor(const String & name = OT::DefaultName);
 
63
        Tensor();
62
64
 
63
65
        /** Constructor with size (rowDim, colDim, sheetDim) */
64
 
        Tensor(UnsignedLong rowDim, UnsignedLong colDim, UnsignedLong sheetDim, const String & name = OT::DefaultName);
 
66
        Tensor(const UnsignedLong rowDim,
 
67
               const UnsignedLong colDim,
 
68
               const UnsignedLong sheetDim);
65
69
        
66
70
        /** Constructor from range of external collection */
67
71
        template <class InputIterator>
68
 
        Tensor(UnsignedLong rowDim, UnsignedLong colDim, UnsignedLong sheetDim,
69
 
               InputIterator first, InputIterator last,
70
 
               const String & name = OT::DefaultName);
 
72
        Tensor(const UnsignedLong rowDim,
 
73
               const UnsignedLong colDim,
 
74
               const UnsignedLong sheetDim,
 
75
               InputIterator first,
 
76
               InputIterator last);
71
77
               
72
78
        /** Constructor from external collection */
73
 
        Tensor(UnsignedLong rowDim, UnsignedLong colDim, UnsignedLong sheetDim, const Collection<NumericalScalar> & elementsValues, const String & name = OT::DefaultName);
 
79
        Tensor(const UnsignedLong rowDim,
 
80
               const UnsignedLong colDim,
 
81
               const UnsignedLong sheetDim,
 
82
               const Collection<NumericalScalar> & elementsValues);
74
83
        
75
84
        /** String converter */
76
85
        virtual String str() const;
78
87
#ifndef SWIG    
79
88
        /** Operator () gives access to the elements of the tensor (to modify these elements) */
80
89
        /** The element of the tensor is designated by its row number i, its column number j and its sheet number k */
81
 
        NumericalScalar & operator () (UnsignedLong i, UnsignedLong j, UnsignedLong k) throw(InvalidDimensionException);
 
90
        NumericalScalar & operator () (const UnsignedLong i,
 
91
                                       const UnsignedLong j,
 
92
                                       const UnsignedLong k) throw(InvalidDimensionException);
82
93
        
83
94
        /** Operator () gives access to the elements of the tensor (read only) */
84
95
        /** The element of the tensor is designated by its row number i, its column number j and its sheet number k */
85
 
        const NumericalScalar & operator () (UnsignedLong i, UnsignedLong j, UnsignedLong k) const throw(InvalidDimensionException);
 
96
        const NumericalScalar & operator () (const UnsignedLong i,
 
97
                                             const UnsignedLong j,
 
98
                                             const UnsignedLong k) const throw(InvalidDimensionException);
86
99
#endif
87
100
 
88
101
        /** getSheet returns the sheet specified by its sheet number k */
89
 
        Matrix getSheet(UnsignedLong k) const throw(InvalidDimensionException);
 
102
        Matrix getSheet(const UnsignedLong k) const throw(InvalidDimensionException);
90
103
        
91
104
        /** setSheet sets matrix m as the sheet specified by its sheet number k  */
92
 
        void setSheet(UnsignedLong k, Matrix & m) throw(InvalidDimensionException);
 
105
        void setSheet(const UnsignedLong k,
 
106
                      const Matrix & m) throw(InvalidDimensionException);
93
107
        
94
108
        /** Get the dimensions of the tensor */
95
109
        /** Number of rows */
116
130
 
117
131
      /** Constructor with size (rowDim, colDim, sheetDim) */
118
132
      template <class InputIterator>
119
 
      Tensor::Tensor(UnsignedLong rowDim, UnsignedLong colDim, UnsignedLong sheetDim,
120
 
                     InputIterator first, InputIterator last,
121
 
                     const String & name)
122
 
        : Common::TypedInterfaceObject<TensorImplementation>(new TensorImplementation(rowDim,colDim,sheetDim,first,last,name))
 
133
      Tensor::Tensor(const UnsignedLong rowDim,
 
134
                     const UnsignedLong colDim,
 
135
                     const UnsignedLong sheetDim,
 
136
                     InputIterator first,
 
137
                     InputIterator last)
 
138
        : Common::TypedInterfaceObject<TensorImplementation>(new TensorImplementation(rowDim, colDim, sheetDim, first, last))
123
139
      {
124
140
        // nothing to do
125
141
      }