+ /** Get value of index. */
+ ex get_value(void) const {return value;}
+
+ /** Check whether the index is numeric. */
+ bool is_numeric(void) const {return is_ex_exactly_of_type(value, numeric);}
+
+ /** Check whether the index is symbolic. */
+ bool is_symbolic(void) const {return !is_ex_exactly_of_type(value, numeric);}
+
+ /** Get dimension of index space. */
+ ex get_dim(void) const {return dim;}
+
+ /** Check whether the dimension is numeric. */
+ bool is_dim_numeric(void) const {return is_ex_exactly_of_type(dim, numeric);}
+
+ /** Check whether the dimension is symbolic. */
+ bool is_dim_symbolic(void) const {return !is_ex_exactly_of_type(dim, numeric);}
+
+protected:
+ ex value; /**< Expression that constitutes the index (numeric or symbolic name) */
+ ex dim; /**< Dimension of space (can be symbolic or numeric) */
+};
+
+
+/** This class holds an index with a variance (co- or contravariant). There
+ * is an associated metric tensor that can be used to raise/lower indices. */
+class varidx : public idx
+{
+ GINAC_DECLARE_REGISTERED_CLASS(varidx, idx)
+
+ // other constructors
+public:
+ /** Construct index with given value, dimension and variance.
+ *
+ * @param v Value of index (numeric or symbolic)
+ * @param dim Dimension of index space (numeric or symbolic)
+ * @param covariant Make covariant index (default is contravariant)
+ * @return newly constructed index */
+ varidx(const ex & v, const ex & dim, bool covariant = false);