Loading...
Searching...
No Matches
singext.cc
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
#include "config.h"
#include "cf_assert.h"
#include "cf_defs.h"
#include "singext.h"
#include "int_cf.h"
#include "int_int.h"
#include "int_rat.h"
#include "imm.h"
#include "cf_factory.h"
#include "factory/cf_gmp.h"
void gmp_numerator ( const CanonicalForm & f, mpz_ptr result )
{
InternalCF * ff = f.getval();
ASSERT( ! is_imm( ff ), "illegal type" );
if ( ff->levelcoeff() == IntegerDomain )
{
mpz_init_set( result, (InternalInteger::MPI( ff )) );
ff->deleteObject();
}
else if ( ff->levelcoeff() == RationalDomain )
{
mpz_init_set( result, (InternalRational::MPQNUM( ff )) );
ff->deleteObject();
}
else
{
ASSERT( 0, "illegal type" );
}
}
void gmp_denominator ( const CanonicalForm & f, mpz_ptr result )
{
InternalCF * ff = f.getval();
ASSERT( ! is_imm( ff ), "illegal type" );
if ( ff->levelcoeff() == IntegerDomain )
{
mpz_init_set_si( result, 1 );
ff->deleteObject();
}
else if ( ff->levelcoeff() == RationalDomain )
{
mpz_init_set( result, (InternalRational::MPQDEN( ff )) );
ff->deleteObject();
}
else
{
ASSERT( 0, "illegal type" );
}
}
int gf_value (const CanonicalForm & f )
{
InternalCF * ff = f.getval();
return ((intptr_t)ff) >>2;
}
CanonicalForm make_cf ( const mpz_ptr n )
{
return CanonicalForm( CFFactory::basic( n ) );
}
CanonicalForm make_cf ( const mpz_ptr n, const mpz_ptr d, bool normalize )
{
return CanonicalForm( CFFactory::rational( n, d, normalize ) );
}
CanonicalForm make_cf_from_gf ( const int z )
{
return CanonicalForm(int2imm_gf(z));
}
is_imm
int is_imm(const InternalCF *const ptr)
Definition canonicalform.h:65
cf_assert.h
assertions for Factory
ASSERT
#define ASSERT(expression, message)
Definition cf_assert.h:99
cf_defs.h
factory switches.
RationalDomain
#define RationalDomain
Definition cf_defs.h:20
IntegerDomain
#define IntegerDomain
Definition cf_defs.h:21
cf_factory.h
Interface to generate InternalCF's over various domains from intrinsic types or mpz_t's.
cf_gmp.h
f
FILE * f
Definition checklibs.c:9
CFFactory::basic
static InternalCF * basic(int value)
Definition cf_factory.cc:61
CFFactory::rational
static InternalCF * rational(long num, long den)
Definition cf_factory.cc:268
CanonicalForm
factory's main class
Definition canonicalform.h:86
InternalCF
virtual class for internal CanonicalForm's
Definition int_cf.h:47
InternalCF::InternalCF
InternalCF()
Definition int_cf.h:55
InternalCF::levelcoeff
virtual int levelcoeff() const
Definition int_cf.h:68
InternalCF::deleteObject
int deleteObject()
Definition int_cf.h:61
InternalInteger::MPI
static mpz_ptr MPI(const InternalCF *const c)
uiNormalizeMPI()' is the same as normalizeMPI()' except that aMpi' is expected to be non-begative.
Definition int_int.h:252
InternalRational::MPQDEN
static mpz_ptr MPQDEN(const InternalCF *const c)
Definition int_rat.h:143
InternalRational::MPQNUM
static mpz_ptr MPQNUM(const InternalCF *const c)
Definition int_rat.h:138
result
return result
Definition facAbsBiFact.cc:76
imm.h
operations on immediates, that is elements of F_p, GF, Z, Q that fit into intrinsic int,...
int2imm_gf
InternalCF * int2imm_gf(long i)
Definition imm.h:106
int_cf.h
Factory's internal CanonicalForm's.
int_int.h
Factory's internal integers.
int_rat.h
Factory's internal rationals.
make_cf
CanonicalForm make_cf(const mpz_ptr n)
Definition singext.cc:66
gmp_denominator
void gmp_denominator(const CanonicalForm &f, mpz_ptr result)
Definition singext.cc:40
make_cf_from_gf
CanonicalForm make_cf_from_gf(const int z)
Definition singext.cc:76
gf_value
int gf_value(const CanonicalForm &f)
Definition singext.cc:60
gmp_numerator
void gmp_numerator(const CanonicalForm &f, mpz_ptr result)
Definition singext.cc:20
singext.h
helper functions for conversion to and from Singular
normalize
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition syz3.cc:1027