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 a96dcfe..a34bb9f 100644 (file)
@@ -15,6 +15,7 @@ EXAMS = exam_paranoia \
        exam_differentiation  \
        exam_polygcd  \
        exam_normalization  \
        exam_differentiation  \
        exam_polygcd  \
        exam_normalization  \
+       exam_factor \
        exam_pseries  \
        exam_matrices  \
        exam_lsolve  \
        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_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
 
 exam_pseries_SOURCES = exam_pseries.cpp
 exam_pseries_LDADD = ../ginac/libginac.la
 
index a74418c..d2ef614 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 \
 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 \
   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 \
 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
   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 4fe796e..ad96e64 100644 (file)
@@ -66,6 +66,8 @@
 #include "color.h"
 #include "clifford.h"
 
 #include "color.h"
 #include "clifford.h"
 
+#include "factor.h"
+
 #include "excompiler.h"
 
 #ifdef __MAKECINT__
 #include "excompiler.h"
 
 #ifdef __MAKECINT__
index 8172a54..af18f4e 100644 (file)
@@ -290,6 +290,9 @@ detail here. Please refer to the GiNaC documentation.
 .BI expand( expression )
 \- expands an expression
 .br
 .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
 .BI find( expression ", " pattern )
 \- returns a list of all occurrences of a pattern in an expression
 .br
index e291372..b8c6875 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_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]);}
 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},
        {"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},
        {"find", f_find, 2},
        {"fsolve", f_fsolve, 4},
        {"gcd", f_gcd, 2},