# Differences

This shows you the differences between two versions of the page.

 — documentation:guide:notes_on_internal_architecture [2015/11/21 12:33] (current) Line 1: Line 1: + ====== Notes on internal architecture ====== + <​html>​ +
+ ​ + Next topic: [[documentation:​guide:​setting_up_matrix_objects]] + <​html>​ + ​ + ​ + ​ + + ---- + + One of the applications of finding [[documentation:​guide:​mappings_of_indices|mappings of indices]] is testing whether two expressions are equal (to within dummy indices relabelling and interchanging indices of simple tensors according to their symmetries). Probably, this operation is the most frequent operation that arises in any calculation (like reduction of similar terms). This problem can be solved by finding mapping of indices which maps free indices of one expression onto exactly same free indices of another. + + As it well known, contractions between indices in product constitutes a graph. So, the problem of finding mappings between two expressions is equivalent to problem of testing whether two graphs are isomorphic. While no worst-case polynomial-time algorithms are known for the general [[http://​en.wikipedia.org/​wiki/​Graph_isomorphism_problem|Graph Isomorphism (GI)]] and closely related [[http://​en.wikipedia.org/​wiki/​Graph_automorphism|Graph Automorphism (GA)]] problems, there are several algorithms which solve these problems very effectively in all practical cases (see e.g. [[#​References|[1]]] and overview given in [[#​References|[2]]] ). It is important to note, that the complexity of these algorithms (which is still exponential in the worst case) is given in the number of graph vertices, or equivalently in the number of product multipliers. + + On the other hand, the existing systems (known to the authors) are based on the so-called //indices canonicalisation approach// described in [[#​References|[3,​ 4]]] . This procedure brings indices of products into unique canonical order using the information about symmetries of its multipliers;​ when indices of tensors are brought into such order, it becomes trivial to test whether two expressions are equal. As it is shown in cited papers, this problem is equivalent to the problem of //double coset enumeration//​ which is known to be $\mathcal{NP}$-hard (see Sec. 4.6.8 in [[#​References|[5]]] ). Unfortunately,​ no really satisfactory algorithm for solving this problem has been found to date (see Sec. 4.6.8 in [[#​References|[5]]] ). Moreover, in contrast to GI problem, the complexity of algorithms for double coset enumeration is given in the number of all  indices (free and dummy) of tensor. It is also important, that indices canonicalization is not useful for testing whether two tensors are equal to within //free indices// relabelling. Additionally,​ indices canonicalization works only with products of simple tensors, so if e.g. product contains a sum one need to expand out brackets first. + + Redberry utilises the first approach, based on the GI finding. The main algorithm, which finds mappings of tensor indices is actually searches for isomorphisms of corresponding graphs. Currently, this algorithm is far from the best known algorithms for GI problem. However, it is specifically suited for typical problems arising in physics and performs well on typical input  (i.e. when need to compare a huge number of small graphs; see [[documentation:​benchmarks| Benchmarks]]),​ but still has exponential complexity for some special cases. Nevertheless,​ there is a wide area for improvements and this is the main issue of further Redberry development. + + Another important subject closely related to tensor comparison, is finding symmetries of complicated tensors. It is clear that from the stand point of graph-theoretical approach, this problem is equivalent to Graph Automorphism problem. This problem is also related to testing whether the expression is zero using only the information about its symmetries (like $\displaystyle F_{ab}{}F^{bc}{}F_{c}{}^{a} = 0$  if $F_{ab}$ is antisymmetric). The canonicalization procedure used by other systems can naturally determine whether the expression is zero, while in Redberry one should apply special transformation [[documentation:​ref:​eliminateduesymmetries]]. The algorithm used in Redberry computes automorphism group $Aut(G)$ of corresponding graph $G$ and searches in this group for two equal permutations with different signs: if generators of group can produce two equal permutations with different signs (i.e. symmetry and antisymmetry),​ that means that corresponding expression is zero. Currently, Redberry uses a brute force algorithm for [[documentation:​ref:​eliminateduesymmetries]] and its performance is about of order of group, i.e. the number of all group elements $|Aut(G)|$, so it is impractical for large symmetric tensors. A vastly improved algorithm is under development and will appear soon in the next Redberry release. + + + Summarizing this section we point out that in our opinion, the approach based on graph algorithms provides a more flexible way to deal with tensors than canonicalization and has a broader perspective for further performance improvements. The good argument in favour of this point is a performance comparison of Redberry and other systems presented in [[documentation:​benchmarks| Benchmarks]] section. + ====References==== + + * **[1]** B. D. McKay, [[http://​cs.anu.edu.au/​~bdm/​nauty/​PGI/​|"​Practical graph isomorphism"​]]. In //​Proceedings of 10th. Manitoba Conference on Numerical Mathematics and Computing (Winnipeg, 1980); Congressus Numerantium 30 (1981) 4587//. + * **[2]** B. D. McKay, A. Piperno, [[http://​dx.doi.org/​10.1016/​j.jsc.2013.09.003|"​Practical graph isomorphism,​ II"]]. In //Journal of Symbolic Computation 60 (2014) pp. 94–112 (arXiv:​cs/​1301.1493)//​. + * **[3]** A. Ya. Rodionov, A. Yu. Taranov, [[http://​dx.doi.org/​10.1007/​3-540-51517-8_113|Combinatorial aspects of simplification of algebraic expressions]]. In //​Eurocal'​87 Lecture Notes in Computer Science 378 (1989) 192-201//. + * **[4]** L. R. U. Manssur, R. Portugal, B. F. Svaiter, [[http://​dx.doi.org/​10.1142/​S0129183102004571|"​Group-theoretic approach for symbolic tensor manipulation"​]]. In //​International Journal of Modern Physics C 13~(07) (2002) 859--879 (arXiv:​math-ph/​0107032)//​. + * **[5]** D. Holt, B. Eick, E. O'​Brien,​ [[http://​www.amazon.com/​Handbook-Computational-Discrete-Mathematics-Applications/​dp/​1584883723|"​Handbook of Computational Group Theory"​]]. In //Discrete Mathematics and Its Applications,​ Taylor & Francis, 2005,  ISBN:​1-58488-372-3//​. +