arrays.hh

Go to the documentation of this file.
1 
7 #ifndef arrays_hh
8 #define arrays_hh
9 
10 #include "toolbox/array.hh"
11 
12 namespace concepts {
13 
14  // ****************************************************** ArrayDeterminant **
15 
20  template <class F, int dim>
21  class ArrayDeterminant : public Array<F> {
22  public:
24  Array<F>(array ? array->size() : 0) {
25  if (array) {
26  F* foo = data_;
27  const concepts::Mapping<F,dim>* matrix =
28  (const concepts::Mapping<F,dim>*)*array;
29  for(uint i = array->size(); i--;)
30  *foo++ = matrix++->determinant();
31  }
32  }
33  };
34 
35  // **************************************************** ArrayMatrixInverse **
36 
41  template <class F, int dim>
42  class ArrayMatrixInverse : public Array<concepts::Mapping<F,dim> > {
43  public:
45  (const concepts::Array<concepts::Mapping<F,dim> >* array) :
46  Array<concepts::Mapping<F,dim> >(array ? array->size() : 0) {
47  if (array) {
49  const concepts::Mapping<F,dim>* matrix =
50  (const concepts::Mapping<F,dim>*)*array;
51  for(uint i = array->size(); i--;)
52  *foo++ = matrix++->inverse();
53  }
54  }
55  };
56 
57  // ************************************************** ArrayMatrixTranspose **
58 
64  template <class F, int dim>
65  class ArrayMatrixTranspose : public Array<concepts::Mapping<F, dim> > {
66  public:
68  (const concepts::Array<concepts::Mapping<F,dim> >* array) :
69  Array<concepts::Mapping<F,dim> >(array ? array->size() : 0) {
70  if (array) {
72  const concepts::Mapping<F,dim>* matrix =
73  (const concepts::Mapping<F,dim>*)*array;
74  for(uint i = array->size(); i--;)
75  *foo++ = matrix++->transpose();
76  }
77  }
78  };
79 
80  // ******************************************************* ArrayReciprocal **
81 
86  template <class F>
87  class ArrayReciprocal : public Array<F> {
88  public:
90  Array<F>(array ? array->size() : 0) {
91  if (array) {
92  F* foo = data_; const F* a = *array;
93  for(uint i = array->size(); i--;)
94  *foo++ = 1.0 / *a++;
95  }
96  }
97  };
98 
99  // ******************************************************* ArrayGramMatrix **
100 
106  template <class F, int dim>
107  class ArrayGramMatrix : public Array<concepts::Mapping<F,dim> > {
108  public:
110  Array<concepts::Mapping<F,dim> >(array.size()) {
111  concepts::Mapping<F,dim>* foo = data_, *matrix = *array;
112  for(uint i = array.size(); i--;)
113  *foo++ = *matrix * matrix++->transpose();
114  }
115  };
116 
117 } // namespace concepts
118 
119 #endif
uint size() const
Returns the requested size of the array.
Definition: array.hh:259
Class, which calculates the determinant for each element of the array.
Definition: arrays.hh:21
ArrayDeterminant(const concepts::Array< concepts::Mapping< F, dim > > *array)
Definition: arrays.hh:23
ArrayGramMatrix(const concepts::Array< concepts::Mapping< F, dim > > &array)
Definition: arrays.hh:109
ArrayMatrixInverse(const concepts::Array< concepts::Mapping< F, dim > > *array)
Definition: arrays.hh:45
ArrayMatrixTranspose(const concepts::Array< concepts::Mapping< F, dim > > *array)
Definition: arrays.hh:68
Class, which calculates the Gram matrix M * M^T for each matrix of the array.
Definition: arrays.hh:107
ArrayReciprocal(const concepts::Array< F > *array)
Definition: arrays.hh:89
F & inverse(F &f)
Definition: operations.hh:15
F * data_
Data.
Definition: array.hh:273
Class, which calculates the reciprocal for each element of the array.
Definition: arrays.hh:87
Mapping< F, DimX, DimY > transpose() const
Returns the transpose of the matrix.
An array of objects.
Definition: bilinearForm.hh:23
Mapping< F, dim > & transpose(Mapping< F, dim > &m)
Definition: operations.hh:54
Class, which calculates the inverse matrix for each element of the array.
Definition: arrays.hh:42
Class, which calculates the transpose matrix for each element of the array.
Definition: arrays.hh:65
F determinant(const Mapping< F, dim > &m)
Definition: operations.hh:27
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich