GiNaC  1.6.2
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
GiNaC::indexed Class Reference

This class holds an indexed expression. More...

#include <indexed.h>

Inheritance diagram for GiNaC::indexed:
GiNaC::container< C > GiNaC::basic GiNaC::container_storage< C > GiNaC::refcounted GiNaC::clifford GiNaC::color

List of all members.

Public Member Functions

 indexed (const ex &b)
 Construct indexed object with no index.
 indexed (const ex &b, const ex &i1)
 Construct indexed object with one index.
 indexed (const ex &b, const ex &i1, const ex &i2)
 Construct indexed object with two indices.
 indexed (const ex &b, const ex &i1, const ex &i2, const ex &i3)
 Construct indexed object with three indices.
 indexed (const ex &b, const ex &i1, const ex &i2, const ex &i3, const ex &i4)
 Construct indexed object with four indices.
 indexed (const ex &b, const symmetry &symm, const ex &i1, const ex &i2)
 Construct indexed object with two indices and a specified symmetry.
 indexed (const ex &b, const symmetry &symm, const ex &i1, const ex &i2, const ex &i3)
 Construct indexed object with three indices and a specified symmetry.
 indexed (const ex &b, const symmetry &symm, const ex &i1, const ex &i2, const ex &i3, const ex &i4)
 Construct indexed object with four indices and a specified symmetry.
 indexed (const ex &b, const exvector &iv)
 Construct indexed object with a specified vector of indices.
 indexed (const ex &b, const symmetry &symm, const exvector &iv)
 Construct indexed object with a specified vector of indices and symmetry.
 indexed (const symmetry &symm, const exprseq &es)
 indexed (const symmetry &symm, const exvector &v, bool discardable=false)
 indexed (const symmetry &symm, std::auto_ptr< exvector > vp)
unsigned precedence () const
 Return relative operator precedence (for parenthezing output).
bool info (unsigned inf) const
 Information about the object.
ex eval (int level=0) const
 Perform automatic non-interruptive term rewriting rules.
ex real_part () const
ex imag_part () const
exvector get_free_indices () const
 Return a vector containing the free indices of an expression.
