]> www.ginac.de Git - ginac.git/blobdiff - ginac/indexed.cpp
- indentation is now done with tabs
[ginac.git] / ginac / indexed.cpp
index fb35d8c1819967e3b89228eb48b8763d175d258b..0d26bd7256cccf84df9f6909f9d418ba34d3e034 100644 (file)
@@ -41,44 +41,44 @@ GINAC_IMPLEMENT_REGISTERED_CLASS(indexed, exprseq)
 
 indexed::indexed()
 {
-    debugmsg("indexed default constructor",LOGLEVEL_CONSTRUCT);
-    tinfo_key=TINFO_indexed;
+       debugmsg("indexed default constructor",LOGLEVEL_CONSTRUCT);
+       tinfo_key=TINFO_indexed;
 }
 
 indexed::~indexed()
 {
-    debugmsg("indexed destructor",LOGLEVEL_DESTRUCT);
-    destroy(0);
+       debugmsg("indexed destructor",LOGLEVEL_DESTRUCT);
+       destroy(0);
 }
 
 indexed::indexed(const indexed & other)
 {
-    debugmsg("indexed copy constructor",LOGLEVEL_CONSTRUCT);
-    copy (other);
+       debugmsg("indexed copy constructor",LOGLEVEL_CONSTRUCT);
+       copy (other);
 }
 
 const indexed & indexed::operator=(const indexed & other)
 {
-    debugmsg("indexed operator=",LOGLEVEL_ASSIGNMENT);
-    if (this != &other) {
-        destroy(1);
-        copy(other);
-    }
-    return *this;
+       debugmsg("indexed operator=",LOGLEVEL_ASSIGNMENT);
+       if (this != &other) {
+               destroy(1);
+               copy(other);
+       }
+       return *this;
 }
 
 // protected
 
 void indexed::copy(const indexed & other)
 {
-    inherited::copy(other);
+       inherited::copy(other);
 }
 
 void indexed::destroy(bool call_parent)
 {
-    if (call_parent) {
-        inherited::destroy(call_parent);
-    }
+       if (call_parent) {
+               inherited::destroy(call_parent);
+       }
 }
 
 //////////
@@ -89,46 +89,46 @@ void indexed::destroy(bool call_parent)
 
 indexed::indexed(const ex & i1) : inherited(i1)
 {
-    debugmsg("indexed constructor from ex",LOGLEVEL_CONSTRUCT);
-    tinfo_key=TINFO_indexed;
-    GINAC_ASSERT(all_of_type_idx());
+       debugmsg("indexed constructor from ex",LOGLEVEL_CONSTRUCT);
+       tinfo_key=TINFO_indexed;
+       GINAC_ASSERT(all_of_type_idx());
 }
 
 indexed::indexed(const ex & i1, const ex & i2) : inherited(i1,i2)
 {
-    debugmsg("indexed constructor from ex,ex",LOGLEVEL_CONSTRUCT);
-    tinfo_key=TINFO_indexed;
-    GINAC_ASSERT(all_of_type_idx());
+       debugmsg("indexed constructor from ex,ex",LOGLEVEL_CONSTRUCT);
+       tinfo_key=TINFO_indexed;
+       GINAC_ASSERT(all_of_type_idx());
 }
 
 indexed::indexed(const ex & i1, const ex & i2, const ex & i3)
-    : inherited(i1,i2,i3)
+       : inherited(i1,i2,i3)
 {
-    debugmsg("indexed constructor from ex,ex,ex",LOGLEVEL_CONSTRUCT);
-    tinfo_key=TINFO_indexed;
-    GINAC_ASSERT(all_of_type_idx());
+       debugmsg("indexed constructor from ex,ex,ex",LOGLEVEL_CONSTRUCT);
+       tinfo_key=TINFO_indexed;
+       GINAC_ASSERT(all_of_type_idx());
 }
 
 indexed::indexed(const ex & i1, const ex & i2, const ex & i3, const ex & i4)
