Functions
singext.h File Reference

helper functions for conversion to and from Singular More...

#include "canonicalform.h"
#include <factory/cf_gmp.h>
#include <resources/feFopen.h>

Go to the source code of this file.

Functions

void gmp_numerator (const CanonicalForm &f, mpz_ptr result)
 
void gmp_denominator (const CanonicalForm &f, mpz_ptr result)
 
int gf_value (const CanonicalForm &f)
 
CanonicalForm make_cf (const mpz_ptr n)
 
CanonicalForm make_cf (const mpz_ptr n, const mpz_ptr d, bool normalize)
 
CanonicalForm make_cf_from_gf (const int z)
 

Detailed Description

helper functions for conversion to and from Singular

Definition in file singext.h.

Function Documentation

§ gf_value()

int gf_value ( const CanonicalForm f)

Definition at line 60 of file singext.cc.

61 {
62  InternalCF * ff = f.getval();
63  return ((intptr_t)ff) >>2;
64 }
virtual class for internal CanonicalForm&#39;s
Definition: int_cf.h:39
InternalCF * getval() const

§ gmp_denominator()

void gmp_denominator ( const CanonicalForm f,
mpz_ptr  result 
)

Definition at line 40 of file singext.cc.

41 {
42  InternalCF * ff = f.getval();
43  ASSERT( ! is_imm( ff ), "illegal type" );
44  if ( ff->levelcoeff() == IntegerDomain )
45  {
46  mpz_init_set_si( result, 1 );
47  ff->deleteObject();
48  }
49  else if ( ff->levelcoeff() == RationalDomain )
50  {
51  mpz_init_set( result, (InternalRational::MPQDEN( ff )) );
52  ff->deleteObject();
53  }
54  else
55  {
56  ASSERT( 0, "illegal type" );
57  }
58 }
int deleteObject()
Definition: int_cf.h:57
static mpz_ptr MPQDEN(const InternalCF *const c)
Definition: int_rat.h:125
virtual class for internal CanonicalForm&#39;s
Definition: int_cf.h:39
#define IntegerDomain
Definition: cf_defs.h:25
virtual int levelcoeff() const
Definition: int_cf.h:64
#define RationalDomain
Definition: cf_defs.h:24
int is_imm(const InternalCF *const ptr)
Definition: canonicalform.h:60
#define ASSERT(expression, message)
Definition: cf_assert.h:99
InternalCF * getval() const
return result
Definition: facAbsBiFact.cc:76

§ gmp_numerator()

void gmp_numerator ( const CanonicalForm f,
mpz_ptr  result 
)

Definition at line 20 of file singext.cc.

21 {
22  InternalCF * ff = f.getval();
23  ASSERT( ! is_imm( ff ), "illegal type" );
24  if ( ff->levelcoeff() == IntegerDomain )
25  {
26  mpz_init_set( result, (InternalInteger::MPI( ff )) );
27  ff->deleteObject();
28  }
29  else if ( ff->levelcoeff() == RationalDomain )
30  {
31  mpz_init_set( result, (InternalRational::MPQNUM( ff )) );
32  ff->deleteObject();
33  }
34  else
35  {
36  ASSERT( 0, "illegal type" );
37  }
38 }
int deleteObject()
Definition: int_cf.h:57
virtual class for internal CanonicalForm&#39;s
Definition: int_cf.h:39
#define IntegerDomain
Definition: cf_defs.h:25
virtual int levelcoeff() const
Definition: int_cf.h:64
#define RationalDomain
Definition: cf_defs.h:24
static mpz_ptr MPI(const InternalCF *const c)
MPI() - return underlying mpz_t of `c&#39;.
Definition: int_int.h:232
int is_imm(const InternalCF *const ptr)
Definition: canonicalform.h:60
#define ASSERT(expression, message)
Definition: cf_assert.h:99
InternalCF * getval() const
return result
Definition: facAbsBiFact.cc:76
static mpz_ptr MPQNUM(const InternalCF *const c)
Definition: int_rat.h:120

§ make_cf() [1/2]

CanonicalForm make_cf ( const mpz_ptr  n)

Definition at line 67 of file singext.cc.

68 {
69  return CanonicalForm( CFFactory::basic( n ) );
70 }
factory&#39;s main class
Definition: canonicalform.h:75
static InternalCF * basic(long value)
Definition: cf_factory.cc:28

§ make_cf() [2/2]

CanonicalForm make_cf ( const mpz_ptr  n,
const mpz_ptr  d,
bool  normalize 
)

Definition at line 73 of file singext.cc.

74 {
75  return CanonicalForm( CFFactory::rational( n, d, normalize ) );
76 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
factory&#39;s main class
Definition: canonicalform.h:75
static InternalCF * rational(long num, long den)
Definition: cf_factory.cc:220

§ make_cf_from_gf()

CanonicalForm make_cf_from_gf ( const int  z)

Definition at line 78 of file singext.cc.

79 {
80  return CanonicalForm(int2imm_gf(z));
81 }
factory&#39;s main class
Definition: canonicalform.h:75
InternalCF * int2imm_gf(long i)
Definition: imm.h:102