[sage-support] Using multifactorial function in Sage/Eclipse

2013-08-22 Thread Asad Akhlaq
Hi,

After a long struggle I am able to run my sage code in Eclipse. But I am 
getting few errors when I run my code that runs without any error in sage 
notebook.

For example   using for loop,   gives me error if I write for  k in 
[0..10] , I need to change it to for k in range(0,11)   ... (I guess I 
need to use Python syntax in Eclipse editor)

I am using multifactorial() in my sage code. It runs good in sage 
notebook, but now giving me error in Eclipse editor. 

Error Message AttributeError: 'int' object has no attribute 
'multifactorial' 

I use  import sys   and  from sage.all import *   at the start of my code.


Any help/suggestion would be highly appreciated.

Thanks

Assad


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] error: setupterm: could not find terminal

2013-08-22 Thread Martin Albrecht
Hi all,

with Sage 5.12.beta3 I get:

sage: os.environ[TERM]
'xterm'
sage: ZZ?
snip
/opt/sage-5.12/local/lib/python/curses/__init__.pyc in initscr()
 31 # instead of calling exit() in error cases.
 32 setupterm(term=_os.environ.get(TERM, unknown),
--- 33   fd=_sys.__stdout__.fileno())
 34 stdscr = _curses.initscr()
 35 for key, value in _curses.__dict__.items():

error: setupterm: could not find terminal
sage:

