My Project  UNKNOWN_GIT_VERSION
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 554 of file gnumpc.cc.

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

◆ ngcSetChar()

void ngcSetChar ( const coeffs  r)

Definition at line 693 of file gnumpc.cc.

694 {
695  setGMPFloatDigits(r->float_len, r->float_len2);
696 }
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
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:429
ngcDelete
static void ngcDelete(number *a, const coeffs r)
Definition: gnumpc.cc:99
LongComplexInfo
Definition: coeffs.h:99
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:693
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:523
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:118
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211