SheafSystem  0.0.0.0
tensor_variance.h
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
20 
21 #ifndef TENSOR_VARIANCE_H
22 #define TENSOR_VARIANCE_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef STD_BITSET_H
29 #include "SheafSystem/std_bitset.h"
30 #endif
31 
32 #ifndef STD_LIMITS_H
33 #include "SheafSystem/std_limits.h"
34 #endif
35 
36 namespace fiber_bundle
37 {
38 
61 class SHEAF_DLL_SPEC tensor_variance
62 {
63 
64  //==============================================================================
66  //==============================================================================
68 
69 public:
70 
75 
79  tensor_variance(const tensor_variance& xother);
80 
85  tensor_variance(int xp);
86 
90  ~tensor_variance();
91 
95  tensor_variance& operator=(const tensor_variance& xother);
96 
100  bool operator==(const tensor_variance& xother) const;
101 
105  static int capacity();
106 
110  int p() const;
111 
116  bool variance(int xi) const;
117 
121  void put_variance(int xi, bool xvalue);
122 
126  void put_variance(bool xvalue);
127 
132  bool is_covariant(int xi) const;
133 
137  bool is_covariant() const;
138 
143  bool is_contravariant(int xi) const;
144 
148  bool is_contravariant() const;
149 
154  bool is_mixed() const;
155 
160  bool is_pure() const;
161 
165  void purify();
166 
167 protected:
168 private:
169 
173  int _p;
174 
178  typedef std::bitset<std::numeric_limits<unsigned long int>::digits> variance_type;
179 
184  variance_type _variance;
185 
187 };
188 
189 //==============================================================================
190 // NON-MEMBER FUNCTIONS
191 //==============================================================================
192 
197 SHEAF_DLL_SPEC tensor_variance contract(const tensor_variance& x0, int xp, int xq);
198 
202 SHEAF_DLL_SPEC tensor_variance tensor_product(const tensor_variance& x0, const tensor_variance& x1);
203 
207 SHEAF_DLL_SPEC tensor_variance hook(const tensor_variance& x0);
208 
213 SHEAF_DLL_SPEC tensor_variance star(const tensor_variance& x0, int xdd);
214 
219 SHEAF_DLL_SPEC tensor_variance wedge(const tensor_variance& x0, const tensor_variance& x1);
220 
224 SHEAF_DLL_SPEC tensor_variance raise(const tensor_variance& x0, int xi);
225 
229 SHEAF_DLL_SPEC tensor_variance lower(const tensor_variance& x0, int xi);
230 
231 } // namespace fiber_bundle
232 
233 
234 #endif // ifndef TENSOR_VARIANCE_H
SHEAF_DLL_SPEC tensor_variance lower(const tensor_variance &x0, int xi)
The variance of the lower of a tensor with variance x0 on index xi.
The "type" of a tensor; specifies the degree and the co- or contra-variance for each index of a tenso...
SHEAF_DLL_SPEC tensor_variance tensor_product(const tensor_variance &x0, const tensor_variance &x1)
The variance of the tensor product of tensors with variance x0 and x1.
SHEAF_DLL_SPEC tensor_variance hook(const tensor_variance &x0)
The variance of the hook of a tensor with variance x0.
SHEAF_DLL_SPEC tensor_variance contract(const tensor_variance &x0, int xp, int xq)
The variance of the contration of a tensor with variance x0 on indices xp and xq. ...
bool operator==(const singly_linked_list< T, Alloc > &lhs, const singly_linked_list< T, Alloc > &rhs)
Checks if the contents of lhs and rhs are equal, that is, whether lhs.size() == rhs.size() and each element in lhs compares equal with the element in rhs at the same position.
SHEAF_DLL_SPEC tensor_variance wedge(const tensor_variance &x0, const tensor_variance &x1)
The variance of the wedge of a tensor with variance x0 with a tnesor with variance x1...
SHEAF_DLL_SPEC tensor_variance star(const tensor_variance &x0, int xdd)
The variance of the Hodge star of a tensor with variance x0 over a vector space of dimension xdd...
Namespace for the fiber_bundles component of the sheaf system.