-    : inherited(i1,i2,i3,i4)
+       : inherited(i1,i2,i3,i4)
 {
-    debugmsg("indexed constructor from ex,ex,ex,ex",LOGLEVEL_CONSTRUCT);
-    tinfo_key=TINFO_indexed;
-    GINAC_ASSERT(all_of_type_idx());
+       debugmsg("indexed constructor from ex,ex,ex,ex",LOGLEVEL_CONSTRUCT);
+       tinfo_key=TINFO_indexed;
+       GINAC_ASSERT(all_of_type_idx());
 }
 
 indexed::indexed(const exvector & iv) : inherited(iv)
 {
-    debugmsg("indexed constructor from exvector",LOGLEVEL_CONSTRUCT);
-    tinfo_key=TINFO_indexed;
-    GINAC_ASSERT(all_of_type_idx());
+       debugmsg("indexed constructor from exvector",LOGLEVEL_CONSTRUCT);
+       tinfo_key=TINFO_indexed;
+       GINAC_ASSERT(all_of_type_idx());
 }
 
 indexed::indexed(exvector * ivp) : inherited(ivp)
 {
-    debugmsg("indexed constructor from exvector *",LOGLEVEL_CONSTRUCT);
-    tinfo_key=TINFO_indexed;
-    GINAC_ASSERT(all_of_type_idx());
+       debugmsg("indexed constructor from exvector *",LOGLEVEL_CONSTRUCT);
+       tinfo_key=TINFO_indexed;
+       GINAC_ASSERT(all_of_type_idx());
 }
 
 //////////
@@ -138,20 +138,20 @@ indexed::indexed(exvector * ivp) : inherited(ivp)
 /** Construct object from archive_node. */
 indexed::indexed(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
 {
-    debugmsg("indexed constructor from archive_node", LOGLEVEL_CONSTRUCT);
-    tinfo_key = TINFO_indexed;
+       debugmsg("indexed constructor from archive_node", LOGLEVEL_CONSTRUCT);
+       tinfo_key = TINFO_indexed;
 }
 
 /** Unarchive the object. */
 ex indexed::unarchive(const archive_node &n, const lst &sym_lst)
 {
-    return (new indexed(n, sym_lst))->setflag(status_flags::dynallocated);
+       return (new indexed(n, sym_lst))->setflag(status_flags::dynallocated);
 }
 
 /** Archive the object. */
 void indexed::archive(archive_node &n) const
 {
-    inherited::archive(n);
+       inherited::archive(n);
 }
 
 //////////
@@ -162,61 +162,61 @@ void indexed::archive(archive_node &n) const
 
 basic * indexed::duplicate() const
 {
-    debugmsg("indexed duplicate",LOGLEVEL_DUPLICATE);
-    return new indexed(*this);
+       debugmsg("indexed duplicate",LOGLEVEL_DUPLICATE);
+       return new indexed(*this);
 }
 
 void indexed::printraw(std::ostream & os) const
 {
-    debugmsg("indexed printraw",LOGLEVEL_PRINT);
-    os << "indexed(indices=";
-    printrawindices(os);
-    os << ",hash=" << hashvalue << ",flags=" << flags << ")";
+       debugmsg("indexed printraw",LOGLEVEL_PRINT);
+       os << "indexed(indices=";
+       printrawindices(os);
+       os << ",hash=" << hashvalue << ",flags=" << flags << ")";
 }
 
 void indexed::printtree(std::ostream & os, unsigned indent) const
 {
-    debugmsg("indexed printtree",LOGLEVEL_PRINT);
-    os << std::string(indent,' ') << "indexed: " << seq.size() << " indices";
-    os << ",hash=" << hashvalue << ",flags=" << flags << std::endl;
-    printtreeindices(os,indent);
+       debugmsg("indexed printtree",LOGLEVEL_PRINT);
+       os << std::string(indent,' ') << "indexed: " << seq.size() << " indices";
+       os << ",hash=" << hashvalue << ",flags=" << flags << std::endl;
+       printtreeindices(os,indent);
 }
 
 void indexed::print(std::ostream & os, unsigned upper_precedence) const
 {
-    debugmsg("indexed print",LOGLEVEL_PRINT);
-    os << "UNNAMEDINDEX";
-    printindices(os);
+       debugmsg("indexed print",LOGLEVEL_PRINT);
+       os << "UNNAMEDINDEX";
+       printindices(os);
 }
 
 void indexed::printcsrc(std::ostream & os, unsigned type,
-                        unsigned upper_precedence) const
+                                               unsigned upper_precedence) const
 {
-    debugmsg("indexed print csrc",LOGLEVEL_PRINT);
-    print(os,upper_precedence);
+       debugmsg("indexed print csrc",LOGLEVEL_PRINT);
+       print(os,upper_precedence);
 }
 
 bool indexed::info(unsigned inf) const
 {
-    if (inf==info_flags::indexed) return true;
-    if (inf==info_flags::has_indices) return seq.size()!=0;
-    return inherited::info(inf);
+       if (inf==info_flags::indexed) return true;
+       if (inf==info_flags::has_indices) return seq.size()!=0;
+       return inherited::info(inf);
 }
 
 exvector indexed::get_indices(void) const
 {
-    return seq;
+       return seq;
 
-    /*
-    idxvector filtered_indices;
-    filtered_indices.reserve(indices.size());
-    for (idxvector::const_iterator cit=indices.begin(); cit!=indices.end(); ++cit) {
-        if ((*cit).get_type()==t) {
-            filtered_indices.push_back(*cit);
-        }
-    }
-    return filtered_indices;
-    */
+       /*
+       idxvector filtered_indices;
+       filtered_indices.reserve(indices.size());
+       for (idxvector::const_iterator cit=indices.begin(); cit!=indices.end(); ++cit) {
+               if ((*cit).get_type()==t) {
+                       filtered_indices.push_back(*cit);
+               }
+       }
+       return filtered_indices;
+       */
 }
 
 // protected
