|
GiNaC
1.6.2
|
This class holds one index of an indexed object. More...
#include <idx.h>
Public Member Functions | |
| idx (const ex &v, const ex &dim) | |
| Construct index with given value and dimension. | |
| bool | info (unsigned inf) const |
| Information about the object. | |
| size_t | nops () const |
| Number of operands/members. | |
| ex | op (size_t i) const |
| Return operand/member at position i. | |
| ex | map (map_function &f) const |
| Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively). | |
| ex | evalf (int level=0) const |
| By default, basic::evalf would evaluate the index value but we don't want a.1 to become a. | |
| ex | subs (const exmap &m, unsigned options=0) const |
| Substitute a set of objects by arbitrary expressions. | |
| void | archive (archive_node &n) const |
| Save (serialize) the object into archive node. | |
| void | read_archive (const archive_node &n, lst &syms) |
| Load (deserialize) the object from an archive node. | |
| virtual bool | is_dummy_pair_same_type (const basic &other) const |
| Check whether the index forms a dummy index pair with another index of the same type. | |
| ex | get_value () const |
| Get value of index. | |
| bool | is_numeric () const |
| Check whether the index is numeric. | |
| bool | is_symbolic () const |
| Check whether the index is symbolic. | |
| ex | get_dim () const |
| Get dimension of index space. | |
| bool | is_dim_numeric () const |
| Check whether the dimension is numeric. | |
| bool | is_dim_symbolic () const |
| Check whether the dimension is symbolic. | |
| ex | replace_dim (const ex &new_dim) const |
| Make a new index with the same value but a different dimension. | |
| ex | minimal_dim (const idx &other) const |
| Return the minimum of the dimensions of this and another index. | |
Protected Member Functions | |
| ex | derivative (const symbol &s) const |
| Implementation of ex::diff() for an index always returns 0. | |
| bool | match_same_type (const basic &other) const |
| Returns true if the attributes of two objects are similar enough for a match. | |
| unsigned | calchash () const |
| Compute the hash value of an object and if it makes sense to store it in the objects status_flags, do so. | |
| void | print_index (const print_context &c, unsigned level) const |
| void | do_print (const print_context &c, unsigned level) const |
| Default output to stream. | |
| void | do_print_csrc (const print_csrc &c, unsigned level) const |
| 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. | |
Protected Attributes | |
| ex | value |
| Expression that constitutes the index (numeric or symbolic name) | |
| ex | dim |
| Dimension of space (can be symbolic or numeric) | |
This class holds one index of an indexed object.
Indices can theoretically consist of any symbolic expression but they are usually only just a symbol (e.g. "mu", "i") or numeric (integer). Indices belong to a space with a certain numeric or symbolic dimension.
Construct index with given value and dimension.
| v | Value of index (numeric or symbolic) |
| dim | Dimension of index space (numeric or symbolic) |
Definition at line 72 of file idx.cpp.
References dim, GiNaC::ex::info(), is_dim_numeric(), and GiNaC::info_flags::posint.
| bool GiNaC::idx::info | ( | unsigned | inf | ) | const [virtual] |
Information about the object.
Reimplemented from GiNaC::basic.
Definition at line 234 of file idx.cpp.
References GiNaC::info_flags::has_indices, and GiNaC::info_flags::idx.
| size_t GiNaC::idx::nops | ( | ) | const [virtual] |
Number of operands/members.
Reimplemented from GiNaC::basic.
| ex GiNaC::idx::op | ( | size_t | i | ) | const [virtual] |
Return operand/member at position i.
Reimplemented from GiNaC::basic.
Definition at line 250 of file idx.cpp.
References GINAC_ASSERT, and value.
| ex GiNaC::idx::map | ( | map_function & | f | ) | const [virtual] |
Construct new expression by applying the specified function to all sub-expressions (one level only, not recursively).
Reimplemented from GiNaC::basic.
Definition at line 256 of file idx.cpp.
References GiNaC::are_ex_trivially_equal(), GiNaC::basic::clearflag(), GiNaC::basic::duplicate(), GiNaC::status_flags::dynallocated, GiNaC::status_flags::hash_calculated, GiNaC::basic::setflag(), and value.
| ex GiNaC::idx::evalf | ( | int | level = 0 | ) | const [virtual] |
By default, basic::evalf would evaluate the index value but we don't want a.1 to become a.
(1.0).
Reimplemented from GiNaC::basic.
Substitute a set of objects by arbitrary expressions.
The ex returned will already be evaluated.
Reimplemented from GiNaC::basic.
Definition at line 374 of file idx.cpp.
References GiNaC::are_ex_trivially_equal(), GiNaC::basic::clearflag(), GiNaC::basic::duplicate(), GiNaC::status_flags::dynallocated, GiNaC::ex::find(), GiNaC::status_flags::hash_calculated, GiNaC::subs_options::really_subs_idx, GiNaC::basic::setflag(), GiNaC::ex::subs(), and value.
Referenced by GiNaC::spinmetric::contract_with().
| void GiNaC::idx::archive | ( | archive_node & | n | ) | const [virtual] |
Save (serialize) the object into archive node.
Archive the object.
Losely speaking, this method turns an expression into a byte stream (which can be saved and restored later on, or sent via network, etc.)
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::spinidx, and GiNaC::varidx.
Definition at line 113 of file idx.cpp.
References GiNaC::archive_node::add_ex(), dim, and value.
| void GiNaC::idx::read_archive | ( | const archive_node & | n, |
| lst & | syms | ||
| ) | [virtual] |
Load (deserialize) the object from an archive node.
Construct object from archive_node.
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::spinidx, and GiNaC::varidx.
Definition at line 91 of file idx.cpp.
References dim, GiNaC::archive_node::find_ex(), and value.
Implementation of ex::diff() for an index always returns 0.
Reimplemented from GiNaC::basic.
Definition at line 405 of file idx.cpp.
References GiNaC::_ex0.
| bool GiNaC::idx::match_same_type | ( | const basic & | other | ) | const [protected, virtual] |
Returns true if the attributes of two objects are similar enough for a match.
This function must not match subexpressions (this is already done by basic::match()). Only attributes not accessible by op() should be compared. This is also the reason why this function doesn't take the wildcard replacement list from match() as an argument: only subexpressions are subject to wildcard matches. Also, this function only needs to be implemented for container classes because is_equal_same_type() is automatically used instead of match_same_type() if nops() == 0.
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::spinidx, and GiNaC::varidx.
Definition at line 283 of file idx.cpp.
References dim, GINAC_ASSERT, and GiNaC::ex::is_equal().
| unsigned GiNaC::idx::calchash | ( | ) | const [protected, virtual] |
Compute the hash value of an object and if it makes sense to store it in the objects status_flags, do so.
The method inherited from class basic computes a hash value based on the type and hash values of possible members. For this reason it is well suited for container classes but atomic classes should override this implementation because otherwise they would all end up with the same hashvalue.
Reimplemented from GiNaC::basic.
Definition at line 344 of file idx.cpp.
References GiNaC::status_flags::evaluated, GiNaC::basic::flags, GiNaC::ex::gethash(), GiNaC::status_flags::hash_calculated, GiNaC::basic::hashvalue, GiNaC::make_hash_seed(), GiNaC::rotate_left(), GiNaC::basic::setflag(), and value.
| bool GiNaC::idx::is_dummy_pair_same_type | ( | const basic & | other | ) | const [virtual] |
Check whether the index forms a dummy index pair with another index of the same type.
Reimplemented in GiNaC::spinidx, and GiNaC::varidx.
Definition at line 414 of file idx.cpp.
References dim, GiNaC::ex::is_equal(), and value.
Referenced by GiNaC::is_dummy_pair().
| ex GiNaC::idx::get_value | ( | ) | const [inline] |
Get value of index.
Definition at line 72 of file idx.h.
References value.
Referenced by GiNaC::tensdelta::eval_indexed(), GiNaC::minkmetric::eval_indexed(), GiNaC::matrix::eval_indexed(), and GiNaC::spinmetric::eval_indexed().
| bool GiNaC::idx::is_numeric | ( | ) | const [inline] |
| bool GiNaC::idx::is_symbolic | ( | ) | const [inline] |
Check whether the index is symbolic.
Definition at line 78 of file idx.h.
References value.
Referenced by GiNaC::spinmetric::contract_with(), and GiNaC::tensor::replace_contr_index().
| ex GiNaC::idx::get_dim | ( | ) | const [inline] |
Get dimension of index space.
Definition at line 81 of file idx.h.
References dim.
Referenced by GiNaC::tensdelta::eval_indexed(), GiNaC::tensmetric::eval_indexed(), and GiNaC::matrix::eval_indexed().
| bool GiNaC::idx::is_dim_numeric | ( | ) | const [inline] |
| bool GiNaC::idx::is_dim_symbolic | ( | ) | const [inline] |
Make a new index with the same value but a different dimension.
Definition at line 461 of file idx.cpp.
References GiNaC::basic::clearflag(), dim, GiNaC::basic::duplicate(), GiNaC::status_flags::dynallocated, GiNaC::status_flags::hash_calculated, and GiNaC::basic::setflag().
Referenced by GiNaC::tensdelta::eval_indexed(), GiNaC::tensmetric::eval_indexed(), and GiNaC::tensor::replace_contr_index().
Return the minimum of the dimensions of this and another index.
If this is undecidable, throw an exception.
Definition at line 469 of file idx.cpp.
References dim.
Referenced by GiNaC::tensdelta::eval_indexed(), GiNaC::tensmetric::eval_indexed(), and GiNaC::tensor::replace_contr_index().
| void GiNaC::idx::print_index | ( | const print_context & | c, |
| unsigned | level | ||
| ) | const [protected] |
Definition at line 136 of file idx.cpp.
References dim, GiNaC::print_context::options, GiNaC::ex::print(), GiNaC::print_options::print_index_dimensions, GiNaC::print_context::s, and value.
Referenced by do_print(), GiNaC::varidx::do_print(), GiNaC::spinidx::do_print(), do_print_latex(), and GiNaC::spinidx::do_print_latex().
| void GiNaC::idx::do_print | ( | const print_context & | c, |
| unsigned | level | ||
| ) | const [protected] |
Default output to stream.
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::spinidx, and GiNaC::varidx.
Definition at line 151 of file idx.cpp.
References print_index(), and GiNaC::print_context::s.
| void GiNaC::idx::do_print_csrc | ( | const print_csrc & | c, |
| unsigned | level | ||
| ) | const [protected] |
Definition at line 164 of file idx.cpp.
References GiNaC::ex::info(), GiNaC::info_flags::integer, GiNaC::ex::print(), GiNaC::print_context::s, and value.
| void GiNaC::idx::do_print_latex | ( | const print_latex & | c, |
| unsigned | level | ||
| ) | const [protected] |
Reimplemented in GiNaC::spinidx.
Definition at line 157 of file idx.cpp.
References print_index(), and GiNaC::print_context::s.
| void GiNaC::idx::do_print_tree | ( | const print_tree & | c, |
| unsigned | level | ||
| ) | const [protected] |
Tree output to stream.
Reimplemented from GiNaC::basic.
Reimplemented in GiNaC::spinidx, and GiNaC::varidx.
Definition at line 174 of file idx.cpp.
References GiNaC::print_tree::delta_indent, dim, GiNaC::basic::flags, GiNaC::basic::hashvalue, GiNaC::ex::print(), GiNaC::print_context::s, and value.
ex GiNaC::idx::value [protected] |
Expression that constitutes the index (numeric or symbolic name)
Definition at line 104 of file idx.h.
Referenced by archive(), calchash(), do_print_csrc(), do_print_tree(), GiNaC::varidx::do_print_tree(), GiNaC::spinidx::do_print_tree(), get_value(), is_dummy_pair_same_type(), is_numeric(), is_symbolic(), map(), op(), print_index(), read_archive(), and subs().
ex GiNaC::idx::dim [protected] |
Dimension of space (can be symbolic or numeric)
Definition at line 105 of file idx.h.
Referenced by archive(), do_print_tree(), GiNaC::varidx::do_print_tree(), GiNaC::spinidx::do_print_tree(), get_dim(), idx(), is_dim_numeric(), is_dim_symbolic(), is_dummy_pair_same_type(), match_same_type(), minimal_dim(), print_index(), read_archive(), and replace_dim().