]> www.ginac.de Git - ginac.git/blobdiff - check/exam_mod_gcd.cpp
Happy New Year!
[ginac.git] / check / exam_mod_gcd.cpp
index 4407d90aad2681b084e9c105a183ff4cba22c757..c551c673b7e0b93da74e25f0e1fac2b78f947125 100644 (file)
@@ -1,11 +1,35 @@
-#include "polynomial/upoly.hpp"
-#include "polynomial/upoly_io.hpp"
-#include "polynomial/mod_gcd.hpp"
-#include "ginac.h"
+/** @file exam_misc.cpp
+ *
+ *  Testing modular GCD.
+ */
+
+/*
+ *  GiNaC Copyright (C) 1999-2019 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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
 #include <cln/random.h>
-#include <string>
 #include <iostream>
 #include <map>
+#include <string>
+
+#include "polynomial/upoly.h"
+#include "polynomial/upoly_io.h"
+#include "polynomial/mod_gcd.h"
+#include "ginac.h"
 using namespace GiNaC;
 
 static upoly ex_to_upoly(const ex& e, const symbol& x);
@@ -67,7 +91,7 @@ static ex upoly_to_ex(const upoly& p, const symbol& x)
        exvector tv(p.size());
        for (std::size_t i = 0; i < p.size(); ++i)
                tv[i] = pow(x, i)*numeric(p[i]);
-       return (new add(tv))->setflag(status_flags::dynallocated);
+       return dynallocate<add>(tv);
 }
 
 static upoly make_random_upoly(const std::size_t deg)
@@ -82,4 +106,3 @@ static upoly make_random_upoly(const std::size_t deg)
                p[deg] = cln::random_I(biggish);
        return p;
 }
-