Unfortunately for your patch, the SAGE notebook (and server) was
almost completely rewritten during the last 2-3 weeks. In particular,
server.py is no longer used, and the SAGE notebook uses the vastly
more scalable twisted web2 networking framework. This new
version will be released within a
The most recent algorithm used in PHCpack is very fast and pretty
sophisticated; I believe its fair to say its a descendent of the
Emiris algorithm cited by Chuck Doran. I will go ahead and put it in
the PHCpack interface I am reworking.
My idea for the PHCpack interface is to have several
I often want to flatten nested lists, and such a command (like
Mathematica's Flatten) does not seem to be present in sage. I propose
adding such a command into the misc.py. I am appending some candidate
code below, and I will also put it on sage-trac (http://
def flatten(in_list, ltypes=(list, tuple)):
...
ltypes -- optional list of particular types to flatten
Could you elaborate on the decisions made around iterators here? I
can see that flatten([GF(5)]) could be tricky -- is it [GF(5)] or [0,
1, 2, 3, 4]?
Nick
To be honest I didn't give it much thought. This is modified from the
simplest code I could find that did the job.
flatten(GF(5)) does return [0,1,2,3,4], while flatten([GF(5)]) returns
[Finite Field of size 5]. However, you can do:
flatten([GF(5)],ltypes = (list, tuple,
Hi there,
I often come across the situation where I have to construct an integer from
its binary representation and vice versa. So far you do it in SAGE using
strings. I have attached a preliminary patch which allows the following code
to work, i.e. I _replaced_ the binary() method (which
There's a good discussion on the python mailing list regarding flatten:
http://mail.python.org/pipermail/python-list/2005-July/330367.html
particularly, it's got a number of different implementations, and benchmarks.
On Thu, 28 Jun 2007, Hamptonio wrote:
I often want to flatten nested
On Jun 28, 2007, at 5:04 PM, Martin Albrecht wrote:
Hi there,
I often come across the situation where I have to construct an
integer from
its binary representation and vice versa. So far you do it in SAGE
using
strings. I have attached a preliminary patch which allows the
Interesting. I think I originally ripped mine off from one of the
comments at:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/363051
although I've tried to make mine more readable.
The thread you linked to has the apparent winner of Ron Adams:
def flatten(seq):
s = []
Hi,
I ran into a glitch, using QuaternionAlgebraWithGramMatrix(field,
matrix):
- the code verifies that the second argument is a matrix
with isinstance(Matrix), which blows up because 'Matrix'
is not known. A simple 'import' fixes that.
- then the code blows up because
On 6/29/07, David Harvey [EMAIL PROTECTED] wrote:
On Jun 28, 2007, at 5:04 PM, Martin Albrecht wrote:
Hi there,
I often come across the situation where I have to construct an
integer from
its binary representation and vice versa. So far you do it in SAGE
using
strings. I have
Hmmm I don't know if I like this. Well, I don't have any objections
to such a method being available, but I prefer the name binary to
have the current behaviour. It's more pythonic, like the hex function.
But there is no binary/bin function. I understand that __hex__ returns a
string to obey
On Jun 28, 2007, at 6:06 PM, Martin Albrecht wrote:
Hmmm I don't know if I like this. Well, I don't have any objections
to such a method being available, but I prefer the name binary to
have the current behaviour. It's more pythonic, like the hex
function.
But there is no binary/bin
Sorry I didn't reply earlier.
Implementing an is_symmetric function for matrices sounds like a good idea.
But I think it should go in the base class: something like
def is_symmetric(self):
if self.ncols != self.nrows:
return False
cdef int i, j:
for i from 1 = i self.nrows:
+1 -- I agree 100% with David Roe's response.
On 6/28/07, David Roe [EMAIL PROTECTED] wrote:
Sorry I didn't reply earlier.
Implementing an is_symmetric function for matrices sounds like a good idea.
But I think it should go in the base class: something like
def is_symmetric(self):
if
On 6/28/07, Hamptonio [EMAIL PROTECTED] wrote:
Interesting. I think I originally ripped mine off from one of [...]
Hi,
I've incorporated this into SAGE as a patch. The main things I did
were add more examples and delete part of the function which I
consider stupid. E.g., you wrote
Martin Albrecht [EMAIL PROTECTED] writes:
Hi there,
I often come across the situation where I have to construct an integer from
its binary representation and vice versa. So far you do it in SAGE using
strings. I have attached a preliminary patch which allows the following code
to work,
I've incorporated this into SAGE as a patch.
I like the final form.
[EMAIL PROTECTED]:~/d/sage/sage/misc$ hg export 5194
# HG changeset patch
# User William Stein [EMAIL PROTECTED]
# Date 1183076918 25200
# Node ID 25f23d18288895f46a6aaa2bd8ef147cde5e31f3
# Parent
Whoops! - sorry about the misreporting on the GF(5) behavior. I was
playing around with lots of similar versions and I must have gotten
confused.
That extra loop you deleted was put in to avoid errors on weird cases
like: flatten([[]]), which gives an IndexError: list index out of
range if the
On 6/28/07, Hamptonio [EMAIL PROTECTED] wrote:
Whoops! - sorry about the misreporting on the GF(5) behavior. I was
playing around with lots of similar versions and I must have gotten
confused.
That extra loop you deleted was put in to avoid errors on weird cases
like: flatten([[]]), which
On Jun 28, 2007, at 16:30 , David Roe wrote:
Sorry I didn't reply earlier.
Not a problem.
Implementing an is_symmetric function for matrices sounds like a
good idea.
But I think it should go in the base class: something like
That was my feeling as well.
def is_symmetric(self):
21 matches
Mail list logo