My Project  debian-1:4.1.1-p2+ds-4build2
Functions
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) More...
 
void ngcSetChar (const coeffs r)
 

Function Documentation

◆ ngcInitChar()

BOOLEAN ngcInitChar ( coeffs  r,
void *   
)

Initialize r (n_long_C)

Definition at line 555 of file gnumpc.cc.

556 {
557  assume( getCoeffType(n) == n_long_C );
558  n->is_field=TRUE;
559  n->is_domain=TRUE;
560  n->rep=n_rep_gmp_complex;
561 
562  n->cfKillChar = ngcKillChar;
563  n->ch = 0;
564  n->cfCoeffString=ngcCoeffString;
565  n->cfCoeffName=ngcCoeffName;
566 
567  n->cfDelete = ngcDelete;
568  //n->cfNormalize=ndNormalize;
569  n->cfInit = ngcInit;
570  n->cfInt = ngcInt;
571  n->cfAdd = ngcAdd;
572  n->cfSub = ngcSub;
573  n->cfMult = ngcMult;
574  n->cfDiv = ngcDiv;
575  n->cfExactDiv= ngcDiv;
576  n->cfInpNeg = ngcNeg;
577  n->cfInvers = ngcInvers;
578  n->cfCopy = ngcCopy;
579  n->cfGreater = ngcGreater;
580  n->cfEqual = ngcEqual;
581  n->cfIsZero = ngcIsZero;
582  n->cfIsOne = ngcIsOne;
583  n->cfIsMOne = ngcIsMOne;
584  n->cfGreaterZero = ngcGreaterZero;
585 
586  n->cfWriteLong = ngcWrite;
587  n->cfWriteShort = ngcWrite;
588 
589  n->cfRead = ngcRead;
590  n->cfPower = ngcPower;
591  n->cfSetMap = ngcSetMap;
592  n->cfRePart = ngcRePart;
593  n->cfImPart = ngcImPart;
594  n->cfCoeffWrite = ngcCoeffWrite;
595  // cfSize = ndSize;
596 #ifdef LDEBUG
597  //n->cfDBTest = ndDBTest; // not yet implemented: ngcDBTest
598 #endif
599 
600  n->nCoeffIsEqual = ngcCoeffIsEqual;
601 
602  n->cfSetChar=ngcSetChar;
603 
604 /*
605  //r->cfInitChar=nlInitChar;
606  r->cfKillChar=NULL;
607 
608  r->cfMult = nlMult;
609  r->cfSub = nlSub;
610  r->cfAdd = nlAdd;
611  r->cfDiv = nlDiv;
612  r->cfIntMod= nlIntMod;
613  r->cfExactDiv= nlExactDiv;
614  r->cfInit = nlInit;
615  r->cfSize = nlSize;
616  r->cfInt = nlInt;
617 #ifdef HAVE_RINGS
618  r->cfDivComp = NULL; // only for ring stuff
619  r->cfIsUnit = NULL; // only for ring stuff
620  r->cfGetUnit = NULL; // only for ring stuff
621  r->cfExtGcd = NULL; // only for ring stuff
622 #endif
623  r->cfInpNeg = nlNeg;
624  r->cfInvers= nlInvers;
625  r->cfCopy = nl_Copy;
626  r->cfRePart = nl_Copy;
627  r->cfImPart = ndReturn0;
628  r->cfWriteLong = nlWrite;
629  r->cfRead = nlRead;
630  r->cfNormalize=nlNormalize;
631  r->cfGreater = nlGreater;
632 #ifdef HAVE_RINGS
633  r->cfDivBy = NULL; // only for ring stuff
634 #endif
635  r->cfEqual = nlEqual;
636  r->cfIsZero = nlIsZero;
637  r->cfIsOne = nlIsOne;
638  r->cfIsMOne = nlIsMOne;
639  r->cfGreaterZero = nlGreaterZero;
640  r->cfPower = nlPower;
641  r->cfGetDenom = nlGetDenom;
642  r->cfGetNumerator = nlGetNumerator;
643  r->cfGcd = nlGcd;
644  r->cfLcm = nlLcm;
645  r->cfDelete= nlDelete;
646  r->cfSetMap = nlSetMap;
647  r->cfName = ndName;
648  r->cfInpMult=nlInpMult;
649  r->cfInit_bigint=nlCopyMap;
650 #ifdef LDEBUG
651  // debug stuff
652  r->cfDBTest=nlDBTest;
653 #endif
654 
655  // the variables:
656  r->type = n_Q;
657  r->ch = 0;
658  r->has_simple_Alloc=FALSE;
659  r->has_simple_Inverse=FALSE;
660 */
661 
662  n->iNumberOfParameters = 1;
663  n->cfParameter = ngcParameter;
664 
665  char ** pParameterNames = (char **) omAlloc0(sizeof(char *));
666 
667  if( parameter != NULL)
668  {
669  LongComplexInfo* p = (LongComplexInfo*)parameter;
670  pParameterNames[0] = omStrDup(p->par_name);
671  // fix wrong parameters:
672  if (p->float_len<SHORT_REAL_LENGTH) p->float_len=SHORT_REAL_LENGTH;
673  n->float_len = p->float_len;
674  n->float_len2 = p->float_len2;
675 
676  } else // default values, just for testing!
677  {
678  pParameterNames[0] = omStrDup("i");
679  n->float_len = SHORT_REAL_LENGTH;
680  n->float_len2 = SHORT_REAL_LENGTH;
681  }
682 
683  assume( pParameterNames != NULL );
684  assume( pParameterNames[0] != NULL );
685 
686  n->pParameterNames = (const char**)pParameterNames;
687 
688  // NOTE: n->complex_parameter was replaced by n_ParameterNames(n)[0]
689  // TODO: nfKillChar MUST destroy n->pParameterNames[0] (0-term. string) && n->pParameterNames (array of size 1)
690 
691  return FALSE;
692 }

