SheafSystem  0.0.0.0
fiber_bundle::tensor_variance Class Reference

The "type" of a tensor; specifies the degree and the co- or contra-variance for each index of a tensor. More...

#include <tensor_variance.h>

TENSOR_VARIANCE FACET

 tensor_variance ()
 Default constructor. More...
 
 tensor_variance (const tensor_variance &xother)
 Copy constructor. More...
 
 tensor_variance (int xp)
 Creates an instance with degree = xp and all indices contravariant. More...
 
 ~tensor_variance ()
 Destructor; not virtual, this can not be a base class. More...
 
tensor_varianceoperator= (const tensor_variance &xother)
 Assignment operator. More...
 
bool operator== (const tensor_variance &xother) const
 Equality comparison operator. More...
 
int p () const
 The tensor degree. More...
 
bool variance (int xi) const
 The variance of the xi-th index; covariant if true, contravariant if false. More...
 
void put_variance (int xi, bool xvalue)
 Sets the variance of the xi-th index to xvalue. More...
 
void put_variance (bool xvalue)
 Sets the variance of all indices to xvalue. More...
 
bool is_covariant (int xi) const
 True if and only if the xi-th index is covariant; synonym for variance(xi). More...
 
bool is_covariant () const
 True if and only if all indices are covariant. More...
 
bool is_contravariant (int xi) const
 True if and only if the xi-th index is covariant; synonym for !variance(xi). More...
 
bool is_contravariant () const
 True if and only if all indices are contravariant. More...
 
bool is_mixed () const
 True if and only if there exists at least one index that is covariant and at least one that is contravariant. More...
 
bool is_pure () const
 True if and only if all indices are covariant or all indices are contravariant. More...
 
void purify ()
 Sets all indices the same as index 0. More...
 
static int capacity ()
 The largest value of p this implementation will support. More...
 

Detailed Description

The "type" of a tensor; specifies the degree and the co- or contra-variance for each index of a tensor.

A general tensor is defined as a multilinear map of one or more vector and/or covector variables to the reals. The specification of the number of variables and which are vectors and which are covectors is referred to as the type of the tensor, but there appear to be two approaches in the literature to how precisely the type must be specified. Bishop & Goldberg choose to always order the variables so the covectors come first, so the type is entirely specified by the number of covector variables (contravariant degree) and the number of vector variables (covariant degree). But if we have a metric handy and can raise and lower indices it's not entirely clear how the implied reordering of the variables works. Dodson & Poston argue that's its more convenient to not assume any particular order of the variables but then the type must define the co- or contra-variance for each variable in order.

This class follows the Dodson and Poston approach and specifies the variance for each index using a bit vector.

Definition at line 61 of file tensor_variance.h.

Constructor & Destructor Documentation

◆ tensor_variance() [1/3]

fiber_bundle::tensor_variance::tensor_variance ( )

Default constructor.

Postcondition

Definition at line 35 of file tensor_variance.cc.

Referenced by tensor_variance().

◆ tensor_variance() [2/3]

fiber_bundle::tensor_variance::tensor_variance ( const tensor_variance xother)

Copy constructor.

Definition at line 53 of file tensor_variance.cc.

References tensor_variance().

◆ tensor_variance() [3/3]

fiber_bundle::tensor_variance::tensor_variance ( int  xp)

Creates an instance with degree = xp and all indices contravariant.

Precondition
Postcondition
  • for(int i = ( 0 ); i < ( xp ); ++ i ) is_contravariant(i)

Definition at line 69 of file tensor_variance.cc.

References ~tensor_variance().

◆ ~tensor_variance()

fiber_bundle::tensor_variance::~tensor_variance ( )

Destructor; not virtual, this can not be a base class.

Definition at line 90 of file tensor_variance.cc.

References operator=().

Referenced by tensor_variance().

Member Function Documentation

◆ capacity()

int fiber_bundle::tensor_variance::capacity ( )
static

The largest value of p this implementation will support.

Definition at line 148 of file tensor_variance.cc.

References p().

Referenced by operator==().

◆ is_contravariant() [1/2]

bool fiber_bundle::tensor_variance::is_contravariant ( int  xi) const

True if and only if the xi-th index is covariant; synonym for !variance(xi).

Precondition
  • (0 <= xi) && (xi < p())
Postcondition
  • result == !variance(xi)

Definition at line 269 of file tensor_variance.cc.

