+bool varidx::match_same_type(const basic & other) const
+{
+ GINAC_ASSERT(is_a<varidx>(other));
+ const varidx &o = static_cast<const varidx &>(other);
+
+ if (covariant != o.covariant)
+ return false;
+ return inherited::match_same_type(other);
+}
+
+int spinidx::compare_same_type(const basic & other) const
+{
+ GINAC_ASSERT(is_a<spinidx>(other));
+ const spinidx &o = static_cast<const spinidx &>(other);
+
+ // Check dottedness first so dummy indices will end up next to each other
+ if (dotted != o.dotted)
+ return dotted ? -1 : 1;
+
+ int cmpval = inherited::compare_same_type(other);
+ if (cmpval)
+ return cmpval;
+
+ return 0;
+}
+
+bool spinidx::match_same_type(const basic & other) const
+{
+ GINAC_ASSERT(is_a<spinidx>(other));
+ const spinidx &o = static_cast<const spinidx &>(other);
+
+ if (dotted != o.dotted)
+ return false;
+ return inherited::match_same_type(other);
+}
+
+/** By default, basic::evalf would evaluate the index value but we don't want
+ * a.1 to become a.(1.0). */
+ex idx::evalf(int level) const
+{
+ return *this;
+}
+
+ex idx::subs(const lst & ls, const lst & lr, bool no_pattern) const