My Project
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 *  parameter 
)

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->cfCoeffName=ngcCoeffName;
564  n->cfCoeffWrite = ngcCoeffWrite;
565 
566  n->cfDelete = ngcDelete;
567  //n->cfNormalize=ndNormalize;
568  n->cfInit = ngcInit;
569  n->cfInitMPZ = ngcInitMPZ;
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  // 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 }
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4078
@ n_long_C
complex floating point (GMP) numbers
Definition: coeffs.h:41
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
@ n_rep_gmp_complex
(gmp_complex), see gnumpc.h
Definition: coeffs.h:118
static void ngcKillChar(coeffs r)
Definition: gnumpc.cc:400
static number ngcImPart(number a, const coeffs r)
Definition: gnumpc.cc:259
static number ngcDiv(number a, number b, const coeffs r)
Definition: gnumpc.cc:189
static void ngcDelete(number *a, const coeffs r)
Definition: gnumpc.cc:98
static number ngcSub(number a, number b, const coeffs R)
Definition: gnumpc.cc:167
static const char * ngcRead(const char *s, number *a, const coeffs r)
Definition: gnumpc.cc:329
static number ngcCopy(number a, const coeffs r)
Definition: gnumpc.cc:112
static number ngcInvers(number a, const coeffs R)
Definition: gnumpc.cc:136
static number ngcInitMPZ(mpz_t m, const coeffs)
Definition: gnumpc.cc:515
void ngcSetChar(const coeffs r)
Definition: gnumpc.cc:693
static void ngcPower(number x, int exp, number *u, const coeffs r)
Definition: gnumpc.cc:206
static number ngcAdd(number a, number b, const coeffs R)
Definition: gnumpc.cc:156
static nMapFunc ngcSetMap(const coeffs src, const coeffs dst)
Definition: gnumpc.cc:523
static BOOLEAN ngcIsMOne(number a, const coeffs r)
Definition: gnumpc.cc:318
static BOOLEAN ngcCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpc.cc:378
static BOOLEAN ngcGreaterZero(number a, const coeffs r)
Definition: gnumpc.cc:270
static number ngcInit(long i, const coeffs r)
Definition: gnumpc.cc:54
static number ngcRePart(number a, const coeffs r)
Definition: gnumpc.cc:251
static void ngcCoeffWrite(const coeffs r, BOOLEAN)
Definition: gnumpc.cc:421
static BOOLEAN ngcGreater(number a, number b, const coeffs r)
Definition: gnumpc.cc:283
static number ngcParameter(int i, const coeffs r)
Definition: gnumpc.cc:40
static void ngcWrite(number a, const coeffs r)
Definition: gnumpc.cc:362
static number ngcNeg(number a, const coeffs R)
Definition: gnumpc.cc:124
static BOOLEAN ngcIsZero(number a, const coeffs r)
Definition: gnumpc.cc:73
static number ngcMult(number a, number b, const coeffs R)
Definition: gnumpc.cc:178
static BOOLEAN ngcIsOne(number a, const coeffs r)
Definition: gnumpc.cc:307
static long ngcInt(number &i, const coeffs r)
Definition: gnumpc.cc:66
static char * ngcCoeffName(const coeffs r)
Definition: gnumpc.cc:413
static BOOLEAN ngcEqual(number a, number b, const coeffs r)
Definition: gnumpc.cc:295
#define assume(x)
Definition: mod2.h:387
#define SHORT_REAL_LENGTH
Definition: numbers.h:57
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define NULL
Definition: omList.c:12

◆ ngcSetChar()

void ngcSetChar ( const coeffs  r)

Definition at line 693 of file gnumpc.cc.

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