My Project
Loading...
Searching...
No Matches
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 560 of file gnumpc.cc.

561{
563 n->is_field=TRUE;
564 n->is_domain=TRUE;
565 n->rep=n_rep_gmp_complex;
566
567 n->cfKillChar = ngcKillChar;
568 n->ch = 0;
569 n->cfCoeffName=ngcCoeffName;
570 n->cfCoeffWrite = ngcCoeffWrite;
571
572 n->cfDelete = ngcDelete;
573 //n->cfNormalize=ndNormalize;
574 n->cfInit = ngcInit;
575 n->cfInitMPZ = ngcInitMPZ;
576 n->cfInt = ngcInt;
577 n->cfAdd = ngcAdd;
578 n->cfInpAdd = ngcInpAdd;
579 n->cfSub = ngcSub;
580 n->cfMult = ngcMult;
581 n->cfInpMult = ngcInpMult;
582 n->cfDiv = ngcDiv;
583 n->cfExactDiv= ngcDiv;
584 n->cfInpNeg = ngcNeg;
585 n->cfInvers = ngcInvers;
586 n->cfCopy = ngcCopy;
587 n->cfGreater = ngcGreater;
588 n->cfEqual = ngcEqual;
589 n->cfIsZero = ngcIsZero;
590 n->cfIsOne = ngcIsOne;
591 n->cfIsMOne = ngcIsMOne;
592 n->cfGreaterZero = ngcGreaterZero;
593 n->cfSize = ngcSize;
594
595 n->cfWriteLong = ngcWrite;
596 n->cfWriteShort = ngcWrite;
597
598 n->cfRead = ngcRead;
599 n->cfPower = ngcPower;
600 n->cfSetMap = ngcSetMap;
601 n->cfRePart = ngcRePart;
602 n->cfImPart = ngcImPart;
603 // cfSize = ndSize;
604#ifdef LDEBUG
605 //n->cfDBTest = ndDBTest; // not yet implemented: ngcDBTest
606#endif
607
608 n->nCoeffIsEqual = ngcCoeffIsEqual;
609
610 n->cfSetChar=ngcSetChar;
611
612/*
613 //r->cfInitChar=nlInitChar;
614 r->cfKillChar=NULL;
615
616 r->cfMult = nlMult;
617 r->cfSub = nlSub;
618 r->cfAdd = nlAdd;
619 r->cfDiv = nlDiv;
620 r->cfIntMod= nlIntMod;
621 r->cfExactDiv= nlExactDiv;
622 r->cfInit = nlInit;
623 r->cfSize = nlSize;
624 r->cfInt = nlInt;
625#ifdef HAVE_RINGS
626 r->cfDivComp = NULL; // only for ring stuff
627 r->cfIsUnit = NULL; // only for ring stuff
628 r->cfGetUnit = NULL; // only for ring stuff
629 r->cfExtGcd = NULL; // only for ring stuff
630#endif
631 r->cfInpNeg = nlNeg;
632 r->cfInvers= nlInvers;
633 r->cfCopy = nl_Copy;
634 r->cfRePart = nl_Copy;
635 r->cfImPart = ndReturn0;
636 r->cfWriteLong = nlWrite;
637 r->cfRead = nlRead;
638 r->cfNormalize=nlNormalize;
639 r->cfGreater = nlGreater;
640#ifdef HAVE_RINGS
641 r->cfDivBy = NULL; // only for ring stuff
642#endif
643 r->cfEqual = nlEqual;
644 r->cfIsZero = nlIsZero;
645 r->cfIsOne = nlIsOne;
646 r->cfIsMOne = nlIsMOne;
647 r->cfGreaterZero = nlGreaterZero;
648 r->cfPower = nlPower;
649 r->cfGetDenom = nlGetDenom;
650 r->cfGetNumerator = nlGetNumerator;
651 r->cfGcd = nlGcd;
652 r->cfLcm = nlLcm;
653 r->cfDelete= nlDelete;
654 r->cfSetMap = nlSetMap;
655 r->cfName = ndName;
656 r->cfInpMult=nlInpMult;
657#ifdef LDEBUG
658 // debug stuff
659 r->cfDBTest=nlDBTest;
660#endif
661
662 // the variables:
663 r->type = n_Q;
664 r->ch = 0;
665 r->has_simple_Alloc=FALSE;
666 r->has_simple_Inverse=FALSE;
667*/
668
669 n->iNumberOfParameters = 1;
670 n->cfParameter = ngcParameter;
671
672 char ** pParameterNames = (char **) omAlloc0(sizeof(char *));
673
674 if( parameter != NULL)
675 {
676 LongComplexInfo* p = (LongComplexInfo*)parameter;
677 pParameterNames[0] = omStrDup(p->par_name);
678 // fix wrong parameters:
679 if (p->float_len<SHORT_REAL_LENGTH) p->float_len=SHORT_REAL_LENGTH;
680 n->float_len = p->float_len;
681 n->float_len2 = p->float_len2;
682
683 } else // default values, just for testing!
684 {
685 pParameterNames[0] = omStrDup("i");
686 n->float_len = SHORT_REAL_LENGTH;
687 n->float_len2 = SHORT_REAL_LENGTH;
688 }
689
690 assume( pParameterNames != NULL );
691 assume( pParameterNames[0] != NULL );
692
693 n->pParameterNames = (const char**)pParameterNames;
694
695 // NOTE: n->complex_parameter was replaced by n_ParameterNames(n)[0]
696 // TODO: nfKillChar MUST destroy n->pParameterNames[0] (0-term. string) && n->pParameterNames (array of size 1)
697
698 return FALSE;
699}
#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:422
@ n_rep_gmp_complex
(gmp_complex), see gnumpc.h
Definition: coeffs.h:118
static void ngcKillChar(coeffs r)
Definition: gnumpc.cc:406
static number ngcImPart(number a, const coeffs r)
Definition: gnumpc.cc:265
static number ngcDiv(number a, number b, const coeffs r)
Definition: gnumpc.cc:198
static void ngcDelete(number *a, const coeffs r)
Definition: gnumpc.cc:93
static void ngcInpMult(number &a, number b, const coeffs R)
Definition: gnumpc.cc:188
static number ngcSub(number a, number b, const coeffs R)
Definition: gnumpc.cc:169
static number ngcCopy(number a, const coeffs r)
Definition: gnumpc.cc:107
static number ngcInvers(number a, const coeffs R)
Definition: gnumpc.cc:131
static number ngcInitMPZ(mpz_t m, const coeffs)
Definition: gnumpc.cc:521
void ngcSetChar(const coeffs r)
Definition: gnumpc.cc:701
static void ngcPower(number x, int exp, number *u, const coeffs r)
Definition: gnumpc.cc:215
static number ngcAdd(number a, number b, const coeffs R)
Definition: gnumpc.cc:151
static nMapFunc ngcSetMap(const coeffs src, const coeffs dst)
Definition: gnumpc.cc:529
static BOOLEAN ngcIsMOne(number a, const coeffs r)
Definition: gnumpc.cc:324
static BOOLEAN ngcCoeffIsEqual(const coeffs r, n_coeffType n, void *parameter)
Definition: gnumpc.cc:384
static BOOLEAN ngcGreaterZero(number a, const coeffs r)
Definition: gnumpc.cc:276
static number ngcInit(long i, const coeffs r)
Definition: gnumpc.cc:49
static number ngcRePart(number a, const coeffs r)
Definition: gnumpc.cc:257
static void ngcCoeffWrite(const coeffs r, BOOLEAN)
Definition: gnumpc.cc:427
static BOOLEAN ngcGreater(number a, number b, const coeffs r)
Definition: gnumpc.cc:289
static number ngcParameter(int i, const coeffs r)
Definition: gnumpc.cc:35
static void ngcWrite(number a, const coeffs r)
Definition: gnumpc.cc:368
static int ngcSize(number n, const coeffs R)
Definition: gnumpc.cc:75
static number ngcNeg(number a, const coeffs R)
Definition: gnumpc.cc:119
static const char * ngcRead(const char *s, number *a, const coeffs r)
Definition: gnumpc.cc:335
static BOOLEAN ngcIsZero(number a, const coeffs r)
Definition: gnumpc.cc:68
static number ngcMult(number a, number b, const coeffs R)
Definition: gnumpc.cc:180
static void ngcInpAdd(number &a, number b, const coeffs R)
Definition: gnumpc.cc:159
static char * ngcCoeffName(const coeffs r)
Definition: gnumpc.cc:419
static BOOLEAN ngcIsOne(number a, const coeffs r)
Definition: gnumpc.cc:313
static long ngcInt(number &i, const coeffs r)
Definition: gnumpc.cc:61
static BOOLEAN ngcEqual(number a, number b, const coeffs r)
Definition: gnumpc.cc:301
#define assume(x)
Definition: mod2.h:389
#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 701 of file gnumpc.cc.

702{
703 setGMPFloatDigits(r->float_len, r->float_len2);
704}
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