This shows you the differences between two versions of the page.
documentation:ref:simpletensor [2015/11/21 12:33] |
documentation:ref:simpletensor [2015/11/21 12:33] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SimpleTensor ====== | ||
+ | ---- | ||
+ | |||
+ | ====Basics==== | ||
+ | ''SimpleTensor'' represents a simple tensors like ''f_mn'' of symbols like ''x'' etc. Like any other expression, it inherits all properties of [[Tensor]]. ''SimpleTensor'' adopts the following convention on its indices: the indices of ''SimpleTensor'' ([[SimpleIndices]]) are sorted by their [[documentation:ref:IndexType|types]], but the relative ordering of indices within a particular type is same as defined by the user: | ||
+ | <sxh groovy; gutter: false> | ||
+ | def t = 'f_cba^\\alpha_AB'.t | ||
+ | println t.indices | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > _{cbaAB}^{\alpha} | ||
+ | </sxh> | ||
+ | The relative ordering is not changed even if tensor has [[documentation:guide:symmetries_of_tensors|symmetry property]]; in latter case Redberry uses algorithms provided by [[documentation:guide:mappings_of_indices]] to compare expressions instead of trying to put expression in canonical form. | ||
+ | |||
+ | The distinctive feature of simple tensors is the presence of [[documentation:guide:symmetries_of_tensors|symmetries]]. In order to bind symmetries to simple tensor, one can use ''addSymmetry'' method or directly call ''addSymmetry'' from simple tensor [[SimpleIndices]]: | ||
+ | <sxh groovy; gutter: false> | ||
+ | addSymmetry 'f_pqr', [1, 0].p | ||
+ | //or equivalently | ||
+ | 'f_klm'.t.indices.symmetries.addSymmetry( [1, 0].p ) | ||
+ | </sxh> | ||
+ | Once specified, symmetries will be automatically set up for all same simple tensors (''f_abc'' or ''f_qrs'' etc.) whichever way they are created. | ||
+ | ====Details==== | ||
+ | In order to get name of simple tensor one can get ''.stringName'' property: | ||
+ | <sxh groovy: gutter: false> | ||
+ | def t = 'f_abc^\\alpha_AB'.t | ||
+ | println t.stringName | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > f | ||
+ | </sxh> | ||
+ | On the other hand, this name does not reflect the mathematical nature of simple tensors, and for example two completely different tensors ''f_a'' and ''f_ab'' have same ''stringName''. | ||
+ | |||
+ | The unique identifier of ''SimpleTensor'' which encodes its mathematical nature is an integer property ''.name'': two simple tensors have same ''.name'' if and only if they have same ''.stringName'' and same //structure of indices//: | ||
+ | <sxh groovy: gutter: false> | ||
+ | assert 'f_ab'.t.name == 'f_bc'.t.name | ||
+ | assert 'f_ab'.t.name != 't_bc'.t.name | ||
+ | assert 'f_ab'.t.name != 'f_b'.t.name | ||
+ | assert 'f_ab'.t.name != 'f_AB'.t.name | ||
+ | </sxh> | ||
+ | For further details see API. | ||
+ | ====See also==== | ||
+ | * Related guides: [[documentation:guide:tensors_and_indices]], [[documentation:guide:symmetries_of_tensors]] | ||
+ | * Reference: [[documentation:ref:tensor]], [[documentation:ref:simpleindices]], [[documentation:ref:tensorfield]] | ||
+ | * JavaDocs: [[http://api.redberry.cc/redberry/1.1.9/java-api/cc/redberry/core/tensor/SimpleTensor.html| SimpleTensor]] | ||
+ | * Source code: [[https://bitbucket.org/redberry/redberry/src/tip/core/src/main/java/cc/redberry/core/tensor/SimpleTensor.java|SimpleTensor.java]] | ||