Post a reply
Username:
Note:If not registered, provide any username. For more comfort, register here.
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:
Font size:
Font colour
#000000 #000040 #000080 #0000BF #0000FF
#004000 #004040 #004080 #0040BF #0040FF
#008000 #008040 #008080 #0080BF #0080FF
#00BF00 #00BF40 #00BF80 #00BFBF #00BFFF
#00FF00 #00FF40 #00FF80 #00FFBF #00FFFF
#400000 #400040 #400080 #4000BF #4000FF
#404000 #404040 #404080 #4040BF #4040FF
#408000 #408040 #408080 #4080BF #4080FF
#40BF00 #40BF40 #40BF80 #40BFBF #40BFFF
#40FF00 #40FF40 #40FF80 #40FFBF #40FFFF
#800000 #800040 #800080 #8000BF #8000FF
#804000 #804040 #804080 #8040BF #8040FF
#808000 #808040 #808080 #8080BF #8080FF
#80BF00 #80BF40 #80BF80 #80BFBF #80BFFF
#80FF00 #80FF40 #80FF80 #80FFBF #80FFFF
#BF0000 #BF0040 #BF0080 #BF00BF #BF00FF
#BF4000 #BF4040 #BF4080 #BF40BF #BF40FF
#BF8000 #BF8040 #BF8080 #BF80BF #BF80FF
#BFBF00 #BFBF40 #BFBF80 #BFBFBF #BFBFFF
#BFFF00 #BFFF40 #BFFF80 #BFFFBF #BFFFFF
#FF0000 #FF0040 #FF0080 #FF00BF #FF00FF
#FF4000 #FF4040 #FF4080 #FF40BF #FF40FF
#FF8000 #FF8040 #FF8080 #FF80BF #FF80FF
#FFBF00 #FFBF40 #FFBF80 #FFBFBF #FFBFFF
#FFFF00 #FFFF40 #FFFF80 #FFFFBF #FFFFFF
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation of post
To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.
Confirmation code:
Enter the code exactly as it appears. All letters are case insensitive, there is no zero.
   

Topic review - declaring 'number'^'bigint'
Author Message
  Post subject:  Re: declaring 'number'^'bigint'  Reply with quote
I was able to modify the files and get the desired result. Thank you for responding :o
Post Posted: Mon Sep 16, 2019 11:54 pm
  Post subject:  Re: declaring 'number'^'bigint'  Reply with quote
a type cast number -> bigint is possible:
number n=....;
bigint b=bigint(n);

To implement number^bigint one has to do:
- implement the routine to compute it using n_Power, n_Mult, n_Delete,
for the operations with the number,
and n_MPZ(expoent,b,coeffs_BIGINT) to convert the bigint b to an mpz_t number
(on the C/C++ side, both number and bigint have the type number)
- add a line to Singular/table.h
,{D(jjPOWER_N_B), '^', NUMBER_CMD, NUMBER_CMD, BIGINT_CMD, ALLOW_NC | ALLOW_RING}
- add jjPOWER_N_B so Singular/iparith.cc:
static BOOLEAN jjPOWER_N_B(leftv res, leftv u, leftv v)
{
number e=(number)v->Data();
number n=(number)u->Data();
number r=n_Power_bigint(n,ei,currRing);
res->data=(char*)r;
return FALSE;
}
Post Posted: Fri Jul 26, 2019 5:00 pm
  Post subject:  declaring 'number'^'bigint'  Reply with quote
Dear forum members,

I am looking to declare a number whose exponent can be a bigint instead of int (required for my experiments).
for ex: number beta = (alpha)^(2^33).
I have worked around the Singular source code to allow exponents up to (2^63)-1.

Understandably, Singular complains about the following error due to its limitations on number declaration:

`number` ^ `bigint` failed
expected `number` ^ `int`

I am working over a polynomial ring with variables whose coefficients are in the finite field F_q (q=2^k extension) and variables take values in F_2.
I also saw the feature to typecast a given 'number' to 'bigint' as shown in the manual in bigint declaration (Manual/4-0-3/sing_74.htm#SEC113), but Singular errors out saying it cannot typecast a number to bigint.

So, my question is:
1. Is there a restriction on typecasting a number to bigint? The manual clearly says that a number can be typecasted to bigint.
2. If this typecasting cannot be done, Is there a way around to declare a number^bigint by altering some part of the source code?
3. If 1. and 2. are not feasible, is there any other way to tackle this problem as it is a must-do experiment?

Appreciate all the help I can get on this.

thanks in advance,
-Vikas
Post Posted: Thu Jul 25, 2019 8:17 pm


It is currently Fri May 13, 2022 10:57 am
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group