@@ -225,39 +225,39 @@ exvector indexed::get_indices(void) const
  *  @see ex::diff */
 ex indexed::derivative(const symbol & s) const
 {
-        return _ex0();
+               return _ex0();
 }
 
 int indexed::compare_same_type(const basic & other) const
 {
-    GINAC_ASSERT(is_of_type(other,indexed));
-    return inherited::compare_same_type(other);
+       GINAC_ASSERT(is_of_type(other,indexed));
+       return inherited::compare_same_type(other);
 }
 
 bool indexed::is_equal_same_type(const basic & other) const
 {
-    GINAC_ASSERT(is_of_type(other,indexed));
-    return inherited::is_equal_same_type(other);
+       GINAC_ASSERT(is_of_type(other,indexed));
+       return inherited::is_equal_same_type(other);
 }
 
 unsigned indexed::return_type(void) const
 {
-    return return_types::noncommutative;
+       return return_types::noncommutative;
 }
    
 unsigned indexed::return_type_tinfo(void) const
 {
-    return tinfo_key;
+       return tinfo_key;
 }
 
 ex indexed::thisexprseq(const exvector & v) const
 {
-    return indexed(v);
+       return indexed(v);
 }
 
 ex indexed::thisexprseq(exvector * vp) const
 {
-    return indexed(vp);
+       return indexed(vp);
 }
 
 //////////
@@ -274,51 +274,51 @@ ex indexed::thisexprseq(exvector * vp) const
 
 void indexed::printrawindices(std::ostream & os) const
 {
-    if (seq.size()!=0) {
-        for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
-            (*cit).printraw(os);
-            os << ",";
-        }
-    }
+       if (seq.size()!=0) {
+               for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+                       (*cit).printraw(os);
+                       os << ",";
+               }
+       }
 }
 
 void indexed::printtreeindices(std::ostream & os, unsigned indent) const
 {
-    if (seq.size()!=0) {
-        for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
-            os << std::string(indent+delta_indent,' ');
-            (*cit).printraw(os);
-            os << std::endl;
-        }
-    }
+       if (seq.size()!=0) {
+               for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+                       os << std::string(indent+delta_indent,' ');
+                       (*cit).printraw(os);
+                       os << std::endl;
+               }
+       }
 }
 
 void indexed::printindices(std::ostream & os) const
 {
-    if (seq.size()!=0) {
-        if (seq.size()>1) {
-            os << "{";
-        }
-        exvector::const_iterator last=seq.end()-1;
-        exvector::const_iterator cit=seq.begin();
-        for (; cit!=last; ++cit) {
-            (*cit).print(os);
-            os << ",";
-        }
-        (*cit).print(os);
-        if (seq.size()>1) {
-            os << "}";
-        }
-    }
+       if (seq.size()!=0) {
+               if (seq.size()>1) {
+                       os << "{";
+               }
+               exvector::const_iterator last=seq.end()-1;
+               exvector::const_iterator cit=seq.begin();
+               for (; cit!=last; ++cit) {
+                       (*cit).print(os);
+                       os << ",";
+               }
+               (*cit).print(os);
+               if (seq.size()>1) {
+                       os << "}";
+               }
+       }
 }
 
 bool indexed::all_of_type_idx(void) const
 {
-    // used only inside of ASSERTs
-    for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
-        if (!is_ex_of_type(*cit,idx)) return false;
-    }
-    return true;
+       // used only inside of ASSERTs
+       for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+               if (!is_ex_of_type(*cit,idx)) return false;
+       }
+       return true;
 }
 
 //////////