Loading...
Searching...
No Matches
gnumpc.h File Reference
`#include "singularconfig.h"`
`#include "misc/auxiliary.h"`

Go to the source code of this file.

## Functions

BOOLEAN | ngcInitChar (coeffs r, void *)
| Initialize r (n_long_C).
void | ngcSetChar (const coeffs r)

## Function Documentation

## ngcInitChar()

BOOLEAN ngcInitChar | ( | coeffs | r,
|  | void * | parameter )

Initialize r (n_long_C).

Definition at line 560 of file gnumpc.cc.

{
assume( getCoeffType(n) == n_long_C );
n->is_field=TRUE;
n->is_domain=TRUE;
n->rep=n_rep_gmp_complex;
n->cfKillChar = ngcKillChar;
n->ch = 0;
n->cfCoeffName=ngcCoeffName;
n->cfCoeffWrite = ngcCoeffWrite;
n->cfDelete = ngcDelete;
//n->cfNormalize=ndNormalize;
n->cfInit = ngcInit;
n->cfInitMPZ = ngcInitMPZ;
n->cfInt = ngcInt;
n->cfAdd = ngcAdd;
n->cfInpAdd = ngcInpAdd;
n->cfSub = ngcSub;
n->cfMult = ngcMult;
n->cfInpMult = ngcInpMult;
n->cfDiv = ngcDiv;
n->cfExactDiv= ngcDiv;
n->cfInpNeg = ngcNeg;
n->cfInvers = ngcInvers;
n->cfCopy = ngcCopy;
n->cfGreater = ngcGreater;
n->cfEqual = ngcEqual;
n->cfIsZero = ngcIsZero;
n->cfIsOne = ngcIsOne;
n->cfIsMOne = ngcIsMOne;
n->cfGreaterZero = ngcGreaterZero;
n->cfSize = ngcSize;
n->cfWriteLong = ngcWrite;
n->cfWriteShort = ngcWrite;
n->cfRead = ngcRead;
n->cfPower = ngcPower;
n->cfSetMap = ngcSetMap;
n->cfRePart = ngcRePart;
n->cfImPart = ngcImPart;
// cfSize = ndSize;
#ifdef LDEBUG
n->cfDBTest = ngcDBTest; // not yet implemented: ngcDBTest
#endif
n->nCoeffIsEqual = ngcCoeffIsEqual;
n->cfSetChar=ngcSetChar;
/*
//r->cfInitChar=nlInitChar;
r->cfKillChar=NULL;
r->cfMult = nlMult;
r->cfSub = nlSub;
r->cfAdd = nlAdd;
r->cfDiv = nlDiv;
r->cfIntMod= nlIntMod;
r->cfExactDiv= nlExactDiv;
r->cfInit = nlInit;
r->cfSize = nlSize;
r->cfInt = nlInt;
r->cfDivComp = NULL; // only for ring stuff
r->cfIsUnit = NULL; // only for ring stuff
r->cfGetUnit = NULL; // only for ring stuff
r->cfExtGcd = NULL; // only for ring stuff
r->cfInpNeg = nlNeg;
r->cfInvers= nlInvers;
r->cfCopy = nl_Copy;
r->cfRePart = nl_Copy;
r->cfImPart = ndReturn0;
r->cfWriteLong = nlWrite;
r->cfRead = nlRead;
r->cfNormalize=nlNormalize;
r->cfGreater = nlGreater;
r->cfDivBy = NULL; // only for ring stuff
r->cfEqual = nlEqual;
r->cfIsZero = nlIsZero;
r->cfIsOne = nlIsOne;
r->cfIsMOne = nlIsMOne;
r->cfGreaterZero = nlGreaterZero;
r->cfPower = nlPower;
r->cfGetDenom = nlGetDenom;
r->cfGetNumerator = nlGetNumerator;
r->cfGcd = nlGcd;
r->cfLcm = nlLcm;
r->cfDelete= nlDelete;
r->cfSetMap = nlSetMap;
r->cfName = ndName;
r->cfInpMult=nlInpMult;
#ifdef LDEBUG
// debug stuff
r->cfDBTest=nlDBTest;
#endif
// the variables:
r->type = n_Q;
r->ch = 0;
r->has_simple_Alloc=FALSE;
r->has_simple_Inverse=FALSE;
*/
n->iNumberOfParameters = 1;
n->cfParameter = ngcParameter;
char ** pParameterNames = (char **) omAlloc0(sizeof(char *));
if( parameter != NULL)
{
LongComplexInfo* p = (LongComplexInfo*)parameter;
pParameterNames[0] = omStrDup(p->par_name);
// fix wrong parameters:
if (p->float_len<SHORT_REAL_LENGTH) p->float_len=SHORT_REAL_LENGTH;
n->float_len = p->float_len;
n->float_len2 = p->float_len2;
} else // default values, just for testing!
{
pParameterNames[0] = omStrDup("i");
n->float_len = SHORT_REAL_LENGTH;
n->float_len2 = SHORT_REAL_LENGTH;
}
assume( pParameterNames != NULL );
assume( pParameterNames[0] != NULL );
n->pParameterNames = (const char**)pParameterNames;
// NOTE: n->complex_parameter was replaced by n_ParameterNames(n)[0]
// TODO: nfKillChar MUST destroy n->pParameterNames[0] (0-term. string) && n->pParameterNames (array of size 1)
return FALSE;
}
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
p
int p
Definition cfModGcd.cc:4086
n_long_C
@ n_long_C
complex floating point (GMP) numbers
Definition coeffs.h:41
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
n_rep_gmp_complex
@ n_rep_gmp_complex
(gmp_complex), see gnumpc.h
Definition coeffs.h:125
LongComplexInfo
Definition coeffs.h:107
ngcKillChar
static void ngcKillChar(coeffs r)
Definition gnumpc.cc:406
ngcImPart
static number ngcImPart(number a, const coeffs r)
Definition gnumpc.cc:265
ngcDiv
static number ngcDiv(number a, number b, const coeffs r)
Definition gnumpc.cc:198
ngcDelete
static void ngcDelete(number *a, const coeffs r)
Definition gnumpc.cc:93
ngcInpMult
static void ngcInpMult(number &a, number b, const coeffs R)
Definition gnumpc.cc:188
ngcDBTest
static BOOLEAN ngcDBTest(number, const char *, const int, const coeffs r)
Definition gnumpc.cc:27
ngcSub
static number ngcSub(number a, number b, const coeffs R)
Definition gnumpc.cc:169
ngcCopy
static number ngcCopy(number a, const coeffs r)
Definition gnumpc.cc:107
ngcInvers
static number ngcInvers(number a, const coeffs R)
Definition gnumpc.cc:131
ngcInitMPZ
static number ngcInitMPZ(mpz_t m, const coeffs)
Definition gnumpc.cc:521
ngcSetChar
void ngcSetChar(const coeffs r)
Definition gnumpc.cc:697
ngcPower
static void ngcPower(number x, int exp, number *u, const coeffs r)
Definition gnumpc.cc:215
ngcAdd
static number ngcAdd(number a, number b, const coeffs R)
Definition gnumpc.cc:151
ngcSetMap
static nMapFunc ngcSetMap(const coeffs src, const coeffs dst)
Definition gnumpc.cc:529
ngcIsMOne
static BOOLEAN ngcIsMOne(number a, const coeffs r)
Definition gnumpc.cc:324
ngcCoeffIsEqual
static BOOLEAN ngcCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition gnumpc.cc:384
ngcGreaterZero
static BOOLEAN ngcGreaterZero(number a, const coeffs r)
Definition gnumpc.cc:276
ngcInit
static number ngcInit(long i, const coeffs r)
Definition gnumpc.cc:49
ngcRePart
static number ngcRePart(number a, const coeffs r)
Definition gnumpc.cc:257
ngcCoeffWrite
static void ngcCoeffWrite(const coeffs r, BOOLEAN)
Definition gnumpc.cc:427
ngcGreater
static BOOLEAN ngcGreater(number a, number b, const coeffs r)
Definition gnumpc.cc:289
ngcParameter
static number ngcParameter(int i, const coeffs r)
Definition gnumpc.cc:35
ngcWrite
static void ngcWrite(number a, const coeffs r)
Definition gnumpc.cc:368
ngcSize
static int ngcSize(number n, const coeffs R)
Definition gnumpc.cc:75
ngcNeg
static number ngcNeg(number a, const coeffs R)
Definition gnumpc.cc:119
ngcRead
static const char * ngcRead(const char *s, number *a, const coeffs r)
Definition gnumpc.cc:335
ngcIsZero
static BOOLEAN ngcIsZero(number a, const coeffs r)
Definition gnumpc.cc:68
ngcMult
static number ngcMult(number a, number b, const coeffs R)
Definition gnumpc.cc:180
ngcInpAdd
static void ngcInpAdd(number &a, number b, const coeffs R)
Definition gnumpc.cc:159
ngcCoeffName
static char * ngcCoeffName(const coeffs r)
Definition gnumpc.cc:419
ngcIsOne
static BOOLEAN ngcIsOne(number a, const coeffs r)
Definition gnumpc.cc:313
ngcInt
static long ngcInt(number &i, const coeffs r)
Definition gnumpc.cc:61
ngcEqual
static BOOLEAN ngcEqual(number a, number b, const coeffs r)
Definition gnumpc.cc:301
assume
#define assume(x)
Definition mod2.h:389
SHORT_REAL_LENGTH
#define SHORT_REAL_LENGTH
Definition numbers.h:57
omStrDup
#define omStrDup(s)
Definition omAllocDecl.h:263
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
NULL
#define NULL
Definition omList.c:12

## ngcSetChar()

void ngcSetChar | ( | const coeffs | r | ) |

Definition at line 697 of file gnumpc.cc.

{
setGMPFloatDigits(r->float_len, r->float_len2);
}
setGMPFloatDigits
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
Definition mpr_complex.cc:60