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 553 of file gnumpc.cc.

554 {
555  assume( getCoeffType(n) == n_long_C );
556  n->is_field=TRUE;
557  n->is_domain=TRUE;
558  n->rep=n_rep_gmp_complex;
559 
560  n->cfKillChar = ngcKillChar;
561  n->ch = 0;
562  n->cfCoeffString=ngcCoeffString;
563  n->cfCoeffName=ngcCoeffName;
564 
565  n->cfDelete = ngcDelete;
566  //n->cfNormalize=ndNormalize;
567  n->cfInit = ngcInit;
568  n->cfInt = ngcInt;
569  n->cfAdd = ngcAdd;
570  n->cfSub = ngcSub;
571  n->cfMult = ngcMult;
572  n->cfDiv = ngcDiv;
573  n->cfExactDiv= ngcDiv;
574  n->cfInpNeg = ngcNeg;
575  n->cfInvers = ngcInvers;
576  n->cfCopy = ngcCopy;
577  n->cfGreater = ngcGreater;
578  n->cfEqual = ngcEqual;
579  n->cfIsZero = ngcIsZero;
580  n->cfIsOne = ngcIsOne;
581  n->cfIsMOne = ngcIsMOne;
582  n->cfGreaterZero = ngcGreaterZero;
583 
584  n->cfWriteLong = ngcWrite;
585  n->cfWriteShort = ngcWrite;
586 
587  n->cfRead = ngcRead;
588  n->cfPower = ngcPower;
589  n->cfSetMap = ngcSetMap;
590  n->cfRePart = ngcRePart;
591  n->cfImPart = ngcImPart;
592  n->cfCoeffWrite = ngcCoeffWrite;
593  // cfSize = ndSize;
594 #ifdef LDEBUG
595  //n->cfDBTest = ndDBTest; // not yet implemented: ngcDBTest
596 #endif
597 
598  n->nCoeffIsEqual = ngcCoeffIsEqual;
599 
600  n->cfSetChar=ngcSetChar;
601 
602 /*
603  //r->cfInitChar=nlInitChar;
604  r->cfKillChar=NULL;
605 
606  r->cfMult = nlMult;
607  r->cfSub = nlSub;
608  r->cfAdd = nlAdd;
609  r->cfDiv = nlDiv;
610  r->cfIntMod= nlIntMod;
611  r->cfExactDiv= nlExactDiv;
612  r->cfInit = nlInit;
613  r->cfSize = nlSize;
614  r->cfInt = nlInt;
615 #ifdef HAVE_RINGS
616  r->cfDivComp = NULL; // only for ring stuff
617  r->cfIsUnit = NULL; // only for ring stuff
618  r->cfGetUnit = NULL; // only for ring stuff
619  r->cfExtGcd = NULL; // only for ring stuff
620 #endif
621  r->cfInpNeg = nlNeg;
622  r->cfInvers= nlInvers;
623  r->cfCopy = nl_Copy;
624  r->cfRePart = nl_Copy;
625  r->cfImPart = ndReturn0;
626  r->cfWriteLong = nlWrite;
627  r->cfRead = nlRead;
628  r->cfNormalize=nlNormalize;
629  r->cfGreater = nlGreater;
630 #ifdef HAVE_RINGS
631  r->cfDivBy = NULL; // only for ring stuff
632 #endif
633  r->cfEqual = nlEqual;
634  r->cfIsZero = nlIsZero;
635  r->cfIsOne = nlIsOne;
636  r->cfIsMOne = nlIsMOne;
637  r->cfGreaterZero = nlGreaterZero;
638  r->cfPower = nlPower;
639  r->cfGetDenom = nlGetDenom;
640  r->cfGetNumerator = nlGetNumerator;
641  r->cfGcd = nlGcd;
642  r->cfLcm = nlLcm;
643  r->cfDelete= nlDelete;
644  r->cfSetMap = nlSetMap;
645  r->cfName = ndName;
646  r->cfInpMult=nlInpMult;
647  r->cfInit_bigint=nlCopyMap;
648 #ifdef LDEBUG
649  // debug stuff
650  r->cfDBTest=nlDBTest;
651 #endif
652 
653  // the variables:
654  r->type = n_Q;
655  r->ch = 0;
656  r->has_simple_Alloc=FALSE;
657  r->has_simple_Inverse=FALSE;
658 */
659 
660  n->iNumberOfParameters = 1;
661  n->cfParameter = ngcParameter;
662 
663  char ** pParameterNames = (char **) omAlloc0(sizeof(char *));
664 
665  if( parameter != NULL)
666  {
667  LongComplexInfo* p = (LongComplexInfo*)parameter;
668  pParameterNames[0] = omStrDup(p->par_name);
669  // fix wrong parameters:
671  n->float_len = p->float_len;
672  n->float_len2 = p->float_len2;
673 
674  } else // default values, just for testing!
675  {
676  pParameterNames[0] = omStrDup("i");
677  n->float_len = SHORT_REAL_LENGTH;
678  n->float_len2 = SHORT_REAL_LENGTH;
679  }
680 
681  assume( pParameterNames != NULL );
682  assume( pParameterNames[0] != NULL );
683 
684  n->pParameterNames = (const char**)pParameterNames;
685 
686  // NOTE: n->complex_parameter was replaced by n_ParameterNames(n)[0]
687  // TODO: nfKillChar MUST destroy n->pParameterNames[0] (0-term. string) && n->pParameterNames (array of size 1)
688 
689  return FALSE;
690 }
static void ngcKillChar(coeffs r)
Definition: gnumpc.cc:399
static void ngcCoeffWrite(const coeffs r, BOOLEAN)
Definition: gnumpc.cc:428
static number ngcInvers(number a, const coeffs R)
Definition: gnumpc.cc:136
#define SHORT_REAL_LENGTH
Definition: numbers.h:57
static BOOLEAN ngcGreater(number a, number b, const coeffs r)
Definition: gnumpc.cc:282
#define FALSE
Definition: auxiliary.h:94
static number ngcNeg(number a, const coeffs R)
Definition: gnumpc.cc:124
static long ngcInt(number &i, const coeffs r)
Definition: gnumpc.cc:66
static number ngcSub(number a, number b, const coeffs R)
Definition: gnumpc.cc:166
#define TRUE
Definition: auxiliary.h:98
static BOOLEAN ngcCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpc.cc:377
static void ngcPower(number x, int exp, number *u, const coeffs r)
Definition: gnumpc.cc:205
static number ngcMult(number a, number b, const coeffs R)
Definition: gnumpc.cc:177
static number ngcDiv(number a, number b, const coeffs r)
Definition: gnumpc.cc:188
short float_len2
additional char-flags, rInit
Definition: coeffs.h:102
static BOOLEAN ngcIsZero(number a, const coeffs r)
Definition: gnumpc.cc:73
static char * ngcCoeffString(const coeffs r)
Definition: gnumpc.cc:412
void ngcSetChar(const coeffs r)
Definition: gnumpc.cc:692
short float_len
additional char-flags, rInit
Definition: coeffs.h:101
#define assume(x)
Definition: mod2.h:390
static BOOLEAN ngcEqual(number a, number b, const coeffs r)
Definition: gnumpc.cc:294
static char * ngcCoeffName(const coeffs r)
Definition: gnumpc.cc:420
complex floating point (GMP) numbers
Definition: coeffs.h:42
(gmp_complex), see gnumpc.h
Definition: coeffs.h:118
static number ngcParameter(int i, const coeffs r)
Definition: gnumpc.cc:40
static number ngcRePart(number a, const coeffs r)
Definition: gnumpc.cc:250
static number ngcInit(long i, const coeffs r)
Definition: gnumpc.cc:54
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
static nMapFunc ngcSetMap(const coeffs src, const coeffs dst)
Definition: gnumpc.cc:522
static BOOLEAN ngcGreaterZero(number a, const coeffs r)
Definition: gnumpc.cc:269
#define NULL
Definition: omList.c:12
static BOOLEAN ngcIsOne(number a, const coeffs r)
Definition: gnumpc.cc:306
static number ngcAdd(number a, number b, const coeffs R)
Definition: gnumpc.cc:155
const char * par_name
parameter name
Definition: coeffs.h:103
static number ngcImPart(number a, const coeffs r)
Definition: gnumpc.cc:258
static const char * ngcRead(const char *s, number *a, const coeffs r)
Definition: gnumpc.cc:328
int p
Definition: cfModGcd.cc:4019
static void ngcDelete(number *a, const coeffs r)
Definition: gnumpc.cc:98
static number ngcCopy(number a, const coeffs r)
Definition: gnumpc.cc:112
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static void ngcWrite(number a, const coeffs r)
Definition: gnumpc.cc:361
#define omStrDup(s)
Definition: omAllocDecl.h:263
static BOOLEAN ngcIsMOne(number a, const coeffs r)
Definition: gnumpc.cc:317

◆ ngcSetChar()

void ngcSetChar ( const coeffs  r)

Definition at line 692 of file gnumpc.cc.

693 {
694  setGMPFloatDigits(r->float_len, r->float_len2);
695 }
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