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)
 
void ngcSetChar (const coeffs r)
 

Function Documentation

◆ ngcInitChar()

BOOLEAN ngcInitChar ( coeffs  r,
void *  parameter 
)

Initialize r (n_long_C)

Definition at line 568 of file gnumpc.cc.

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

709{
710 setGMPFloatDigits(r->float_len, r->float_len2);
711}
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