source: git/factory/README @ e14941

fieker-DuValspielwiese
Last change on this file since e14941 was 650f2d8, checked in by Mohamed Barakat <mohamed.barakat@…>, 13 years ago
renamed assert.h -> cf_assert.h in factory
  • Property mode set to 100644
File size: 21.0 KB
RevLine 
[57c38e]1
2
[d916c6]3  --- This `README' file corresponds to Singular-Factory version 3.1 ---
[57c38e]4
5
[20e558]6                  README file for Singular-Factory
7                  ================================
[57c38e]8
[20e558]9NOTE: The copyright of Singular-Factory is described in the
[ccf43d5]10      file COPYING
[e4126a]11
[57c38e]12Overview
[51268e]13========
[e4126a]141.  What is Factory?
152.  Comments, Questions, Bug Reports
163.  Installation
174.  Distribution
185.  Prerequisites
196.  Memory Manager
207.  Stream IO
218.  Diagnostic Messages
229.  GF(q) Tables
2310. A Note on Singular
2411. Configure Options, Dependencies
2512. Linking Factory with Your Application
2613. Factory Template Instantiation
2714. Documentation
2815. Examples and Tests
2916. Editing Factory
3017. Files in the Distribution
[51268e]31
32
331. What is Factory?
34===================
[57c38e]35  Factory is a C++ class library that implements a recursive representation
[51268e]36of multivariate polynomial data.  It is being developed by Ruediger Stobbe
37and Jens Schmidt at the University of Kaiserslautern as an independent and
38self-contained part of the computer algebra system Singular (developed by
39G.-M. Greuel, G. Pfister and H. Schoenemann).
[57c38e]40
41  Factory handles sparse multivariate polynomials over different
42coefficient domains, such as Z, Q and GF(q), as well as algebraic
[51268e]43extensions over Q and GF(q) in an efficient way.  Factory includes
44algorithms for computing univariate and multivariate gcds, resultants,
[e4126a]45chinese remainders, and several algorithms to factorize univariate
[51268e]46polynomials over the integers and over finite fields.  Factorization of
47multivariate polynomials over the integers is in beta test stage.
[57c38e]48
49  The interface to the polynomial system of Factory is provided by a single
[e4126a]50class `CanonicalForm' which can deal with elements of the coefficient
51domain as well as polynomials.  Using operator overloading, you can handle
[57c38e]52polynomial data similarly to built-in types such as the machine integers.
[e4126a]53For example, to add two polynomials one simply uses the `+' operator.
54Because of this, Factory is easy to use even if you are not familiar with
55C++ programming.
[57c38e]56
57  There are a couple of utility classes provided by Factory such as lists,
58arrays, polynomial maps, etc.  These make the usage more comfortable.
59
[790737]60
[e4126a]612. Comments, Questions, Bug Reports
[51268e]62====================================
63  Factory is a project in evolution.  That means there is no guarantee that
64Factory is bug free.  I am sure that there are bugs or at least features.
65If you find bugs or if you find a strange behavior of the library, please
[8a47d24]66let me know (e-mail: singular@mathematik.uni-kl.de>).
[51268e]67Comments and questions are welcome, too.
[e4126a]68
[790737]69  Factory version 1.2c and newer define an external variable
[e4126a]70`factoryVersion' describing the version of the library.  The external
71variable `factoryConfiguration' (not present in versions 1.2c and 1.3a)
72describes the options Factory has been configured with.  Please include the
73version number and the configuration options in your bug reports.  You may
74either use the UNIX utility `what' to get this information (`what libcf.a')
75or compile and run something similar to this:
[57c38e]76
[790737]77  #include <factory.h>
[e4126a]78  main() { cout << factoryVersion << "; " << factoryConfiguration << endl; }
[57c38e]79
[51268e]803. Installation
81===============
82NOTE: If you have received this Factory distribution together with Singular
83you do not have to worry about compilation or installation at all.  The
84installation procedure for Singular should do everything for you.  For more
[e4126a]85information, see the section "A Note on Singular".
[51268e]86
[e4126a]87  See the `INSTALL' file for instructions on how to install Factory.  The
[b7ef56]88installation procedure on UNIX platforms conforms more or less to the GNU
89standard:
[a16c0d]90
91  ./configure; make; make gftables; make install; make installgftables
[57c38e]92
[a16c0d]93However, I recommend to read the instructions since there are a lot of
94non-standard options to configure.
[57c38e]95
[b7ef56]96  On platforms other than UNIX, where there is no `configure', you have to
97configure and install Factory by hand.  In particular, you have to
98create/edit the files `config.h', `factory.h', `factoryconf.h', and
99`GNUmakefile'.  For Microsoft Windows NT 4.0 with the Microsoft Visual C++
1005.0 compiler there is a preconfigured environment in the `winnt/' directory
101which you may use as an example.  For more information, confer to
102corresponding section in the `INSTALL' file and to the `INSTALL.nt' file in
103the `winnt/' directory.
104
105  In general, this `README' as well as the `INSTALL' file are written for
106UNIX platforms.  However, you may find less specific information on the
107configuration and installation process which is useful for other platforms,
108too.
109
[a16c0d]110
[51268e]1114. Distribution
112===============
[e4126a]113  The latest version of Factory is always available by anonymous ftp from
[57c38e]114
[858757]115                www.mathematik.uni-kl.de:/pub/Math/Singular/Factory
[57c38e]116
117The Factory distribution consists of three archives:
118
[e4126a]119o the Factory source code (`factory-<version>.tgz');
120o some preliminary documentation on Factory (`factory-doc-prelim.tgz');
121o Factory GF(q) addition tables (`factory-gftables.tgz', see below).
[57c38e]122
123
[51268e]1245. Prerequisites
125================
[a16c0d]126  You need GNU make to build and install Factory.  Furthermore, I strongly
127recommend to build Factory with GNU CC (version 2.7 or newer).  To build
128Factory and to link your programs with Factory you need the GNU Multiple
129Precision Library (GMP, version 2.0 or newer).  The GMP library is
130available at ftp.gnu.ai.mit.edu or its mirrors.  Alternatively, Factory may
131be linked with the so called small GMP library which comes with the full
132version of Singular (not recommended).
[57c38e]133
[a16c0d]134Configure options:
[51268e]135------------------
[a16c0d]136  --with-gmp(=<gmp_inc_path>(,<gmp_lib_path>))
[e4126a]137                          specify where to find the GMP library.
138  --enable-gmp            together with `--with-Singular' means: installation
139                          in process, be graceful when there is no `gmp.h'
[a16c0d]140
141  If <gmp_lib_path> is not given, but <gmp_inc_path> is,
[e4126a]142`<gmp_inc_path>/../lib/' is used as <gmp_lib_path>.  If neither
143<gmp_lib_path> nor <gmp_inc_path> is specified, `configure' looks in the
[a16c0d]144standard system locations for GMP.
145
[e4126a]146  Furthermore, you may specify the symbolic directory `$(includedir)' for
[a16c0d]147<gmp_inc_path>:
148
149  --with-gmp='$(includedir)'
150
[e4126a]151Do not forget the single quotes or otherwise your shell might complain.
152
[50901d]153  This is useful when Factory is delivered as part of a larger package
[a16c0d]154which also provides the GMP library.  In this case, at configuration time
[e4126a]155there would not be any `gmp.h'.  Without this option, Factory's `configure'
[50901d]156script would exit with an error message.  If this symbolic directory is
[e4126a]157given, the `configure' script does not look for `gmp.h' and `libgmp.a'.
158Rather, it adds the option `-I$(includedir)' to its `$(CXXFLAGS)' and the
159option `-L$(libdir)' to its `$(LDFLAGS)' assuming that at compilation-time
160`gmp.h' and `libgmp.a' will reside in these directories.
161  The option `--enable-gmp' does the same, but it is a special (and ugly)
162gift to Singular, so it may be used with option `--with-Singular' only.
[a16c0d]163
164
[e4126a]1656. Memory Manager
[51268e]166=================
167  You can use one of the memory management tools provided with Factory.
[e4126a]168There are the "new" and the "old" memory manager.  In fact, on some systems
169the old memory management seems to be faster then the new one, but so far
[51268e]170there have not been systematic timings.  If you configure Factory with
[e4126a]171`--with-memman=no' it will use the standard C++ operators `new'/`delete',
172which is not recommended.
173  You may trace the actions (allocate/free) of the new memory manager by
[51268e]174enabling memory management debugging.  This produces a *lot* of output.
[a16c0d]175
176Configure options:
[51268e]177------------------
178  --with-memman(=<memman>) specify Factory memory manager.
[e4126a]179                          <memman> is either `old' (default), `new', or `no'.
[51268e]180  --enable-memdebug=<level> switch on memory management debugging.  Meaningful
[e4126a]181                          with `--with-memman=new' only.  <level> may be either
182                          `no' (default), `normal', or `full'.
[a16c0d]183
184
[51268e]1857. Stream IO
186============
187  For use with other systems which have their own IO routines to print
[50901d]188polynomials it is possible to switch off Factory's stream IO.  In this
189case, you do not need to link libg++ or libiostream with Factory.
[a16c0d]190
191Configure options:
[51268e]192------------------
193  --disable-streamio      build Factory without stream IO
[a16c0d]194
195
[e4126a]1968. Diagnostic Messages
[51268e]197======================
[a16c0d]198Factory has three types of diagnostic messages:
[650f2d8]199o Assertions (implemented by the "ASSERT macros" in `cf_assert.h') are used to
[51268e]200  ensure preconditions before running some algorithm.  A typical example is
[a16c0d]201  to test f != 0 before dividing by f.
[e4126a]202o Debug output (implemented by the "DEBOUT macros" in `debug.h'/`debug.cc')
203  is used to trace complex algorithms, e.g. factorization.
204o Timing information may be accumulated and printed using the "TIMING macros"
205  in `timing.h'.
[a16c0d]206
207  Since all diagnostic messages are implemented using preprocessor macros,
[50901d]208they will completely cease when disabled, thus avoiding any impact on
[e4126a]209speed.  For more information, see section "Configuring and building Factory
210for different configurations" in the `INSTALL' file.  By default, all
[50901d]211diagnostic messages are disabled.
[a16c0d]212
213Configure options:
[51268e]214------------------
215  --enable-assertions     build Factory with assertions activated
216  --enable-timing         build Factory so it will print timing information
217  --enable-debugoutput    build Factory so it will print debugging information
[a16c0d]218
219
[e4126a]2209. GF(q) Tables
[51268e]221===============
[a16c0d]222
223NOTE: Since the format of the GF(q) tables changed from Factory Version
2241.2b to Factory Version 1.3a you should get/create them by new!
225
[e4126a]226  Factory uses addition tables to calculate in GF(p^n) in an efficient way.
227
[57c38e]228There are two possibilities to get these tables:
[e4126a]229o get them from the net (`factory-gftables.tgz') where you got Factory
230  from.  The files unpack into a directory `gftables/'.
231o create them with `gengftables' which is a part of Factory.  Building
[57c38e]232  the tables takes quite a while!
[e4126a]233See the `INSTALL' file for more information.
[57c38e]234
235
[e4126a]23610. A Note on Singular
[51268e]237=====================
[57c38e]238  If you have received this Factory distribution together with Singular you
239do not have to worry about compilation or installation at all.  The
240installation procedure for Singular should do everything for you.  If you
241want to configure/build the package on your own instead of letting
[e4126a]242Singular's `configure' do the work you should:
[57c38e]243
[a16c0d]244  ./configure --with-Singular --enable-gmp
[57c38e]245        (or, equivalently: )
[a16c0d]246  ./configure --with-Singular --with-gmp='${includedir}'
[57c38e]247
[e4126a]248  Furthermore, you should specify `--prefix' so `make install' will install
[57c38e]249the files in the places where Singular looks for them.  By default, this is
250the top directory of the Singular distribution.  In this case you have to
[e4126a]251specify `--prefix=..'.
[57c38e]252
[a16c0d]253  The Singular GF(q) tables are the same as the Factory GF(q) tables.
254However, Singular uses a different naming scheme.  Therefore, a Factory
[e4126a]255configured with `--without-Singular' will not find Singular's GF(q) tables
256as well as a Factory configured with `--with-Singular' will not find the
[51268e]257GF(q) tables created by gengftables.  But this is not a major drawback
258since Singular is distributed with ready-to-use GF(q) tables.
259
[e4126a]260  The latest version of Singular is always available at
[51268e]261www.mathematik.uni-kl.de:/pub/Math/Singular.
[a16c0d]262
263Configure options:
[51268e]264------------------
[a16c0d]265  --with-Singular         build for use with computer algebra system Singular.
266
[e4126a]267  Except from setting the `#define SINGULAR', this option only changes the
268defaults to: `--with-memman=no --disable-streamio'.
[a16c0d]269
270
[e4126a]27111. Configure Options, Dependencies
[51268e]272===================================
[e4126a]273o do not configure `--with-Singular --with-memman'.  In this case
[51268e]274  both Singular and the library will try to initialize their own memory
275  management.
[a16c0d]276
[e4126a]277o do not configure `--disable-streamio --enable-debugoutput'.  The
278  "DEBOUT macros" need stream IO.
[a16c0d]279
[e4126a]280o you may configure `--with-Singular --enable-streamio', but this
[a16c0d]281  is not supported by Singular.  You will have to change manually
[e4126a]282  Singular's `Makefile'.  The same is true for `--with-Singular
[50901d]283  --enable-streamio --enable-debugoutput'.
[a16c0d]284
[e4126a]285o you may configure `--with-Singular --enable-timing', but this
[a16c0d]286  will not have any visible effect (except from a slightly slower
287  running time) because Singular will not print the timing
288  results.
289
[e4126a]290o `--enable-gmp' has an effect only together with `--with-Singular'
291
292o `--with-memdebug' has an effect only together with
293  `--with-memman=new'
294
295
29612. Linking Factory With Your Application
297=========================================
298  To translate your application you need (apart from your
299application, of course):
300
301o the Factory user interface header file (`factory.h')
302
303  To link your application with Factory you need:
304
305o the Factory library (`libcf.a')
306o unless you configured Factory `--without-memman' you need one of the
307  Factory memory manager libraries (`libcfmem.a')
308
309o the instantiated Factory templates (`ftmpl_inst.o').
310
311o unless you configured Factory `--without-streamio' you need the stream IO
312  libraries.  With GNU CC, you do not need to care about this because they
313  are linked automatically to your application if you call the compiler
314  either as `g++' or as `c++'.  Otherwise, you need to link with library
315  `libiostream.a'.
316o The GNU Multiple Precision Library (`libgmp.a').  See section
317  "Prerequisites" in this file for more information.
318o The standard mathematical library (`libm.a')
319
320  `factory.h', `libcf.a', and `libcfmem.a' are created when you build
321Factory and installed by `make install'.  `libiostream.a', `libgmp.a', and
322`libm.a' should be already installed on your system, otherwise your
323application will fail to link.  `ftmpl_inst.o' is not installed by Factory.
324Instead, its source file `ftmpl_inst.cc' is installed and you have to build
325`ftmpl_inst.o' when you are building your application.  For more
326information on template instantiation and `ftmpl_inst.cc', see the
327following section "Factory Template Instantiation".
328
329  To give an example, look at the following one-shot solution to the
330problem "linking Factory with your application" where the "application" is
[b7ef56]331a small test program (`application.cc') from the subdirectory `examples/'
[e4126a]332of the Factory source directory ('\' at the end of a line denotes line
333continuation):
334
335  g++ -c /usr/local/include/templates/ftmpl_inst.cc \
336    -fno-implicit-templates -O2 -fomit-frame-pointer -o ftmpl_inst.o
337  g++ -c application.cc -fno-implicit-templates -O2 -fomit-frame-pointer \
338    ftmpl_inst.o -lcf -lcfmem -lm -lgmp
339
340  This should work fine provided that you installed Factory in a location
341where `g++' may find it (here I have assumed `/usr/local/') and all the
342other files mentioned above are installed properly and where `g++' looks
343for them.
344
345  You may find a small `GNUmakefile' which translates `application.cc' and
346other examples in the `examples/' subdirectory of the Factory source
347directory.  For more information, see the section "Examples and Tests".
348
349
35013. Factory Template Instantiation
351==================================
352  There are a couple of classes provided by Factory such as lists, arrays,
353etc, which may be used to derive new abstract data types from already
354existing ones.  Factory uses them itself, e.g. to return the result of a
355factorization (a list of factors), and you may use them to create new
356derived abstract data types.  These classes are realized using C++
357"templates", which you need to "instantiate" befor you use them (refer to
358some introduction to C++ if you do not know these terms).
359
360  With GNU CC the most reliable way to instantiate templates is to
361
362o explicitely instantiate all necessary templates, and compile with option
363  `-fno-implicit-templates' and to
364o collect all explicit template instantiations in one single file.
365
366  This approach is the one Factory uses.  All object files of the library
367are generated with option `--fno-implicit-templates' and the explicit
368template instantiations are collected in `ftmpl_inst.cc'.  You could
369translate this file using the `make' target `ftmpl_inst.o' (see section
370"Building Factory" in the `INSTALL' file).
371
372  The consequence of this approach: since you may want to add template
373instantiations of Factory's or your own templates after the installation of
374Factory, it is necessary to install `ftmpl_inst.cc' as well as the template
375source files together with the library.  They are automatically installed
376in `$(includedir)/templates/' when you type `make install'.
377
378  To join your own template instantiations with the ones from
379`ftmpl_inst.cc' there are several possibilities:
380
381o you copy `ftmpl_inst.cc' file from the directory where it was installed
382  into your working directory and add your template instantiations after
383  the corresponig comment at the end of the file;
384o you cut the template instantiations from `ftmpl_inst.cc' and paste
385  them into your own template instantiation file.
386
387Both methods suffer from one disadvantage: each time `ftmpl_inst.cc'
388changes in a new version of Factory you will have to redo these steps.  The
389best method therefore is maybe this one:
390
391o you write your own template instantiation file with a
392  `#include <templates/ftmpl_inst.cc>' statement at the beginning of it.
[a16c0d]393
[e4126a]394
39514. Documentation
[51268e]396=================
[a16c0d]397  So far there are only preliminary versions of a user/reference manual and
[e4126a]398a tutorial ("A quick start into Factory").  Please do not expect them to
399be error-free or even complete.  For this reason, the documentation is not
400included in the source code archive (`factory-<version>.tgz').  Instead, the
401sources and compiled DVI files reside in `factory-doc-prelim.tgz'. They will
402unpack into a directory `factory-doc-prelim/'.
[a16c0d]403
404
[e4126a]40515. Examples and Tests
[51268e]406======================
[e4126a]407  The directory `examples/' in the Factory source directory contains some
408example applications for Factory and a `GNUmakefile' to build them.  The
409main purpose of the examples is to show how to link applications with an
410installed version of Factory.  This means that you have to install Factory
411before you can build the examples (but it is not necessary to install the
412GF(q) tables).  For the same reason, the `GNUmakefile' is not configured
413automatically by `configure'.  You will have to change some of the
414variables manually.
415
416  Furthermore, you may have a look at `gengftables.cc' in the Factory
417source directory which is another application of the most basic Factory
418features.
[a16c0d]419
[e4126a]420  To test whether Factory (including GF(q) tables) has been installed
421properly, use `make' target `installtest'.
[e41784]422
[e4126a]423
42416. Editing Factory
[e41784]425===================
[e4126a]426  Parts of Factory are written using GNU Emacs' `folding-mode'.  You may
427load this mode from Emacs with
428
429  M-x load-file RET factory-<version>/bin/folding.el RET
430
431To switch it on, say `M-x folding-mode RET'.  Alternatively, you may load
432`factory-<version>/bin/fold-docu.el' which contains some additional functions
[33592c8]433to fold only the documentation.  If you add the following lines to your
[e4126a]434`.emacs' file, all this would be done automatically for you:
[33592c8]435
[790737]436  (load-file "factory-<version>/bin/folding.el")
437  (load-file "factory-<version>/bin/fold-docu.el")
[33592c8]438  (add-hook 'c-mode-common-hook 'folding-mode)
439  (setq fold-fold-on-startup nil
440        fold-mode-marks-alist '((c++-mode "//{{{" "//}}}")))
441  (set-default 'fold-internal-margins nil)
442
443  For more information, see the respective files.
[e41784]444
[a16c0d]445
[e4126a]44617. Files in the Distribution
[51268e]447=============================
[57c38e]448ChangeLog       - history of changes
449INSTALL         - installation instructions
450NEWS            - new Factory features
[e4126a]451README          - this file
[57c38e]452
[e4126a]453bin/install-sh  - a script version of the BSD `install' program
454bin/makeheader  - creates headers from header templates (`*.template')
455bin/mkinstalldirs - recursive `mkdir'
456bin/folding.el  - Emacs `folding-mode'
[e41784]457bin/fold-docu.el - some extensions to it
[57c38e]458
459GNUmakefile.in  - master makefile and
[e4126a]460config.h.in     - configuration include file.  Run `configure' to create
461                  `GNUmakefile' and `config.h', resp.
[57c38e]462configure
[e4126a]463configure.in    - `configure' script generated with Autoconf 2.10
464                  from `configure.in'
[57c38e]465
466factory.template
467factoryconf.template - header templates for the user interface header
[e4126a]468                  files.  Run `makeheader' to create `factory.h' and
469                  `factoryconf.h', resp.
[57c38e]470
471ffops.cc
472ffops.h
473gf_tabutil.cc
474gf_tabutil.h
475gfops.cc
476gfops.h
477imm.h
478int_*.cc
479int_*.h         - low level classes and functions
480
481canonicalform.cc
482canonicalform.h
483cf_*.cc
484cf_*.h
485variable.cc
486variable.h      - high level classes and functions.  User interface to
487                  the polynomial (and other) arithmetic.
488
[51268e]489templates/      - Factory templates
490ftmpl_inst.cc   - template instantiation for Factory templates
[57c38e]491
492fac_*.cc
493fac_*.h         - high level algorithms (factorization, gcd, sqfr
494                  computation, etc.)
495sm_*.c
496sm_*.h          - sparse modular gcd.  Contributed by Marion Bruder
497                  <bruder@math.uni-sb.de>
498
499parseutil.cc
500parseutil.h
501readcf.cc
[e4126a]502readcf.y        - Factory parser to read canonical forms.  `readcf.cc'
503                  translated with Bison 1.18 from `readcf.y'.
[57c38e]504
505gmpext.h
506initgmp.cc      - Factories interface to GNU MP
507singext.cc
508singext.h       - Factories interface to Singular
509
[8a47d24]510NTLconvert.*    - some conversion routines for using NTL
511
[57c38e]512memutil.c
[e4126a]513memutil.h       - "old" Factory memory manager
[57c38e]514memman.h
515mm*.c
[e4126a]516mm*.h           - "new" Factory memory manager
[57c38e]517newdelete.cc    - C++ interface to the memory managers
518
[650f2d8]519cf_assert.h     - the "ASSERT macros"
[57c38e]520debug.h
[e4126a]521debug.cc        - the "DEBOUT macros"
522timing.h        - the "TIMING macros"
[57c38e]523
[e4126a]524examples/       - some example applications for Factory and a `GNUmakefile'
525                  to build them
526gengftables.cc  - run `gengftables' to create the GF(q) addition tables
[57c38e]527                  necessary to work with Factory
[e4126a]528test_install.cc - a small program to test whether installation has
529                  been successful.  Built and called by `make' target
530                  `installtest'
Note: See TracBrowser for help on using the repository browser.