Added polynomial factorization (univariate case).
authorJens Vollinga <jensv@nikhef.nl>
Sat, 9 Aug 2008 08:14:02 +0000 (10:14 +0200)
committerJens Vollinga <jensv@nikhef.nl>
Sat, 9 Aug 2008 08:14:02 +0000 (10:14 +0200)
check/Makefile.am
ginac/Makefile.am
ginac/ginac.h
ginsh/ginsh.1.in
ginsh/ginsh_parser.yy

index a96dcfe7e798fa7950d9d8e1cd856031d236329d..a34bb9f3724ce8d41107dea70fe48e895888a351 100644 (file)
@@ -15,6 +15,7 @@ EXAMS = exam_paranoia \
        exam_differentiation  \
        exam_polygcd  \
        exam_normalization  \
+       exam_factor \
        exam_pseries  \
        exam_matrices  \
        exam_lsolve  \
@@ -97,6 +98,9 @@ exam_polygcd_LDADD = ../ginac/libginac.la
 exam_normalization_SOURCES = exam_normalization.cpp
 exam_normalization_LDADD = ../ginac/libginac.la
 
+exam_factor_SOURCES = exam_factor.cpp
+exam_factor_LDADD = ../ginac/libginac.la
+
 exam_pseries_SOURCES = exam_pseries.cpp
 exam_pseries_LDADD = ../ginac/libginac.la
 
index a74418c594f9dd80bd60bece1e0a3307357ecd3d..d2ef614532908c9cf72d3a85c2dcfeb845ac2628 100644 (file)
@@ -3,7 +3,7 @@
 lib_LTLIBRARIES = libginac.la
 libginac_la_SOURCES = add.cpp archive.cpp basic.cpp clifford.cpp color.cpp \
   constant.cpp ex.cpp excompiler.cpp expair.cpp expairseq.cpp exprseq.cpp \
-  fail.cpp fderivative.cpp function.cpp idx.cpp indexed.cpp inifcns.cpp \
+  fail.cpp factor.cpp fderivative.cpp function.cpp idx.cpp indexed.cpp inifcns.cpp \
   inifcns_trans.cpp inifcns_gamma.cpp inifcns_nstdsums.cpp \
   integral.cpp lst.cpp matrix.cpp mul.cpp ncmul.cpp normal.cpp numeric.cpp \
   operators.cpp power.cpp registrar.cpp relational.cpp remember.cpp \
@@ -15,7 +15,7 @@ libginac_la_LIBADD = $(DL_LIBS)
 ginacincludedir = $(includedir)/ginac
 ginacinclude_HEADERS = ginac.h add.h archive.h assertion.h basic.h class_info.h \
   clifford.h color.h constant.h container.h ex.h excompiler.h expair.h expairseq.h \
-  exprseq.h fail.h fderivative.h flags.h function.h hash_map.h idx.h indexed.h \
+  exprseq.h fail.h factor.h fderivative.h flags.h function.h hash_map.h idx.h indexed.h \
   inifcns.h integral.h lst.h matrix.h mul.h ncmul.h normal.h numeric.h operators.h \
   power.h print.h pseries.h ptr.h registrar.h relational.h structure.h \
   symbol.h symmetry.h tensor.h version.h wildcard.h
index 4fe796e0a320b291148fb71d6c42388b1fa2110a..ad96e6403c057f6ee01d4f5375711a6ed343111f 100644 (file)
@@ -66,6 +66,8 @@
 #include "color.h"
 #include "clifford.h"
 
+#include "factor.h"
+
 #include "excompiler.h"
 
 #ifdef __MAKECINT__
index 8172a54faac7a312ac600128b6c8ff97b18d10c4..af18f4e7c51485ca88425131ad25e88de26b4ad2 100644 (file)
@@ -290,6 +290,9 @@ detail here. Please refer to the GiNaC documentation.
 .BI expand( expression )
 \- expands an expression
 .br
+.BI factor( expression )
+\- factorizes an expression (univariate)
+.br
 .BI find( expression ", " pattern )
 \- returns a list of all occurrences of a pattern in an expression
 .br
index e2913724de4b04ee03653db50f1ffbda5655ae16..b8c6875a2f96da32fb99817c3e82c5c5334222b7 100644 (file)
@@ -330,6 +330,7 @@ static ex f_evalf1(const exprseq &e) {return e[0].evalf();}
 static ex f_evalm(const exprseq &e) {return e[0].evalm();}
 static ex f_eval_integ(const exprseq &e) {return e[0].eval_integ();}
 static ex f_expand(const exprseq &e) {return e[0].expand();}
+static ex f_factor(const exprseq &e) {return factor(e[0]);}
 static ex f_gcd(const exprseq &e) {return gcd(e[0], e[1]);}
 static ex f_has(const exprseq &e) {return e[0].has(e[1]) ? ex(1) : ex(0);}
 static ex f_lcm(const exprseq &e) {return lcm(e[0], e[1]);}
@@ -610,6 +611,7 @@ static const fcn_init builtin_fcns[] = {
        {"evalm", f_evalm, 1},
        {"eval_integ", f_eval_integ, 1},
        {"expand", f_expand, 1},
+       {"factor", f_factor, 1},
        {"find", f_find, 2},
        {"fsolve", f_fsolve, 4},
        {"gcd", f_gcd, 2},