source: git/Singular/CanonicalPoly.cc @ a388ae

spielwiese
Last change on this file since a388ae was a388ae, checked in by Frank Seelisch <seelisch@…>, 14 years ago
added doxygen-like comments git-svn-id: file:///usr/local/Singular/svn/trunk@12198 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.9 KB
Line 
1#include "mod2.h"
2
3#ifdef HAVE_WRAPPERS
4
5#include <iostream>
6#include "structs.h"
7#include "polys.h"
8#include "Wrappers.h"
9#include "CanonicalPoly.h"
10
11CanonicalPoly::CanonicalPoly (const SingularPoly& sp, const RingWrapper& r):InternPoly(r)
12{
13  +prpr > "CanonicalPoly constructor with poly argument = " <
14        p_String(sp, r.getSingularRing(), r.getSingularRing());
15  m_poly = sp;
16}
17
18CanonicalPoly::CanonicalPoly (const int i, const RingWrapper& r):InternPoly(r)
19{
20  +prpr > "CanonicalPoly constructor with int argument = " < i;
21  m_poly = p_ISet(i, r.getSingularRing());
22}
23
24CanonicalPoly::~CanonicalPoly ()
25{
26  +prpr > "CanonicalPoly destructor, object = " < this->toString();
27}
28
29char* CanonicalPoly::toString () const
30{
31  SingularRing r = this->getRing().getSingularRing();
32  return p_String(this->getSingularPoly(), r, r);
33}
34
35void CanonicalPoly::addCompatible (const InternPoly* ip)
36{
37  if (ip->getPolyType() == CANONICAL_POLY_TYPE)
38  {
39    const CanonicalPoly* pcp = static_cast<const CanonicalPoly*>(ip);
40    +prpr > "value of CanonicalPoly is being changed";
41    prpr+1;
42    +prpr > "old value = " < this->toString();
43    +prpr > "value to be added = " < pcp->toString();
44    m_poly = p_Add_q(m_poly, pcp->deepCopy()->getSingularPoly(), this->getRing().getSingularRing());
45    +prpr > "new value = " < this->toString();
46    prpr-1;
47    +prpr > "value of CanonicalPoly has been changed";
48  }
49  else
50    assume(false);
51}
52
53int CanonicalPoly::getPolyType () const
54{
55  return CANONICAL_POLY_TYPE;
56}
57
58const SingularPoly& CanonicalPoly::getSingularPoly () const
59{
60  return m_poly;
61}
62
63CanonicalPoly* CanonicalPoly::deepCopy () const
64{
65  +prpr > "creating a deep copy of CanonicalPoly, argument = " < this->toString();
66  SingularPoly sp = p_Copy(this->getSingularPoly(), this->getRing().getSingularRing()); /* SINGULAR poly is deeply copied. */
67  CanonicalPoly* pcp = new CanonicalPoly(sp, this->getRing()); /* ring is not deeply copied! */
68  return pcp;
69}
70
71#endif
72/* HAVE_WRAPPERS */
Note: See TracBrowser for help on using the repository browser.