]> www.ginac.de Git - ginac.git/blobdiff - ginac/pseries.cpp
Added complex conjugation methods and GiNaC function "conjugate".
[ginac.git] / ginac / pseries.cpp
index a99725e56e98e93b61ad0ce2d73580ab0de1d974..3528cbbdfcaca114a4667c50b7fffcd836edbae6 100644 (file)
@@ -4,7 +4,7 @@
  *  methods for series expansion. */
 
 /*
- *  GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -407,6 +407,23 @@ ex pseries::evalf(int level) const
        return (new pseries(relational(var,point), new_seq))->setflag(status_flags::dynallocated | status_flags::evaluated);
 }
 
+ex pseries::conjugate() const
+{
+       epvector * newseq = conjugateepvector(seq);
+       ex newvar = var.conjugate();
+       ex newpoint = point.conjugate();
+
+       if (!newseq     && are_ex_trivially_equal(newvar, var) && are_ex_trivially_equal(point, newpoint)) {
+               return *this;
+       }
+
+       ex result = (new pseries(newvar==newpoint, newseq ? *newseq : seq))->setflag(status_flags::dynallocated);
+       if (newseq) {
+               delete newseq;
+       }
+       return result;
+}
+
 ex pseries::subs(const exmap & m, unsigned options) const
 {
        // If expansion variable is being substituted, convert the series to a