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
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