/[GiNaC]/ginac/idx.h
ViewVC logotype

Contents of /ginac/idx.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations)
Tue Nov 16 16:35:25 1999 UTC (13 years, 6 months ago) by cbauer
Branch: MAIN
Changes since 1.4: +3 -2 lines
File MIME type: text/plain
- modified the comment blocks so the copyright message no longer appears in
  the reference manual (made by Doxygen)

1 cbauer 1.1 /** @file idx.h
2     *
3 cbauer 1.5 * Interface to GiNaC's indices. */
4    
5     /*
6 cbauer 1.2 * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
7     *
8     * This program is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License as published by
10     * the Free Software Foundation; either version 2 of the License, or
11     * (at your option) any later version.
12     *
13     * This program is distributed in the hope that it will be useful,
14     * but WITHOUT ANY WARRANTY; without even the implied warranty of
15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16     * GNU General Public License for more details.
17     *
18     * You should have received a copy of the GNU General Public License
19     * along with this program; if not, write to the Free Software
20     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21     */
22 cbauer 1.1
23 cbauer 1.2 #ifndef __GINAC_IDX_H__
24     #define __GINAC_IDX_H__
25 cbauer 1.1
26     #include <string>
27     #include <vector>
28 cbauer 1.3 #include <ginac/basic.h>
29 cbauer 1.1
30     class idx : public basic
31     {
32     // member functions
33    
34     // default constructor, destructor, copy constructor assignment operator and helpers
35     public:
36     idx();
37     ~idx();
38     idx (idx const & other);
39     idx const & operator=(idx const & other);
40     protected:
41     void copy(idx const & other);
42     void destroy(bool call_parent);
43    
44     // other constructors
45     public:
46     explicit idx(bool cov);
47     explicit idx(string const & n, bool cov=false);
48     explicit idx(char const * n, bool cov=false);
49     explicit idx(unsigned const v, bool cov=false);
50    
51     // functions overriding virtual functions from bases classes
52     public:
53     basic * duplicate() const;
54     void printraw(ostream & os) const;
55     void printtree(ostream & os, unsigned indent) const;
56     void print(ostream & os, unsigned upper_precedence=0) const;
57     bool info(unsigned inf) const;
58     protected:
59     int compare_same_type(basic const & other) const;
60     bool is_equal_same_type(basic const & other) const;
61     unsigned calchash(void) const;
62     ex subs(lst const & ls, lst const & lr) const;
63    
64     // new virtual functions which can be overridden by derived classes
65     public:
66     virtual bool is_co_contra_pair(basic const & other) const;
67     virtual ex toggle_covariant(void) const;
68    
69     // non-virtual functions in this class
70     public:
71     bool is_symbolic(void) const;
72     unsigned get_value(void) const;
73     bool is_covariant(void) const;
74 frink 1.4 void setname(string const & n) {name=n;}
75     string getname(void) const {return name;}
76 cbauer 1.1
77     // member variables
78     protected:
79     unsigned serial;
80     bool symbolic;
81     string name;
82     unsigned value;
83     static unsigned next_serial;
84     bool covariant; // x_mu, default is contravariant: x^mu
85     };
86    
87     // global constants
88    
89     extern const idx some_idx;
90     extern type_info const & typeid_idx;
91    
92     // macros
93    
94     #define ex_to_idx(X) (static_cast<idx const &>(*(X).bp))
95    
96     // other functions
97    
98     typedef vector<ex> exvector;
99    
100     int canonicalize_indices(exvector & iv, bool antisymmetric=false);
101     exvector idx_intersect(exvector const & iv1, exvector const & iv2);
102     ex permute_free_index_to_front(exvector const & iv3, exvector const & iv2,
103     bool antisymmetric, int * sig);
104     unsigned subs_index_in_exvector(exvector & v, ex const & is, ex const & ir);
105     ex subs_indices(ex const & e, exvector const & idxv_contra,
106     exvector const & idxv_co);
107     unsigned count_index(ex const & e, ex const & i);
108    
109 cbauer 1.2 #endif // ndef __GINAC_IDX_H__

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.15