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

◆ ngcSetChar()

void ngcSetChar ( const coeffs  r)

Definition at line 694 of file gnumpc.cc.

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