void archive (archive_node &n) const
 Save (a.k.a.
void read_archive (const archive_node &n, lst &syms)
 Read (a.k.a.
bool all_index_values_are (unsigned inf) const
 Check whether all index values have a certain property.
exvector get_indices () const
 Return a vector containing the object's indices.
exvector get_dummy_indices () const
 Return a vector containing the dummy indices of the object, if any.
exvector get_dummy_indices (const indexed &other) const
 Return a vector containing the dummy indices in the contraction with another indexed object.
bool has_dummy_index_for (const ex &i) const
 Check whether the object has an index that forms a dummy index pair with a given index.
ex get_symmetry () const
 Return symmetry properties.

Protected Member Functions

ex derivative (const symbol &s) const
 Implementation of ex::diff() for an indexed object always returns 0.
ex thiscontainer (const exvector &v) const
ex thiscontainer (std::auto_ptr< exvector > vp) const
unsigned return_type () const
return_type_t return_type_tinfo () const
ex expand (unsigned options=0) const
 Expand expression, i.e.
void printindices (const print_context &c, unsigned level) const
void print_indexed (const print_context &c, const char *openbrace, const char *closebrace, unsigned level) const
void do_print (const print_context &c, unsigned level) const
 Default output to stream.
void do_print_latex (const print_latex &c, unsigned level) const
void do_print_tree (const print_tree &c, unsigned level) const
 Tree output to stream.
void validate () const
 Check whether all indices are of class idx and validate the symmetry tree.

Protected Attributes

ex symtree
 Index symmetry (tree of symmetry objects)

Friends

ex simplify_indexed (const ex &e, exvector &free_indices, exvector &dummy_indices, const scalar_products &sp)
 Simplify indexed expression, return list of free indices.
ex simplify_indexed_product (const ex &e, exvector &free_indices, exvector &dummy_indices, const scalar_products &sp)
 Simplify product of indexed expressions (commutative, noncommutative and simple squares), return list of free indices.
bool reposition_dummy_indices (ex &e, exvector &variant_dummy_indices, exvector &moved_indices)
 Raise/lower dummy indices in a single indexed objects to canonicalize their variance.

Detailed Description

This class holds an indexed expression.

It consists of a 'base' expression (the expression being indexed) which can be accessed as op(0), and n (n >= 0) indices (all of class idx), accessible as op(1)..op(n).

Definition at line 39 of file indexed.h.


Constructor & Destructor Documentation

GiNaC::indexed::indexed ( const ex b)

Construct indexed object with no index.

Parameters:
bBase expression
Returns:
newly constructed indexed object

Definition at line 64 of file indexed.cpp.

References validate().

Referenced by eval(), GiNaC::clifford::get_metric(), and thiscontainer().

GiNaC::indexed::indexed ( const ex b,
const ex i1 
)

Construct indexed object with one index.

The index must be of class idx.

Parameters:
bBase expression
i1The index
Returns:
newly constructed indexed object

Definition at line 69 of file indexed.cpp.

References validate().

GiNaC::indexed::indexed ( const ex b,
const ex i1,
const ex i2 
)

Construct indexed object with two indices.

The indices must be of class idx.

Parameters:
bBase expression
i1First index
i2Second index
Returns:
newly constructed indexed object

Definition at line 74 of file indexed.cpp.

References validate().

GiNaC::indexed::indexed ( const ex b,
const ex i1,
const ex i2,
const ex i3 
)

Construct indexed object with three indices.

The indices must be of class idx.

Parameters:
bBase expression
i1First index
i2Second index
i3Third index
Returns:
newly constructed indexed object

Definition at line 79 of file indexed.cpp.

References validate().

GiNaC::indexed::indexed ( const ex b,
const ex i1,
const ex i2,
const ex i3,
const ex i4 
)

Construct indexed object with four indices.

The indices must be of class idx.

Parameters:
bBase expression
i1First index
i2Second index
i3Third index
i4Fourth index
Returns:
newly constructed indexed object

Definition at line 84 of file indexed.cpp.

References validate().

GiNaC::indexed::indexed ( const ex b,
const symmetry symm,
const ex i1,
const ex i2 
)

Construct indexed object with two indices and a specified symmetry.

The indices must be of class idx.

Parameters:
bBase expression
symmSymmetry of indices
i1First index
i2Second index
Returns:
newly constructed indexed object

Definition at line 89 of file indexed.cpp.

References validate().

GiNaC::indexed::indexed ( const ex b,
const symmetry symm,
const ex i1,
const ex i2,
const ex i3 
)

Construct indexed object with three indices and a specified symmetry.

The indices must be of class idx.

Parameters:
bBase expression
symmSymmetry of indices
i1First index
i2Second index
i3Third index
Returns:
newly constructed indexed object

Definition at line 94 of file indexed.cpp.

References validate().

GiNaC::indexed::indexed ( const ex b,
const symmetry symm,
const ex i1,
const ex i2,
const ex i3,
const ex i4 
)

Construct indexed object with four indices and a specified symmetry.

The indices must be of class idx.

Parameters:
bBase expression
symmSymmetry of indices
i1First index
i2Second index
i3Third index
i4Fourth index
Returns:
newly constructed indexed object

Definition at line 99 of file indexed.cpp.

References validate().

GiNaC::indexed::indexed ( const ex b,
const exvector iv 
)

Construct indexed object with a specified vector of indices.

The indices must be of class idx.

Parameters:
bBase expression
ivVector of indices
Returns:
newly constructed indexed object

Definition at line 104 of file indexed.cpp.

References GiNaC::container_storage< C >::seq, and validate().

GiNaC::indexed::indexed ( const ex b,
const symmetry symm,
const exvector iv 
)

Construct indexed object with a specified vector of indices and symmetry.

The indices must be of class idx.

Parameters:
bBase expression
symmSymmetry of indices
ivVector of indices
Returns:
newly constructed indexed object

Definition at line 110 of file indexed.cpp.

References GiNaC::container_storage< C >::seq, and validate().

GiNaC::indexed::indexed ( const symmetry symm,
const exprseq es 
)

Definition at line 116 of file indexed.cpp.

GiNaC::indexed::indexed ( const symmetry symm,
const exvector v,
bool  discardable = false 
)

Definition at line 120 of file indexed.cpp.

GiNaC::indexed::indexed ( const symmetry symm,
std::auto_ptr< exvector vp 
)

Definition at line 124 of file indexed.cpp.


Member Function Documentation

unsigned GiNaC::indexed::precedence ( ) const [inline, virtual]

Return relative operator precedence (for parenthezing output).

Reimplemented from GiNaC::container< C >.

Reimplemented in GiNaC::clifford.

Definition at line 146 of file indexed.h.

Referenced by print_indexed().

bool GiNaC::indexed::info ( unsigned  inf) const [virtual]

Information about the object.

See also:
class info_flags

Reimplemented from GiNaC::container< C >.

Definition at line 239 of file indexed.cpp.

References GiNaC::info_flags::has_indices, GiNaC::info_flags::indexed, and GiNaC::container_storage< C >::seq.

Referenced by imag_part(), and real_part().

ex GiNaC::indexed::eval ( int  level = 0) const [virtual]
ex GiNaC::indexed::real_part ( ) const [virtual]

Reimplemented from GiNaC::container< C >.

Definition at line 308 of file indexed.cpp.

References info(), GiNaC::container< C >::op(), and GiNaC::info_flags::real.

ex GiNaC::indexed::imag_part ( ) const [virtual]

Reimplemented from GiNaC::container< C >.

Definition at line 315 of file indexed.cpp.

References info(), GiNaC::container< C >::op(), and GiNaC::info_flags::real.

exvector GiNaC::indexed::get_free_indices ( ) const [virtual]

Return a vector containing the free indices of an expression.

Reimplemented from GiNaC::basic.

Definition at line 466 of file indexed.cpp.

References GiNaC::find_free_and_dummy(), and GiNaC::container_storage< C >::seq.

Referenced by get_dummy_indices().

void GiNaC::indexed::archive ( archive_node n) const [virtual]

Save (a.k.a.

serialize) indexed object into archive.

Reimplemented from GiNaC::container< C >.

Reimplemented in GiNaC::clifford, and GiNaC::color.

Definition at line 155 of file indexed.cpp.

References GiNaC::archive_node::add_ex(), and symtree.

void GiNaC::indexed::read_archive ( const archive_node n,
lst syms 
) [virtual]
ex GiNaC::indexed::derivative ( const symbol s) const [protected, virtual]

Implementation of ex::diff() for an indexed object always returns 0.

See also:
ex::diff

Reimplemented from GiNaC::basic.

Definition at line 397 of file indexed.cpp.

References GiNaC::_ex0.

ex GiNaC::indexed::thiscontainer ( const exvector v) const [protected]

Reimplemented in GiNaC::clifford, and GiNaC::color.

Definition at line 322 of file indexed.cpp.

References indexed(), and symtree.

Referenced by eval(), and expand().

ex GiNaC::indexed::thiscontainer ( std::auto_ptr< exvector vp) const [protected]

Reimplemented in GiNaC::clifford, and GiNaC::color.

Definition at line 327 of file indexed.cpp.

References indexed(), and symtree.

unsigned GiNaC::indexed::return_type ( ) const [protected, virtual]

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::clifford, and GiNaC::color.

Definition at line 332 of file indexed.cpp.

References GiNaC::return_types::commutative, GiNaC::container< C >::op(), and GiNaC::ex::return_type().

return_type_t GiNaC::indexed::return_type_tinfo ( ) const [inline, protected, virtual]

Reimplemented from GiNaC::basic.

Reimplemented in GiNaC::clifford, and GiNaC::color.

Definition at line 162 of file indexed.h.

References GiNaC::container< C >::op(), and GiNaC::ex::return_type_tinfo().

ex GiNaC::indexed::expand ( unsigned  options = 0) const [protected, virtual]

Expand expression, i.e.

multiply it out and return the result as a new expression.

Reimplemented from GiNaC::basic.

Definition at line 340 of file indexed.cpp.

References GiNaC::_ex0, GiNaC::are_ex_trivially_equal(), GiNaC::ex::expand(), GiNaC::expand(), GiNaC::expand_options::expand_indexed, GINAC_ASSERT, GiNaC::ex::nops(), GiNaC::ex::op(), GiNaC::container_storage< C >::seq, and thiscontainer().

bool GiNaC::indexed::all_index_values_are ( unsigned  inf) const

Check whether all index values have a certain property.

See also:
class info_flags

Definition at line 252 of file indexed.cpp.

References GiNaC::container_storage< C >::seq.

exvector GiNaC::indexed::get_indices ( ) const

Return a vector containing the object's indices.

Definition at line 432 of file indexed.cpp.

References GINAC_ASSERT, and GiNaC::container_storage< C >::seq.

exvector GiNaC::indexed::get_dummy_indices ( ) const

Return a vector containing the dummy indices of the object, if any.

Definition at line 438 of file indexed.cpp.

References GiNaC::find_free_and_dummy(), and GiNaC::container_storage< C >::seq.

exvector GiNaC::indexed::get_dummy_indices ( const indexed other) const

Return a vector containing the dummy indices in the contraction with another indexed object.

This is symmetric: a.get_dummy_indices(b) == b.get_dummy_indices(a)

Definition at line 445 of file indexed.cpp.

References GiNaC::find_dummy_indices(), and get_free_indices().

bool GiNaC::indexed::has_dummy_index_for ( const ex i) const

Check whether the object has an index that forms a dummy index pair with a given index.

Definition at line 455 of file indexed.cpp.

References GiNaC::is_dummy_pair(), and GiNaC::container_storage< C >::seq.

ex GiNaC::indexed::get_symmetry ( ) const [inline]

Return symmetry properties.

Definition at line 190 of file indexed.h.

References symtree.

Referenced by GiNaC::clifford::get_metric().

void GiNaC::indexed::printindices ( const print_context c,
unsigned  level 
) const [protected]
void GiNaC::indexed::print_indexed ( const print_context c,
const char *  openbrace,
const char *  closebrace,
unsigned  level 
) const [protected]
void GiNaC::indexed::do_print ( const print_context c,
unsigned  level 
) const [protected]

Default output to stream.

Reimplemented from GiNaC::container< C >.

Definition at line 219 of file indexed.cpp.

References print_indexed().

void GiNaC::indexed::do_print_latex ( const print_latex c,
unsigned  level 
) const [protected]

Reimplemented in GiNaC::clifford.

Definition at line 224 of file indexed.cpp.

References print_indexed().

void GiNaC::indexed::do_print_tree ( const print_tree c,
unsigned  level 
) const [protected]
void GiNaC::indexed::validate ( ) const [protected]

Check whether all indices are of class idx and validate the symmetry tree.

This function is used internally to make sure that all constructed indexed objects really carry indices and not some other classes.

Definition at line 377 of file indexed.cpp.

References GINAC_ASSERT, GiNaC::ex::is_zero(), GiNaC::container_storage< C >::seq, symtree, and GiNaC::symmetry::validate().

Referenced by indexed().


Friends And Related Function Documentation

ex simplify_indexed ( const ex e,
exvector free_indices,
exvector dummy_indices,
const scalar_products sp 
) [friend]

Simplify indexed expression, return list of free indices.

Referenced by GiNaC::clifford::get_metric(), and GiNaC::clifford::same_metric().

ex simplify_indexed_product ( const ex e,
exvector free_indices,
exvector dummy_indices,
const scalar_products sp 
) [friend]

Simplify product of indexed expressions (commutative, noncommutative and simple squares), return list of free indices.

Definition at line 788 of file indexed.cpp.

bool reposition_dummy_indices ( ex e,
exvector variant_dummy_indices,
exvector moved_indices 
) [friend]

Raise/lower dummy indices in a single indexed objects to canonicalize their variance.

Parameters:
eObject to work on
variant_dummy_indicesThe set of indices that might need repositioning (will be changed by this function)
moved_indicesThe set of indices that have been repositioned (will be changed by this function)
Returns:
true if 'e' was changed

Definition at line 625 of file indexed.cpp.


Member Data Documentation

Index symmetry (tree of symmetry objects)

Definition at line 202 of file indexed.h.

Referenced by archive(), do_print_tree(), eval(), get_symmetry(), read_archive(), thiscontainer(), and validate().


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

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.