◆ ngcSetChar()

void ngcSetChar ( const coeffs  r)

Definition at line 694 of file gnumpc.cc.

695 {
696  setGMPFloatDigits(r->float_len, r->float_len2);
697 }
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
FALSE
#define FALSE
Definition: auxiliary.h:94
ngcInvers
static number ngcInvers(number a, const coeffs R)
Definition: gnumpc.cc:137
ngcKillChar
static void ngcKillChar(coeffs r)
Definition: gnumpc.cc:400
ngcCoeffWrite
static void ngcCoeffWrite(const coeffs r, BOOLEAN)
Definition: gnumpc.cc:430
ngcDelete
static void ngcDelete(number *a, const coeffs r)
Definition: gnumpc.cc:99
LongComplexInfo
Definition: coeffs.h:100
ngcCopy
static number ngcCopy(number a, const coeffs r)
Definition: gnumpc.cc:113
ngcInt
static long ngcInt(number &i, const coeffs r)
Definition: gnumpc.cc:67
ngcGreater
static BOOLEAN ngcGreater(number a, number b, const coeffs r)
Definition: gnumpc.cc:283
SHORT_REAL_LENGTH
#define SHORT_REAL_LENGTH
Definition: numbers.h:58
n_long_C
@ n_long_C
complex floating point (GMP) numbers
Definition: coeffs.h:42
ngcCoeffIsEqual
static BOOLEAN ngcCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpc.cc:378
ngcNeg
static number ngcNeg(number a, const coeffs R)
Definition: gnumpc.cc:125
ngcCoeffString
static char * ngcCoeffString(const coeffs r)
Definition: gnumpc.cc:413
omStrDup
#define omStrDup(s)
Definition: omAllocDecl.h:263
ngcSub
static number ngcSub(number a, number b, const coeffs R)
Definition: gnumpc.cc:167
ngcIsZero
static BOOLEAN ngcIsZero(number a, const coeffs r)
Definition: gnumpc.cc:74
ngcMult
static number ngcMult(number a, number b, const coeffs R)
Definition: gnumpc.cc:178
ngcPower
static void ngcPower(number x, int exp, number *u, const coeffs r)
Definition: gnumpc.cc:206
TRUE
#define TRUE
Definition: auxiliary.h:98
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:61
ngcDiv
static number ngcDiv(number a, number b, const coeffs r)
Definition: gnumpc.cc:189
ngcRePart
static number ngcRePart(number a, const coeffs r)
Definition: gnumpc.cc:251
ngcParameter
static number ngcParameter(int i, const coeffs r)
Definition: gnumpc.cc:41
ngcEqual
static BOOLEAN ngcEqual(number a, number b, const coeffs r)
Definition: gnumpc.cc:295
ngcSetChar
void ngcSetChar(const coeffs r)
Definition: gnumpc.cc:694
ngcCoeffName
static char * ngcCoeffName(const coeffs r)
Definition: gnumpc.cc:421
ngcIsOne
static BOOLEAN ngcIsOne(number a, const coeffs r)
Definition: gnumpc.cc:307
ngcGreaterZero
static BOOLEAN ngcGreaterZero(number a, const coeffs r)
Definition: gnumpc.cc:270
ngcAdd
static number ngcAdd(number a, number b, const coeffs R)
Definition: gnumpc.cc:156
ngcImPart
static number ngcImPart(number a, const coeffs r)
Definition: gnumpc.cc:259
ngcSetMap
static nMapFunc ngcSetMap(const coeffs src, const coeffs dst)
Definition: gnumpc.cc:524
ngcInit
static number ngcInit(long i, const coeffs r)
Definition: gnumpc.cc:55
assume
#define assume(x)
Definition: mod2.h:390
NULL
#define NULL
Definition: omList.c:10
p
int p
Definition: cfModGcd.cc:4019
ngcRead
static const char * ngcRead(const char *s, number *a, const coeffs r)
Definition: gnumpc.cc:329
ngcWrite
static void ngcWrite(number a, const coeffs r)
Definition: gnumpc.cc:362
ngcIsMOne
static BOOLEAN ngcIsMOne(number a, const coeffs r)
Definition: gnumpc.cc:318
n_rep_gmp_complex
@ n_rep_gmp_complex
(gmp_complex), see gnumpc.h
Definition: coeffs.h:119
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211