1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
*******************************************************************************
********** The easiest way to use libnormaliz **********
*******************************************************************************
This version of libnormaliz is considered to be stable. We would be happy to
hear from you if you are using libnormaliz (mailto: normaliz@uos.de).
More information on normaliz:
http://www.mathematik.uni-osnabrueck.de/normaliz/
Preperation:
Check the compile instructions in ../INSTALL
Quick workflow overview:
1) include libnormaliz/cone.h in your source code
2) create a libnormaliz::Cone object
3) call one of the Cone.compute() methods
4) check if the desired data is computed: isComputed( X )
5) get the data: getX()
6) repeat 4+5 or 3+4+5
Then link against libnormaliz. It might be necessary to activate compilation with OpenMP (in g++ use the -fopenmp flag).
In version 3.0 the default template parameter should be mpz_class.
Internally libnormaliz will still use a smaller integer type in the
computations if possible and switch to mpz_class where necessary.
If you use another type, e.g. long, libnormaliz will use this type for
computations and will throw an exception if it fails.
Example:
typedef mpz_class Integer;
// get some input data
std::vector< std::vector <Integer> > Data = ...
libnormaliz::Type::InputType type = integral_closure; // for all input types see below
libnormaliz::Cone<Integer> MyCone = libnormaliz::Cone<Integer>(type, Data);
libnormaliz::ConeProperties Wanted;
Wanted.set(libnormaliz::ConeProperty::Triangulation, libnormaliz::ConeProperty::HilbertBasis);
MyCone.compute(Wanted);
// or just
MyCone.compute(libnormaliz::ConeProperty::Triangulation, libnormaliz::ConeProperty::HilbertBasis);
if (MyCone.isComputed(libnormaliz::ConeProperty::HilbertBasis)) {
std::vector< std::vector< Integer> > HB& = MyCone.getHilbertBasis();
//use it
}
if (MyCone.isComputed(libnormaliz::ConeProperty::Multiplicity)) {
cout << "MyCone has multiplicity " << MyCone.getMultiplicity();
}
Possible InputTypes (from libnormaliz.h):
integral_closure,
polyhedron,
normalization,
polytope,
rees_algebra,
inequalities,
strict_inequalities,
signs,
strict_signs,
equations,
congruences,
inhom_inequalities,
dehomogenization,
inhom_equations,
inhom_congruences,
lattice_ideal,
grading,
excluded_faces,
lattice,
saturation,
cone,
offset,
vertices,
support_hyperplanes,
cone_and_lattice
You can give up to 3 input type/matrix combinations directly in the constructor.
To combine more input types, build a
std::map <libnormaliz::InputType, vector< vector<Integer> > >
and construct the libnormaliz::Cone from it.
See cone_property.h for a complete list of possible properties.
Please see the Normaliz Documentation for more information on the input types and computation modes
http://www.mathematik.uni-osnabrueck.de/normaliz/
Alternative Configuration
The integer type in the libnormaliz library is templated. So in theory it is possible to use other integer types. Then you have to include libnormaliz-all.cpp. In this case you do not need to link libnormaliz.a. We suggest (and only tested) 'long long int' and the gmp type 'mpz_class'.
Other integer types
If you want to use other types, you probably have to implement some conversion functions which you can find in integer.h. Namely
bool libnormaliz::try_convert(TypeA, TypeB); // converts TypeB to TypeA, returns false if not possible
where one type is your type and the other is long or long long (and maybe mpz_class?).
Additionally if your type uses arbritary precision (i.e. it is some wrapper for mpz) also implement
template<> inline bool libnormaliz::using_GMP<YourType>() { return true; }
|