This is in konsole (KDE's console). Any ideas?

Cheers,
Martin


--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


Re: [sage-support] arrays in Sage's cython

2013-08-22 Thread Daniel Krenn
Am 2013-08-22 01:12, schrieb Robert Bradshaw:
 Using a Python list is probably the fastest way to iterate over an
 array of Python objects--it's a PyObject** under the hood and Cython
 uses the C API calls to get at it. 

Ok, thanks for the clearification.

 Your check might be the
 bottleneck, especially if it's a Python call.

I could remove that bottleneck. Now the bottleneck is in my original
something. I have to live with that. But, indeed, the list was not the
problem. Thanks.

 Also, no need to write this as a while loop; just use for a in
 range(100) and it'll do the right thing (a C for loop).

I used the while loop, since I want a to be Integer and not int (I need
that for the calculations).

Many thanks,

Daniel


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: error: setupterm: could not find terminal

2013-08-22 Thread Volker Braun
The change is because we switched to ncurses instead of termcap.

Are you on OSX? Your TERM should be set to xterm-new or, even 
better, xterm-256color

https://code.google.com/p/iterm2/issues/detail?id=1956 




On Thursday, August 22, 2013 1:56:09 PM UTC+1, Martin Albrecht wrote:

 Hi all, 

 with Sage 5.12.beta3 I get: 

 sage: os.environ[TERM] 
 'xterm' 
 sage: ZZ? 
 snip 
 /opt/sage-5.12/local/lib/python/curses/__init__.pyc in initscr() 
  31 # instead of calling exit() in error cases. 
  32 setupterm(term=_os.environ.get(TERM, unknown), 
 --- 33   fd=_sys.__stdout__.fileno()) 
  34 stdscr = _curses.initscr() 
  35 for key, value in _curses.__dict__.items(): 

 error: setupterm: could not find terminal 
 sage: 

 This is in konsole (KDE's console). Any ideas? 

 Cheers, 
 Martin 


 -- 
 name: Martin Albrecht 
 _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6532AFB4 
 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF 
 _www: http://martinralbrecht.wordpress.com/ 
 _jab: martinr...@jabber.ccc.de javascript:

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sage-support] arrays in Sage's cython

2013-08-22 Thread John Cremona
On 22 August 2013 14:10, Daniel Krenn kr...@aon.at wrote:
 Am 2013-08-22 01:12, schrieb Robert Bradshaw:
 Using a Python list is probably the fastest way to iterate over an
 array of Python objects--it's a PyObject** under the hood and Cython
 uses the C API calls to get at it.

 Ok, thanks for the clearification.

 Your check might be the
 bottleneck, especially if it's a Python call.

 I could remove that bottleneck. Now the bottleneck is in my original
 something. I have to live with that. But, indeed, the list was not the
 problem. Thanks.

 Also, no need to write this as a while loop; just use for a in
 range(100) and it'll do the right thing (a C for loop).

 I used the while loop, since I want a to be Integer and not int (I need
 that for the calculations).

Then use srange() which yields Integers.

John


 Many thanks,

 Daniel


 --
 You received this message because you are subscribed to the Google Groups 
 sage-support group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sage-support+unsubscr...@googlegroups.com.
 To post to this group, send email to sage-support@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-support.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: Re: error: setupterm: could not find terminal

2013-08-22 Thread Martin Albrecht
Hi all,

I am running Linux here. I found that link as well and played with my TERM 
settings, but nothing is working so far:

sage: osos.environ[TERM]
'xterm-new'
sage: ZZ?
WARNING: terminal is not fully functional
-  (press RETURN)

... and then I am back in the 90s with more.

Cheers,
Martin

On Thursday 22 August 2013 06:12:29 Volker Braun wrote:
 The change is because we switched to ncurses instead of termcap.
 
 Are you on OSX? Your TERM should be set to xterm-new or, even
 better, xterm-256color
 
 https://code.google.com/p/iterm2/issues/detail?id=1956
 
 On Thursday, August 22, 2013 1:56:09 PM UTC+1, Martin Albrecht wrote:
  Hi all,
  
  with Sage 5.12.beta3 I get:
  
  sage: os.environ[TERM]
  'xterm'
  sage: ZZ?
  snip
  /opt/sage-5.12/local/lib/python/curses/__init__.pyc in initscr()
  
   31 # instead of calling exit() in error cases.
   32 setupterm(term=_os.environ.get(TERM, unknown),
  
  --- 33   fd=_sys.__stdout__.fileno())
  
   34 stdscr = _curses.initscr()
  
   35 for key, value in _curses.__dict__.items():
  error: setupterm: could not find terminal
  sage:
  
  This is in konsole (KDE's console). Any ideas?
  
  Cheers,
  Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


[sage-support] Re: Re: error: setupterm: could not find terminal

2013-08-22 Thread Volker Braun
Your Python managed to build the _curses extension? Mine didn't, which is 
presumably why it Python can't get itself confused:

building '_curses' extension
gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 
-Wall -I/home/vbraun/opt/
sage-5.12.beta3/local/include -I. -IInclude -I./Include 
-I/usr/local/include -I/home/vbraun/opt/
sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Include 
-I/home/vbraun/opt/sage-5.12.beta3/spkg/b
uild/python-2.7.5.p1/src -c 
/home/vbraun/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modu
les/_cursesmodule.c -o 
build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/py
thon-2.7.5.p1/src/Modules/_cursesmodule.o
gcc -pthread -shared -L/home/vbraun/opt/sage-5.12.beta3/local/lib 
-L/home/vbraun/opt/sage-5.12.b
eta3/local/lib 
build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/python-2.7
.5.p1/src/Modules/_cursesmodule.o 
-L/home/vbraun/opt/sage-5.12.beta3/local/lib -L/usr/local/lib 
-L. -lncursesw -lpython2.7 -o build/lib.linux-x86_64-2.7/_curses.so
*** WARNING: renaming _curses since importing it failed: 
/lib64/libncursesw.so.5: undefined sy
mbol: _nc_putchar
building '_curses_panel' extension
gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 
-Wall -I/home/vbraun/opt/
sage-5.12.beta3/local/include -I. -IInclude -I./Include 
-I/usr/local/include -I/home/vbraun/opt/
sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Include 
-I/home/vbraun/opt/sage-5.12.beta3/spkg/b
uild/python-2.7.5.p1/src -c 
/home/vbraun/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modu
les/_curses_panel.c -o 
build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/py
thon-2.7.5.p1/src/Modules/_curses_panel.o
gcc -pthread -shared -L/home/vbraun/opt/sage-5.12.beta3/local/lib 
-L/home/vbraun/opt/sage-5.12.beta3/local/lib 
build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modules/_curses_panel.o
 
-L/home/vbraun/opt/sage-5.12.beta3/local/lib -L/usr/local/lib -L. -lpanelw 
-lncursesw -lpython2.7 -o build/lib.linux-x86_64-2.7/_curses_panel.so
*** WARNING: renaming _curses_panel since importing it failed: 
/lib64/libncursesw.so.5: undefined symbol: _nc_putchar


On Thursday, August 22, 2013 2:22:50 PM UTC+1, Martin Albrecht wrote:

 Hi all, 

 I am running Linux here. I found that link as well and played with my TERM 
 settings, but nothing is working so far: 

 sage: osos.environ[TERM] 
 'xterm-new' 
 sage: ZZ? 
 WARNING: terminal is not fully functional 
 -  (press RETURN) 

 ... and then I am back in the 90s with more. 

 Cheers, 
 Martin 

 On Thursday 22 August 2013 06:12:29 Volker Braun wrote: 
  The change is because we switched to ncurses instead of termcap. 
  
  Are you on OSX? Your TERM should be set to xterm-new or, even 
  better, xterm-256color 
  
  https://code.google.com/p/iterm2/issues/detail?id=1956 
  
  On Thursday, August 22, 2013 1:56:09 PM UTC+1, Martin Albrecht wrote: 
   Hi all, 
   
   with Sage 5.12.beta3 I get: 
   
   sage: os.environ[TERM] 
   'xterm' 
   sage: ZZ? 
   snip 
   /opt/sage-5.12/local/lib/python/curses/__init__.pyc in initscr() 
   
31 # instead of calling exit() in error cases. 
32 setupterm(term=_os.environ.get(TERM, unknown), 
   
   --- 33   fd=_sys.__stdout__.fileno()) 
   
34 stdscr = _curses.initscr() 
   
35 for key, value in _curses.__dict__.items(): 
   error: setupterm: could not find terminal 
   sage: 
   
   This is in konsole (KDE's console). Any ideas? 
   
   Cheers, 
   Martin 

 -- 
 name: Martin Albrecht 
 _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6532AFB4 
 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF 
 _www: http://martinralbrecht.wordpress.com/ 
 _jab: martinr...@jabber.ccc.de javascript:

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: Re: Re: error: setupterm: could not find terminal

2013-08-22 Thread Martin Albrecht
Hi all,

yep, looks like it succeeded ... funny that this would present a problem.

building '_curses' extension
gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -
I/opt/sage-5.12.beta3/local/include -I. -IInclude -I./Include -
I/usr/include/x86_64-linux-gnu -I/usr/local/include -
I/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Include -
I/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src -c 
/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modules/_cursesmodule.c -o 
build/temp.linux-
x86_64-2.7/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modules/_cursesmodule.o
gcc -pthread -shared -L/opt/sage-5.12.beta3/local/lib -
L/opt/sage-5.12.beta3/local/lib build/temp.linux-
x86_64-2.7/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modules/_cursesmodule.o
 
-L/opt/sage-5.12.beta3/local/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib 
-L. -lncurses -lpython2.7 -o build/lib.linux-x86_64-2.7/_curses.so


Cheers,
Martin

On Thursday 22 August 2013 07:40:23 Volker Braun wrote:
 Your Python managed to build the _curses extension? Mine didn't, which is
 presumably why it Python can't get itself confused:
 
 building '_curses' extension
 gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3
 -Wall -I/home/vbraun/opt/
 sage-5.12.beta3/local/include -I. -IInclude -I./Include
 -I/usr/local/include -I/home/vbraun/opt/
 sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Include
 -I/home/vbraun/opt/sage-5.12.beta3/spkg/b
 uild/python-2.7.5.p1/src -c
 /home/vbraun/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modu
 les/_cursesmodule.c -o
 build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/py
 thon-2.7.5.p1/src/Modules/_cursesmodule.o
 gcc -pthread -shared -L/home/vbraun/opt/sage-5.12.beta3/local/lib
 -L/home/vbraun/opt/sage-5.12.b
 eta3/local/lib
 build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/pytho
 n-2.7 .5.p1/src/Modules/_cursesmodule.o
 -L/home/vbraun/opt/sage-5.12.beta3/local/lib -L/usr/local/lib
 -L. -lncursesw -lpython2.7 -o build/lib.linux-x86_64-2.7/_curses.so
 *** WARNING: renaming _curses since importing it failed:
 /lib64/libncursesw.so.5: undefined sy
 mbol: _nc_putchar
 building '_curses_panel' extension
 gcc -pthread -fPIC -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3
 -Wall -I/home/vbraun/opt/
 sage-5.12.beta3/local/include -I. -IInclude -I./Include
 -I/usr/local/include -I/home/vbraun/opt/
 sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Include
 -I/home/vbraun/opt/sage-5.12.beta3/spkg/b
 uild/python-2.7.5.p1/src -c
 /home/vbraun/opt/sage-5.12.beta3/spkg/build/python-2.7.5.p1/src/Modu
 les/_curses_panel.c -o
 build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/py
 thon-2.7.5.p1/src/Modules/_curses_panel.o
 gcc -pthread -shared -L/home/vbraun/opt/sage-5.12.beta3/local/lib
 -L/home/vbraun/opt/sage-5.12.beta3/local/lib
 build/temp.linux-x86_64-2.7/home/vbraun/opt/sage-5.12.beta3/spkg/build/pytho
 n-2.7.5.p1/src/Modules/_curses_panel.o
 -L/home/vbraun/opt/sage-5.12.beta3/local/lib -L/usr/local/lib -L. -lpanelw
 -lncursesw -lpython2.7 -o build/lib.linux-x86_64-2.7/_curses_panel.so ***
 WARNING: renaming _curses_panel since importing it failed:
 /lib64/libncursesw.so.5: undefined symbol: _nc_putchar
 
 On Thursday, August 22, 2013 2:22:50 PM UTC+1, Martin Albrecht wrote:
  Hi all,
  
  I am running Linux here. I found that link as well and played with my TERM
  settings, but nothing is working so far:
  
  sage: osos.environ[TERM]
  'xterm-new'
  sage: ZZ?
  WARNING: terminal is not fully functional
  -  (press RETURN)
  
  ... and then I am back in the 90s with more.
  
  Cheers,
  Martin
  
  On Thursday 22 August 2013 06:12:29 Volker Braun wrote:
   The change is because we switched to ncurses instead of termcap.
   
   Are you on OSX? Your TERM should be set to xterm-new or, even
   better, xterm-256color
   
   https://code.google.com/p/iterm2/issues/detail?id=1956
   
   On Thursday, August 22, 2013 1:56:09 PM UTC+1, Martin Albrecht wrote:
Hi all,

with Sage 5.12.beta3 I get:

sage: os.environ[TERM]
'xterm'
sage: ZZ?
snip
/opt/sage-5.12/local/lib/python/curses/__init__.pyc in initscr()

 31 # instead of calling exit() in error cases.
 32 setupterm(term=_os.environ.get(TERM, unknown),

--- 33   fd=_sys.__stdout__.fileno())

 34 stdscr = _curses.initscr()

 35 for key, value in _curses.__dict__.items():
error: setupterm: could not find terminal
sage:

This is in konsole (KDE's console). Any ideas?

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


[sage-support] Re: Re: Re: error: setupterm: could not find terminal

2013-08-22 Thread Volker Braun
Whats the output of 

sage -sh
strace python -c 'import curses; curses.initscr()' | grep xterm

with TERM=xterm and xterm-256color? And 

ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so 






-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Convolution Polynomial Ring

2013-08-22 Thread Santanu Sarkar
Dear all,
  Is convolution polynomial ring implemented in Sage?
I want to implement NTRU public key cryptosystem. Hence I need
modular inverse of a polynomial also in the ring.

With regards,
Santanu

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: Re: Re: Re: error: setupterm: could not find terminal

2013-08-22 Thread Martin Albrecht
Hi Volker,

On Thursday 22 August 2013 08:31:26 you wrote:

 sage -sh
 strace python -c 'import curses; curses.initscr()' | grep xterm
 with TERM=xterm

it's empty.

 and xterm-256color? 

it's also empty.

 ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so 

$ ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so 

 
linux-vdso.so.1 (0x7fff9299)
libncurses.so.5 = /opt/sage-5.12/local/lib/libncurses.so.5 
(0x7fae4a43f000)
libpython2.7.so.1.0 = /opt/sage-5.12/local/lib/libpython2.7.so.1.0 
(0x7fae4a05e000)
libpthread.so.0 = /lib/x86_64-linux-gnu/libpthread.so.0 
(0x7fae49e11000)
libc.so.6 = /lib/x86_64-linux-gnu/libc.so.6 (0x7fae49a65000)
libtinfo.so.5 = /opt/sage-5.12/local/lib/libtinfo.so.5 
(0x7fae49833000)
libdl.so.2 = /lib/x86_64-linux-gnu/libdl.so.2 (0x7fae4962e000)
libutil.so.1 = /lib/x86_64-linux-gnu/libutil.so.1 
(0x7fae4942b000)
libm.so.6 = /lib/x86_64-linux-gnu/libm.so.6 (0x7fae4912d000)
/lib64/ld-linux-x86-64.so.2 (0x7fae4a875000)

so it seems to pick up the right one.

I noticed that the shell after sage -sh is seriously FUBAR, e.g. backspace 
doesn't delete but adds spaces. This problem does not exist with 5.11. 

I should perhaps note that I am on zsh if that makes a difference (?)

Cheers,
Martin


--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6532AFB4
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinralbre...@jabber.ccc.de

signature.asc
Description: This is a digitally signed message part.


[sage-support] Re: Re: Re: Re: error: setupterm: could not find terminal

2013-08-22 Thread Volker Braun
Can you post the whole trace?

sage -sh
strace python -c 'import curses; curses.initscr()'  output.log



On Thursday, August 22, 2013 6:23:48 PM UTC+1, Martin Albrecht wrote:

 Hi Volker, 

 On Thursday 22 August 2013 08:31:26 you wrote: 

  sage -sh 
  strace python -c 'import curses; curses.initscr()' | grep xterm 
  with TERM=xterm 

 it's empty. 

  and xterm-256color? 

 it's also empty. 

  ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so 

 $ ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so   
 
 
 linux-vdso.so.1 (0x7fff9299) 
 libncurses.so.5 = /opt/sage-5.12/local/lib/libncurses.so.5 
 (0x7fae4a43f000) 
 libpython2.7.so.1.0 = 
 /opt/sage-5.12/local/lib/libpython2.7.so.1.0 
 (0x7fae4a05e000) 
 libpthread.so.0 = /lib/x86_64-linux-gnu/libpthread.so.0 
 (0x7fae49e11000) 
 libc.so.6 = /lib/x86_64-linux-gnu/libc.so.6 (0x7fae49a65000) 
 libtinfo.so.5 = /opt/sage-5.12/local/lib/libtinfo.so.5 
 (0x7fae49833000) 
 libdl.so.2 = /lib/x86_64-linux-gnu/libdl.so.2 
 (0x7fae4962e000) 
 libutil.so.1 = /lib/x86_64-linux-gnu/libutil.so.1 
 (0x7fae4942b000) 
 libm.so.6 = /lib/x86_64-linux-gnu/libm.so.6 (0x7fae4912d000) 
 /lib64/ld-linux-x86-64.so.2 (0x7fae4a875000) 

 so it seems to pick up the right one. 

 I noticed that the shell after sage -sh is seriously FUBAR, e.g. backspace 
 doesn't delete but adds spaces. This problem does not exist with 5.11. 

 I should perhaps note that I am on zsh if that makes a difference (?) 

 Cheers, 
 Martin 


 -- 
 name: Martin Albrecht 
 _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6532AFB4 
 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF 
 _www: http://martinralbrecht.wordpress.com/ 
 _jab: martinr...@jabber.ccc.de javascript:

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sage-support] arrays in Sage's cython

2013-08-22 Thread Nils Bruin
On Thursday, August 22, 2013 6:21:13 AM UTC-7, John Cremona wrote:

 Then use srange() which yields Integers. 

 John 


The appropriate answer should be: use xsrange, unless you explicitly need 
the integers as a list. The extra memory footprint of srange will probably 
be detrimental to performance.  

except that it isn't uniformly the case:

sage: timeit(for i in xsrange(100): a=i)
5 loops, best of 3: 157 ms per loop
sage: timeit(for i in srange(100): a=i)
5 loops, best of 3: 179 ms per loop
sage: timeit(for i in xsrange(1000): a=i)
625 loops, best of 3: 226 µs per loop
sage: timeit(for i in srange(1000): a=i)
625 loops, best of 3: 219 µs per loop

so perhaps with a little more careful programming (cythonizing xsrange?)  
one might be able to get the appropriate advice to be the uniformly correct 
advice as well.

I haven't timed it, but there's a good chance that writing the looping in 
cython to use a straight C-int and converting that (once) to an Integer, or 
using the while loop, is faster than deal with the overhead from (x)srange, 
even if they were optimized.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: Re: Re: Re: Re: error: setupterm: could not find terminal

2013-08-22 Thread Volker Braun
ncurses didn't install the terminfo database on your system... there is 
apparently no /opt/sage-5.12.beta3/local/share/terminfo

Can you post your ncurses build log?

On Thursday, August 22, 2013 7:07:17 PM UTC+1, Martin Albrecht wrote:

 Hi Volker, 

 here it is. Thanks! 

 Cheers, 
 Martin 

 On Thursday 22 August 2013 10:39:10 you wrote: 
  Can you post the whole trace? 
  
  sage -sh 
  strace python -c 'import curses; curses.initscr()'  output.log 
  
  On Thursday, August 22, 2013 6:23:48 PM UTC+1, Martin Albrecht wrote: 
   Hi Volker, 
   
   On Thursday 22 August 2013 08:31:26 you wrote: 
sage -sh 
strace python -c 'import curses; curses.initscr()' | grep xterm 
with TERM=xterm 
   
   it's empty. 
   
and xterm-256color? 
   
   it's also empty. 
   
ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so 
   
   $ ldd $SAGE_ROOT/local/lib/python2.7/lib-dynload/_curses.so 
   
   linux-vdso.so.1 (0x7fff9299) 
   libncurses.so.5 = /opt/sage-5.12/local/lib/libncurses.so.5 
   
   (0x7fae4a43f000) 
   
   libpython2.7.so.1.0 = 
   
   /opt/sage-5.12/local/lib/libpython2.7.so.1.0 
   (0x7fae4a05e000) 
   
   libpthread.so.0 = /lib/x86_64-linux-gnu/libpthread.so.0 
   
   (0x7fae49e11000) 
   
   libc.so.6 = /lib/x86_64-linux-gnu/libc.so.6 
 (0x7fae49a65000) 
   libtinfo.so.5 = /opt/sage-5.12/local/lib/libtinfo.so.5 
   
   (0x7fae49833000) 
   
   libdl.so.2 = /lib/x86_64-linux-gnu/libdl.so.2 
   
   (0x7fae4962e000) 
   
   libutil.so.1 = /lib/x86_64-linux-gnu/libutil.so.1 
   
   (0x7fae4942b000) 
   
   libm.so.6 = /lib/x86_64-linux-gnu/libm.so.6 
 (0x7fae4912d000) 
   /lib64/ld-linux-x86-64.so.2 (0x7fae4a875000) 
   
   so it seems to pick up the right one. 
   
   I noticed that the shell after sage -sh is seriously FUBAR, e.g. 
 backspace 
   doesn't delete but adds spaces. This problem does not exist with 5.11. 
   
   I should perhaps note that I am on zsh if that makes a difference (?) 
   
   Cheers, 
   Martin 

 -- 
 name: Martin Albrecht 
 _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x6532AFB4 
 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF 
 _www: http://martinralbrecht.wordpress.com/ 
 _jab: martinr...@jabber.ccc.de javascript:

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: Convolution Polynomial Ring

2013-08-22 Thread Santanu Sarkar
How to define  polynomial ring  like Z[x]/(x^10-1)  Z_5[x]/(x^10-1) in
Sage?


On 22 August 2013 12:37, Santanu Sarkar sarkar.santanu@gmail.comwrote:

 Dear all,
   Is convolution polynomial ring implemented in Sage?
 I want to implement NTRU public key cryptosystem. Hence I need
 modular inverse of a polynomial also in the ring.

 With regards,
 Santanu


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-support] Re: Convolution Polynomial Ring

2013-08-22 Thread Stefan van Zwam
On Thursday, August 22, 2013 4:06:22 PM UTC-4, Santanu wrote:

 How to define  polynomial ring  like Z[x]/(x^10-1)  Z_5[x]/(x^10-1) in 
 Sage? 


sage: R1.a = PolynomialRing(ZZ)
sage: R.x = R1.quotient(a^10 - 1)

sage: R2.b = PolynomialRing(GF(5))
sage: S.y = R2.quotient(b^10 - 1)

Now you can do:

sage: x^12
x^2

sage: y^14 + 7 * y
y^4 + 2*y

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sage-support] Re: Convolution Polynomial Ring

2013-08-22 Thread Santanu Sarkar
Thanks. But in this ring, I can not find gcd.

N=7
p=3

R2.b = PolynomialRing(GF(p))
S.x = R2.quotient(b^N - 1)


f=x^6-x^4+x^3+x^2-1
g=x^6+x^4-x^2-x

print gcd(f,g),xgcd(f,g)

Traceback (click to the left of this block for traceback)
...
TypeError: unable to find gcd




On 23 August 2013 03:10, Stefan van Zwam stefanvanz...@gmail.com wrote:

 On Thursday, August 22, 2013 4:06:22 PM UTC-4, Santanu wrote:

 How to define  polynomial ring  like Z[x]/(x^10-1)  Z_5[x]/(x^10-1) in
 Sage?


 sage: R1.a = PolynomialRing(ZZ)
 sage: R.x = R1.quotient(a^10 - 1)

 sage: R2.b = PolynomialRing(GF(5))
 sage: S.y = R2.quotient(b^10 - 1)

 Now you can do:

 sage: x^12
 x^2

 sage: y^14 + 7 * y
 y^4 + 2*y

 --
 You received this message because you are subscribed to the Google Groups
 sage-support group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sage-support+unsubscr...@googlegroups.com.
 To post to this group, send email to sage-support@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-support.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.