References is_contravariant().

Referenced by fiber_bundle::hook(), fiber_bundle::raise(), fiber_bundle::star(), and fiber_bundle::wedge().

◆ is_contravariant() [2/2]

bool fiber_bundle::tensor_variance::is_contravariant ( ) const

True if and only if all indices are contravariant.

Definition at line 292 of file tensor_variance.cc.

References is_mixed().

Referenced by is_contravariant(), and is_covariant().

◆ is_covariant() [1/2]

bool fiber_bundle::tensor_variance::is_covariant ( int  xi) const

True if and only if the xi-th index is covariant; synonym for variance(xi).

Precondition
  • (0 <= xi) && (xi < p())
Postcondition
  • result == variance(xi)

Definition at line 228 of file tensor_variance.cc.

References is_covariant().

Referenced by fiber_bundle::hook(), fiber_bundle::lower(), fiber_bundle::star(), fiber_bundle::tensor_product(), and fiber_bundle::wedge().

◆ is_covariant() [2/2]

bool fiber_bundle::tensor_variance::is_covariant ( ) const

True if and only if all indices are covariant.

Definition at line 251 of file tensor_variance.cc.

References is_contravariant().

Referenced by is_covariant(), and put_variance().

◆ is_mixed()

bool fiber_bundle::tensor_variance::is_mixed ( ) const

True if and only if there exists at least one index that is covariant and at least one that is contravariant.

Definition at line 312 of file tensor_variance.cc.

References is_pure().

Referenced by fiber_bundle::sec_tp_algebra::alt(), fiber_bundle::tp_algebra::alt(), is_contravariant(), fiber_bundle::sec_tp_algebra::sym(), and fiber_bundle::tp_algebra::sym().

◆ is_pure()

bool fiber_bundle::tensor_variance::is_pure ( ) const

True if and only if all indices are covariant or all indices are contravariant.

Definition at line 340 of file tensor_variance.cc.

References purify().

Referenced by is_mixed(), fiber_bundle::sec_stp_space::round_variance(), fiber_bundle::stp_space::round_variance(), fiber_bundle::sec_atp_space::round_variance(), and fiber_bundle::atp_space::round_variance().

◆ operator=()

fiber_bundle::tensor_variance & fiber_bundle::tensor_variance::operator= ( const tensor_variance xother)

Assignment operator.

Postcondition
  • (*this) == xother

Definition at line 108 of file tensor_variance.cc.

References operator==().

Referenced by ~tensor_variance().

◆ operator==()

bool fiber_bundle::tensor_variance::operator== ( const tensor_variance xother) const

Equality comparison operator.

Definition at line 129 of file tensor_variance.cc.

References capacity().

Referenced by operator=().

◆ p()

◆ purify()

void fiber_bundle::tensor_variance::purify ( )

Sets all indices the same as index 0.

Postcondition
  • for(int i = ( 0 ); i < ( p() ); ++ i ) variance(i) == variance(0)

Definition at line 347 of file tensor_variance.cc.

References fiber_bundle::contract().

Referenced by is_pure(), fiber_bundle::sec_stp_space::round_variance(), fiber_bundle::stp_space::round_variance(), fiber_bundle::sec_atp_space::round_variance(), and fiber_bundle::atp_space::round_variance().

◆ put_variance() [1/2]

void fiber_bundle::tensor_variance::put_variance ( int  xi,
bool  xvalue 
)

Sets the variance of the xi-th index to xvalue.

Precondition
  • (0 <= xi) && (xi < p())
Postcondition
  • variance(xi) == xvalue

Definition at line 184 of file tensor_variance.cc.

Referenced by fiber_bundle::contract(), fiber_bundle::hook(), fiber_bundle::lower(), fiber_bundle::raise(), fiber_bundle::star(), fiber_bundle::tensor_product(), variance(), fiber_bundle::sec_tp_space::variance(), fiber_bundle::tp_space::variance(), and fiber_bundle::wedge().

◆ put_variance() [2/2]

void fiber_bundle::tensor_variance::put_variance ( bool  xvalue)

Sets the variance of all indices to xvalue.

Postcondition
  • for(int i = ( 0 ); i < ( p() ); ++ i ) variance(i) == xvalue

Definition at line 205 of file tensor_variance.cc.

References is_covariant().

◆ variance()


The documentation for this class was generated from the following files: