[sage-devel] Memory leak (quite bad)

2023-07-05 Thread Gonzalo Tornaria
This slowly and inexorably goes on. Computing `sqrt(T2)` leaks 32 bytes 
each and every time (asymptotically).

Found by a student who, through no fault of himself, brought down our 
server (unable to ssh in until the OOM triggered -- but since the leak is 
slow it takes a while to trash 16G of swap).

===
$ cat memleak.py 
from sage.all import sqrt
T2 = sqrt(2)
import psutil
ps = psutil.Process()
base = ps.memory_info().rss
for a in range(1, 10):
for b in range(num := 100_000):
C = sqrt(T2)
mem = ps.memory_info().rss - base
print(f"{mem/1e6 :.2f} MB ({mem/a/num :.2f} bytes/iter)")
$ sage memleak.py 
2.70 MB (27.03 bytes/iter)
5.95 MB (29.74 bytes/iter)
9.19 MB (30.64 bytes/iter)
12.44 MB (31.09 bytes/iter)
15.41 MB (30.82 bytes/iter)
18.65 MB (31.09 bytes/iter)
21.90 MB (31.28 bytes/iter)
25.14 MB (31.43 bytes/iter)
28.39 MB (31.54 bytes/iter)
===

Replace the 10 in the outer loop by something larger at your own peril 
(each outer iteration will take 3.2M so 10_000 should kill a laptop in an 
hour or two).

This is with system sagemath 10.0 but it also happens with 9.6, 9.7, 9.8 
and 10.0 in cocalc.com.

Best,
Gonzalo

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/26ec41f7-c591-48b6-ab57-463b8b8a1675n%40googlegroups.com.


Re: [sage-devel] sage is slowding down PARI/GP by factor x2 (roughly)

2022-12-18 Thread Gonzalo Tornaria
See https://trac.sagemath.org/ticket/34850#comment:65.

Do I get that beer in Luminy?

Best,
Gonzalo

On Friday, December 16, 2022 at 5:47:46 PM UTC-3 dim...@gmail.com wrote:

> On Fri, Dec 16, 2022 at 4:58 PM David Lowry-Duda  
> wrote:
> >
> > On Thu, Dec 15, 2022 at 12:19:28PM +, Dima Pasechnik wrote:
> > >On Thu, Dec 15, 2022 at 12:05 PM John Cremona  
> wrote:
> > >>
> > >> A propos, which Sage developers will be in Luminy for the COUNT
> > >> meeting? I will.
> > >>
> > >I'm still waiting to hear from them. Or perhaps they don't notify
> > >people who haven't made it on the list, I have no idea.
> > >I should form a 1-person union and declare myself on strike w.r.t.,
> > >quoting their announcement, "informal collaboration and for coding
> > >projects related to PARI/GP, SageMath,..." :-)
> > >
> > >Dima
> >
> > I'm also waiting to hear from them. But in principle, I'd like to be
> > there too.
> >
>
> we're now on the list, as far as I can see:
>
>
> https://www.cirm-math.fr/Listes/liste_pre_verif.php?id_renc=2805_semaine=0
>
> Cheers
> Dima
>
> > - DLD
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sage-devel+...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/Y5yjk1mCDBY9kkIL%40icerm-dld.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/3488c44b-07ac-458e-8c13-79abcba96db1n%40googlegroups.com.


Re: [sage-devel] Re: What does it mean for a ticket to be closed?

2013-12-21 Thread Gonzalo Tornaria
Maybe you could append a Fixes: #x to the commit message (similar to
the Signed-of-by lines that are used in the linux kernel), then have an
hook in the official repo close the ticket. This way the ticket is
automatically closed iff and when the fix is merged to the official
development branch.

Best,
Gonzalo




On Thu, Dec 19, 2013 at 10:01 AM, Volker Braun vbraun.n...@gmail.comwrote:

 On Thursday, December 19, 2013 11:42:23 AM UTC, Jeroen Demeyer wrote:

 You could consider closing a ticket only *after* testing it on the
 buildbot (that was what I did) when it is as good as certain that it
 will actually be merged.


 Yes, I've been doing both depending on how probable it seemed that the
 ticket can break something. Still trying to get a feel for the best
 workflow

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


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


Re: [sage-devel] Re: Changing branch on a trac ticket

2013-11-05 Thread Gonzalo Tornaria
More reading and some comments:

a. Linus et al on git rebase: http://yarchive.net/comp/linux/git_rebase.html.

b. An article in LWN about the topic: http://lwn.net/Articles/328436/

c. In the first reference there are a couple of comments by Linus on
revert -- including a recipe using rebase that seems natural.

d. to revert without rewriting history, I belive git revert does the trick.

With respect to the allow rewriting history vs. don't allow
rewriting history, p lease have a look at the comments by Linus from
(a) above. I think he knows what he's talking about.

One thing that Linus stresses is that rebasing affects more the people
downstream than the people upstream. For instance: if a group is
working on some module, we push a series of patches (but I'm still
working on subsequent ones), and somewhere in the path between us and
the final merge the patches get rewritten, then our work after that
may be seriously screwed (meaning: we have to work to adjust, and we
don't have history to tell us *how* or *where* the divergence with our
codebase.

On Tue, Nov 5, 2013 at 10:20 AM, Simon King simon.k...@uni-jena.de wrote:
 If the commit history was like
  A: Basic implementation of a duck (quacks, swims)
  B: Added duckumentation
  C: Added feature duck flies
  D: Remove trailing whitespace
  E: Fix bad doc formatting
 then I believe to *some* extent it makes sense to re-group these commits
 (like: (A+C+D)-(B+E)), since, as we have seen, rebasing of dependent
 branches does not become more difficult.

As Linus says I wouldn't argue for hard rules and this may be an
exception under some circumstances, but as a general rule I can think
of different scenarios where it's ok and where it's not ok to rewrite.
In particular I think this is only ok if all A-E have been writing by
the same person or a group with tight synchronization, and I guess it
also depends on time elapsed between A and E, etc.

Example:

1. A, B are posted in ticket
2. purple-sage (or sage-next, or whatever) gets interested in ducks,
and decides to merge these experimentally
3. C is posted in ticket
4. review of ticket requests D, E
5. author rewrites history to (A+C+D) , (B+E)
6. merged in master sage as rewritten
7. now purple-sage is screwed up wrt master sage

Of course it wouldn't be too bad to resolve this issue for a few
tickets, but doing it for a number of them may be quite boring. I
would assume one of the features of switching to git would be to ease
the exchange of code between sage and other efforts like purple-sage,
and/or allow having a sage-next branch, or ... (other ideas people
may come up with).

Different scenario: A is completely broken so no way it can be merged
(e.g. breaks compilation); then A is never merged, the author is
requested to redo the feature, a new patch A' is posted by the author
(based on A, fine) and that's merged. In this scenario purple-sage
wouldn't have merged A either (due to compilation broken) or would
want it removed anyway.

--

As a general rule I would argue for:
 a. no rewriting of other people patches
 b. no rewriting of own patches that have been published
 c. adopt a sensible definition of published which allows *some*
rewriting that people may want
 d. empower developers with easy ways to share feature development
branches which are not published
 e. allow sensible exceptions when truly necessary

For (d) feature branches should be based on stable points anyway and
refrain from frequent pulls/merges with master until the feature is
merged, etc.

Best,
Gonzalo

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


Re: [sage-devel] Re: Changing branch on a trac ticket

2013-11-05 Thread Gonzalo Tornaria
On Tue, Nov 5, 2013 at 12:32 PM, Simon King simon.k...@uni-jena.de wrote:
 Hi Gonzalo,

 On 2013-11-05, Gonzalo Tornaria torna...@math.utexas.edu wrote:
 Example:

 1. A, B are posted in ticket
 2. purple-sage (or sage-next, or whatever) gets interested in ducks,
 and decides to merge these experimentally
 3. C is posted in ticket
 4. review of ticket requests D, E
 5. author rewrites history to (A+C+D) , (B+E)
 6. merged in master sage as rewritten
 7. now purple-sage is screwed up wrt master sage

 Of course it wouldn't be too bad to resolve this issue for a few
 tickets, but doing it for a number of them may be quite boring.

 Wait a second. If purple-sage branches off at 2. (hence, if it only knows
 about A and B), then it eventually needs to be rebased anyway, because
 we now also have C, D, E.

It doesn't need to be rebased. As a general rule, C-D-E would be
pulled on top of B and merged with whatever other changes that
happened in purple-sage after B.

Merging is much more convenient than rebasing because it keeps history around.

A practical reason why history is important: merging. To do a proper
automatic or assisted merge of two versions of a file, you need a
common base version to do 3-way merge (think about it, it really
cannot work without a common base version -- how would you distinguish
blocks of code that where added in version A from blocks of code that
where removed in version B?). If we rewrite history (e.g. doing a
rebase instead of a merge) then we complicate merges further down the
line.

(This is besides all the other good reasons to not rewrite history,
e.g. git annotate/blame or git bisect, etc)


 That's why I argued: If rebasing of purple-sage with respect to
 (A+C+D)-(B+E) is not more difficult than rebasing of purple-sage with
 respect to A-B-C-D-E, and since rebasing of purple-sage is certainly
 necessary because of the existence of C, D and E in the master branch,
 then why do people keep argueing that changing the history causes
 trouble? It does not cause the trouble, and it does not increase
 trouble (at least in this and the previously discussed examples).

 To say it clearly: In the scenario above, you *have* to rebase, with or
 without a change of history, and the rebase (if I understand correctly)
 is the same effort with or without a change of history.

 Hence, saying that we need to rebase dependent work is just not an
 argument against rewriting history.


Best,
Gonzalo

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


Re: [sage-devel] Re: Changing branch on a trac ticket

2013-11-04 Thread Gonzalo Tornaria
Relevant article by Linus Torvalds:

http://lwn.net/Articles/328438/

Best,
Gonzalo

On Mon, Nov 4, 2013 at 4:33 PM, David Roe roed.m...@gmail.com wrote:
 I agree with Volker: any plan which involves rewriting the history of your
 branch to make it nicer is a very bad idea.  Once you push changes to
 trac, you really should not go back and rewrite your commits.  Even if you
 decide you don't want some code that you introduced, you should introduce a
 new commit that deletes the code rather than removing old commits and
 force-pushing your branch.

 This is a fundamental difference between using patches and using revision
 control properly.  You just can't do this kind of thing without causing
 anyone else who's based work on your ticket a lot of pain.  And you won't
 even know who they are: they may not have pushed their work to a trac ticket
 yet.

 TLDR; don't rewrite history.
 David


 On Mon, Nov 4, 2013 at 9:55 AM, Volker Braun vbraun.n...@gmail.com wrote:

 git blame already does cumulative blame over a range of commits. By
 mashing commits together you don't gain anything. But you invalidate all
 branches that were based on the un-mashed commits.

 If you absolutely can't live with others noticing that you are human after
 all, then you can still squash your history locally before pushing it to
 trac. But IMHO thats just OCD and nothing that we should teach people to do
 by default.

 TLDR; lots of pain for absolutely no gain.



 On Monday, November 4, 2013 6:15:19 AM UTC, Nils Bruin wrote:

 That's good to know. However, when trying to figure out the history of
 code, it's usually not so much the question what has changed, but more when
 and (more importantly) why. git blame does that, and hopefully the log
 entry for the relevant commit tells you where to look further. If that
 commit reads third iteration of typo correction and rollback of latest
 change it's not so helpful and you need to go and look in the log for
 commits close by that are more instructive.

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


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

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


Re: [sage-devel] Re: VectorSpaces vs tuples

2012-12-12 Thread Gonzalo Tornaria
On Tue, Dec 11, 2012 at 10:38 PM, Robert Bradshaw
rober...@math.washington.edu wrote:
 Not requiring a coercion allows statements like

 sage: 4/2 in ZZ
 True

 when there's no coercion from QQ to ZZ. I'm all for a better
 heuristic. (Perhaps require a coercion or injective coercion inverse
 into the target parent?) It gets even trickier for inexact parents.
 And of course who knows how much other stuff this will break.


OTOH:

sage: 4/2 in ZZ
True
sage: 4/2 in GF(3)
False
sage: 4/3 in ZZ
False
sage: 4/3 in GF(3)
---
ZeroDivisionError Traceback (most recent call last)
...
ZeroDivisionError: Inverse does not exist.


Best,
Gonzalo

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




Re: [sage-devel] Re: Fwd: NaN = Not A Number ???

2012-03-28 Thread Gonzalo Tornaria
On Thu, Mar 22, 2012 at 4:14 PM, Robert Bradshaw
rober...@math.washington.edu wrote:
 ...
 This is horrendous. Better to not have this constant (at least not
 in the global namespace) than behavior like this. The top level NaN,
 if we want one, could be in RR (precision doesn't really matter for
 this value).

Agreed, that's my point.

Working on a completely unrelated project, I was hit by a different
and unrelated bug regarding NaN:


sage: RR(NaN)  float(1e-10)
True


Also, I point out that the usual definition of NaN includes the fact
that NaN == NaN should be false. Sage doesn't behave consistently:

sage: float(NaN) == float(NaN)
False
sage: RR(NaN) == RR(NaN)
True
sage: NaN == NaN
NaN == NaN
sage: bool(_)
True

(this property is handy to test whether a value is nan)

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] Fwd: NaN = Not A Number ???

2012-03-21 Thread Gonzalo Tornaria
In sage 4.8:

sage: NaN - NaN
sage: 0
sage: NaN + NaN
2*NaN
sage: NaN * NaN
NaN^2

not what I expected...

RR(NaN) seems to work better

sage: RR(NaN) - RR(NaN)
NaN
sage: RR(NaN) + RR(NaN)
NaN
sage: RR(NaN) * RR(NaN)
NaN

Still some weirdness:

sage: RR(NaN) + x
x
sage: RR(NaN) * x
NaN*x



Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Eigen-stuff in Sage

2011-06-24 Thread Gonzalo Tornaria
On Thu, Jun 23, 2011 at 4:49 PM, Rob Beezer goo...@beezer.cotse.net wrote:
 Proposal:  For matrices over QQ (or implicitly ZZ) with eigenvalues
 outside QQ, make the default output like the second example above,
 while retaining the current output as optional behavior via a keyword.

What's wrong with:

sage: B = matrix(ZZ, [[-87, -1, 1], [17, 2, -6], [-1, -2, 7]])
sage: B.eigenvectors_right()
[(-86.80242042716417?, [(1, -0.190991066220052?, 0.006588506615773?)],
1), (0.12344763849958892?, [(1, -122.6499594923977?,
-35.52651185389811?)], 1), (8.67897278866459?, [(1,
-43.93682721916003?, 51.74214556950456?)], 1)]

?

And what if the output of B.eigenspaces_right() is a bit confusing?
I'd argue that's actually a feature, because it will make the student
*think* about it, get a glimpse of some interesting mathematics, and
maybe open a door to a new world.

We can just tell students to use the eigenvectors_* methods, and
challenge them to figure out how to read the output of the
eigenspaces_* methods.


Best,
Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] Question about coercion

2011-06-07 Thread Gonzalo Tornaria
In sage/structure/parent_base.pyx there is a function
check_old_coerce with the following definition:

cdef inline check_old_coerce(parent.Parent p):
   if p._element_constructor is not None:
       raise RuntimeError, %s still using old coercion framework % p


This function is called from a few methods in class ParentWithBase
(e.g. from _richcmp, from _coerce_c_impl, and from base_extend).

In my class (which inherits from ParentWithBase) I've defined
_element_constructor_ instead, but the init for ParentWithBase insist
on copying this method onto _element_constructor -- thus the
check_old_coerce function always fails... It's impossible to
avoid!!!

What is the base class that one is supposed to use instead of ParentWithBase?

The only reference for the coercion model that I was able to find is
http://www.sagemath.org/doc/reference/coercion.html#example, which
even shows an example, but the example inherits from Ring, which
ultimately inherits from ParentWithBase anyway.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Question about coercion

2011-06-07 Thread Gonzalo Tornaria
On Tue, Jun 7, 2011 at 5:18 PM, Simon King simon.k...@uni-jena.de wrote:
 Hi Gonzalo,

 On 7 Jun., 21:25, Gonzalo Tornaria torna...@math.utexas.edu wrote:
 What is the base class that one is supposed to use instead of ParentWithBase?

 I think it is Parent. The Parent.__init__ accepts an argument base.

 Here is a small example:

Thanks for the example. I'll try it.

One caveat, though. The standard Ring and Algebra parents both
inherit from the ParentWithBase. Am I allowed to mix an element class
derived from AlgebraElements with a parent class derived from Parent?

Also, is it my impression or this model seems to require a lot of
boilerplate if I wanted to implement it fully (with categories,
functors, etc)?

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: AbelianGroup constructor can't handle its own elements

2011-05-09 Thread Gonzalo Tornaria
On Sun, May 8, 2011 at 3:34 PM, John Cremona john.crem...@gmail.com wrote:
 I forwarded this thread to sage-algebra.

Thanks John. I'm actually not subscribed to sage-algebra.

Is it undesirable to discuss this here?

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] AbelianGroup constructor can't handle its own elements

2011-05-08 Thread Gonzalo Tornaria
sage: G = AbelianGroup(1,[2])
sage: ZG = GroupAlgebra(G)
sage: f = ZG(G.gen())
sage: f in ZG
True
sage: ZG(f)
...
TypeError: Don't know how to create an element of Group algebra of
group Multiplicative Abelian Group isomorphic to C2 over base ring
Integer Ring from f

--

Proposed fix:

--- a/sage/algebras/group_algebra.pyFri May 06 15:29:53 2011 -0700
+++ b/sage/algebras/group_algebra.pySun May 08 14:40:24 2011 -0700
@@ -234,6 +234,8 @@
 sage: ZG = GroupAlgebra(G)
 sage: ZG(f)
 f
+sage: ZG(f) == ZG(ZG(f))
+True
 sage: ZG(1) == ZG(G(1))
 True
 sage: ZG(FormalSum([(1,f), (2, f**2)]))
@@ -305,7 +307,10 @@
 if not hasattr(x, 'parent'):
 x = IntegerRing()(x) # occasionally coercion framework
tries to pass a Python int

-if isinstance(x, FormalSum):
+if parent is x.parent():
+self._fs = x._fs
+
+elif isinstance(x, FormalSum):
 if check:
 for c,d in x._data:
 if d.parent() != self.parent().group():

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] default __hash__

2011-04-19 Thread Gonzalo Tornaria
On Mon, Apr 18, 2011 at 10:24 PM, William Stein wst...@gmail.com wrote:
 ...
 I think it is worth revisiting this design decision.     I did a
 little poking, and in Python and Cython, a class by default has a
 hash, which is the location in memory of the object, e.g.,

Only so long as the class doesn't define __eq__ or __cmp__. That makes
sense, because the default equality comparision in python is that two
objects are equal if and only if they are the same instance. Thus, the
basic assumption on hashes is not broken (equal objects should have
the same hash). If a class defines a comparision, the default hash is
to raise an exception

 So the main issue I pointed out above, namely that SageObject has a
 __hash__ defined, is really a non-issue, since that's the standard
 default convention in Python anyways.

No, the basic assumptions about hashes in Python are:

1. the hash of an object never changes
2. two objects that compare equal should have the same hash

bad things happen if either assumption is broken (a third assumption
would be that hash collisions are uncommon, but that only affects
performance, not semantics).


So, as you suggested in the OP, the right thing is to have the
__hash__ method removed from the SageObject class, and define it for
subclasses as needed (and only for immutable classes!)

Note that the class Element (sage.structure.element.Element) also has
a similar default definition for __hash__.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] default __hash__

2011-04-18 Thread Gonzalo Tornaria
http://thedailywtf.com/Articles/The-Nondeterministic-Hash.aspx

Gonzalo

On Mon, Apr 18, 2011 at 4:13 PM, William Stein wst...@gmail.com wrote:
 Hi,

 I was just explaining to a student in my Sage course how I had
 stupidly defined a default __hash__ method for SageObject, which was
 -- stupidly -- to just hash the string representation.  This was of
 course silly and dangerous since only immutable objects should have a
 __hash__ method.    I then of course pointed out that we must have
 fixed this years ago!  But amazingly we didn't:

 sage: S = SageObject(); S
 type 'sage.structure.sage_object.SageObject'
 sage: hash(S)
 -7904861314369208036
 sage: S.__hash__??
 File: /sagenb/flask/sage-4.6.2/devel/sage/sage/structure/sage_object.pyx
 Source Code (starting at line 156):
 def __hash__(self):
    return hash(self.__repr__())


 Thoughts?

  -- William




 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

 --
 To post to this group, send an email to sage-devel@googlegroups.com
 To unsubscribe from this group, send an email to 
 sage-devel+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-devel
 URL: http://www.sagemath.org



-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] VMware image -- bug with an easy fix

2011-03-31 Thread Gonzalo Tornaria
On Wed, Mar 30, 2011 at 7:52 PM, William Stein wst...@gmail.com wrote:
 There is an easy fix though.  The problem was that the default network
 interface got renamed by udev to eth6, but the file
 /etc/network/interfaces only lists eth1-eth4.
 So whoever (?) is maintaining the vmware image should just add a bunch
 more lines to that file, say with all interfaces up to eth10 searched
 for.

Also worth looking at the persistent rules for net devices udev. E.g.
in debian, they are in

/etc/udev/rules.d/70-persistent-net.rules

Cleaning up the rules may help to keep the name of the eth interface
to eth0 or eth1.

I presume vmware is showing a device with a different MAC for each vm,
so each time the image is run in a new vm a new rule is added with a
new interface name.

HTH

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Adjoint of a matrix

2010-12-20 Thread Gonzalo Tornaria
On Thu, Dec 9, 2010 at 10:03 PM, Rob Beezer goo...@beezer.cotse.net wrote:
 Is there any objection to deprecating the current .adjoint() function
 (which returns a matrix of cofactors) and renaming it as the
 adjugate?  With all the usual procedures and warnings for the
 deprecation.  That would begin the process to free up adjoint for
 something else (ideally the conjugate-transpose).

I've been unable to reply on this before, and today after receiving a
comment on ticket #10501 I commented right there, which was possibly a
bit unpolite given the lapse of time and that I didn't post that
commentto this thread (if so I apologize).

Anyway, here's a copy of my post, in case it's helpful:

I already stated some objections, but I'll repeat:

On deprecating adjoint meaning matrix of cofactors
1. it's standard terminology and has meant this in sage for long
2. adjugate is newer and (IMO) less standard terminology -- in
particular it has no obvious translations

On using adjoint meaning conjugate transpose
3. conjugate transpose is easy to say, and it's really what is meant
4. the adjoint operator for a matrix seems ill-defined, because a
matrix is not an operator but only a representation of an operator in
some basis.

Moreover, if there are two colliding usages of the name adjoint, I
would find it more reasonable to keep the usage that is already
traditional in Sage.

The usage of adjoint is ubiquitous in relation to quadratic forms
afaict (and, as John Cremona pointed out, is where the term originates
with Gauss on ternary quadratic forms).

I also pointed out a reference to Bourbaki which I already posted
above. I still haven't found a reference for adjugate which
satisfies me (I mean, where does it originate?) or a good reference
for how to use adjoint of a matrix as meaning conjugate transpose
in reference to adjoint operators without eventually causing some pain
when using it in the real world where not all bases are orthogonal
(not even all vector spaces have inner product).

OTOH, I do certainly appreciate that transpose and conjugate transpose
is used quite a lot, and thus I think it really deserves all the
shortcuts proposed (T, H, star, etc).

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Adjoint of a matrix

2010-12-02 Thread Gonzalo Tornaria
On Thu, Dec 2, 2010 at 7:16 AM, John Cremona john.crem...@gmail.com wrote:
 What you call the classical adjoint is really the adjugate.  That is
 abbreviated to adj, and since there is also an adjoint, it is a common
 error to call the adjugate the adjoint.

Do you have a reference for this convention? I had never seen the word
adjugate before.

--

Something interesting:

if T : V -- V  is an operator, it naturally induces a graded operator
T* in the exterior algebra of V. If V is of finite dimension n, there
are two pieces of the exterior algebra which are isomorphic to V,
namely

1. Lambda_1(V) = the dual space of V
2. Lambda_{n-1}(V) = the space of (n-1)-multivectors of V

Then the restriction of T* to Lambda_1(V) is the adjoint (or dual)
operator, but the dual space is not canonically isomorphic to V. Given
a duality (inner product) then you get the adjoint operator acting in
V. The matrix depends on the choice of basis.

On the other hand, Lambda_{n-1}(V) is naturally isomorphic to V (the
isomorphism is given by the determinant), and
so the restriction of T* to Lambda_{n-1}(V) naturally induces an
operator on V, which is precisely what I would call adj T. Since
this is natural, an adjoint operation for matrices can be defined in
terms of this.

In summary, both notions of adjointness are quite related. The simple
one is just duality, and makes more sense for operators in inner
product spaces. The seemingly not-so-simple one is natural, makes
sense for operators or matrices, is usually expressed in terms of
matrices, and appears often in relation to quadratic forms.

 However:  the first ever occurrence of what I just said is really the
 adjugate is in Gauss's Disquisitiones Mathematicae in Art. 267 (page
 293 of the modern Springer translation), where he calls it the
 adjoint!  But this is in a very special case: symmetric 3x3 integer
 matrices, representing ternary quadratic forms, and Gauss does not use
 our standard matrix notation.  So he is defining the adjoint of
 ternary quadratic forms rather than matrices.

+1 to Gauss :-)

[he reduces ternary quadratic forms by alternating a binary reduction
step on the form itself and a binary reduction step on the adjoint, so
he may have invented adjoints for this purpose]

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Adjoint of a matrix

2010-12-02 Thread Gonzalo Tornaria
On Fri, Dec 3, 2010 at 12:59 AM, kcrisman kcris...@gmail.com wrote:
 Do you have a reference for this convention? I had never seen the word
 adjugate before.

 At least in an older edition of Lay's Linear Algebra book (fairly
 widely used) uses this, and points out there is a real adjoint which
 is not covered in his text.

With a bit of help of books.google.com I can see adjugate is used in
this book (adjoint matrix is not used, though); however it doesn't
seem to contain any reference to where this word came from. Do you
know?


On the other hand, searching for

The adjoint of a square matrix bourbaki

in books.google.com, yields the following passage:


The adjoint of a square matrix X of order n over A is the matrix X =
(det (A')) of minors of A of order n — 1.


(bourbaki, elements, book 2, chapter III, section 11, exercise 9 --
the term also shows at the index of terminology)


Best,
Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Supported platforms - once again

2010-10-25 Thread Gonzalo Tornaria
On Mon, Oct 25, 2010 at 12:09 PM, David Kirkby david.kir...@onetel.net wrote:
 Since Minh has been using an external server (I think run by GNU) for
 Debian, we can probably add Debian at some point if we can get
 permission to run a buildbot slave there.

1. Is there a reason for not running debian on a vm on boxen?

2. what is needed to run a buildbot?

(it would feel pretty awkward not to support debian)

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: sage 4.5.1 unpack

2010-07-20 Thread Gonzalo Tornaria
On Tue, Jul 20, 2010 at 3:43 AM, 3DRaven 3dra...@gmail.com wrote:
 Yes. I do not speak English.
 I use a translator of Google.
 Why unpacking: sage-4.5-linux-32bit-ubuntu_10.04_lts-i686-
 Linux.tar.lzma
 I get the message about the impossibility of creating hard links?

I just checked the file and I don't see any hard links in the tarball.

Can you copy *exactly* what command you are using to uncompress, and
what error message you get?

Gonzalo
PS: maybe your hard drive is full / running out of inodes. That is
possible since there are 69k files in the tarball. You can check your
disk space and inodes with df -h and df -i respectively.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: talk on Sage...

2010-05-10 Thread Gonzalo Tornaria
On Mon, May 10, 2010 at 9:41 AM, William Stein wst...@gmail.com wrote:
 On Monday, May 10, 2010, Tim Joseph Dumol t...@timdumol.com wrote:

 I have the same problem. I see color noise instead of 3d plots.


 There is no support in the sage notebook for printing 3d plots.   I'm
 a little surprised you guys didn't know this...

It does, if one uses tachyon as the viewer, doesn't it?

Would it make sense to have a global way to select the 3d viewer and a
checkbox at the top of the worksheet to change the 3d viewer (kind of
like the typeset checkbox).

I find myself using the same worksheets usually on a java-less
browser, but sometimes I use a java-enabled browser for presentations
and I actually want to use jmol applet, so a solution like that would
be useful.

Best, Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: GCC-4.5.0

2010-05-06 Thread Gonzalo Tornaria
On Thu, May 6, 2010 at 7:58 PM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 ...
 The recent case of gcc accepting the macro INFINITY even when code was not 
 compiled in C99 mode was just one example. INFINITY was not defined until the 
 C99 standard.
 ...
 I must admit, I find it somewhat annoying that gcc is still not fully C99
 compliant, despite it is 12 years since the standard was released!
 ...

LOL!

I hope the C99 standard doesn't specify the behaviour when code is NOT
compiled in C99 mode... :-)

Gonzalo
PS: If it is possible to touch a clock without stopping it, then it
should be possible to start a clock without touching it!

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] Fwd: [mpir-devel] New MPIR-related project

2010-05-03 Thread Gonzalo Tornaria
On Fri, Apr 30, 2010 at 4:11 AM, Sergey Bochkanov
sergey.bochka...@alglib.net wrote:
 Hello, William.

 In Sage we (=mostly Gonzalo Tornaria) spent an enormous amount of time
 writing two very efficient C functions, one to convert from mpz to
 Python ints, and one to convert back.   Yes, writing this code is a
 lot of work.  But no, the resulting code is not slow.  Just because
 something is hard doesn't mean we can't do it.
 If you want this code, I bet Gonzalo would be OK with letting you have
 it under another license (it's GPL v2+ right now); it's not long, just
 tricky to write.

 That  would  be  nice.  Currently X-MPIR is licensed under LGPL, but I
 think  that  the  same  automatic codegen technology may be applied to
 other  projects  under  different  licenses. So having this code under
 something BSD-like would be important step in Python support.

Although I'm more of a GPL (v2) type, and I wouldn't write BSD code
unless I had a very good reason, I could consider relicensing some
interface code like this.
I've actually relicensed this code to LGPL v2+ (for gmpy), but I'm not
sure I can go farther than that, since my code was based on GMP code
(itself LGPL v2+ at the time).

See the forwarded message below for details.

Best,
Gonzalo

-- Forwarded message --
From: Gonzalo Tornaria torna...@math.utexas.edu
Date: Tue, Sep 8, 2009 at 10:58 PM
Subject: Re: mpmath and files
To: William Stein wst...@gmail.com
Cc: casevh cas...@gmail.com, mpm...@googlegroups.com


On Tue, Sep 8, 2009 at 8:54 PM, William Steinwst...@gmail.com wrote:
 On Tue, Sep 8, 2009 at 4:38 PM, casevhcas...@gmail.com wrote:
 On Sep 7, 5:00 pm, William Stein wst...@gmail.com wrote:
 I think there is very complicated highly optimized code somewhere in Sage
 (http://sagemath.org) for conversion between Python longs and GMP
 mpz_t's.  If this is what you need, it could be dug up.

 I maintain gmpy, the Python wrapper for GMP or MPIR, and I would like
 to look at including Sage's conversion code. I'm currently using
 mpz_import and mpz_export and am always looking for faster code.

 Case Van Horsen


 Hi,

 Look in the src and include directories here:

 http://sage.math.washington.edu/home/wstein/build/sage-4.1.1/devel/sage/c_lib/

 Would there be any licensing issues since gmpy is LGPL2+?

 Yes, there is a problem since the code is licensed GPL2+.  However,
 I've cc'd the author -- Gonzalo Tornaria -- and I bet he would be
 willing to contribute a LGPL2+ version of the code to gmpy.  I
 certainly endorse that!

I can definitely contribute the mpz--pylong conversion code to gmpy
under LGPL2+.

You want to look at the files mpn_pylong.c and mpz_pylong.c. The high
level interface (mpz - pylong) is given by functions
mpz_get_pylong() and mpz_set_pylong(). There's also a function
mpz_pythonhash() which computes a python-compatible hash of mpz
integers.

The function mpz_get_pyintlong() is a variation of mpz_get_pylong()
written by David Harvey --- you should ask him about that one.

Note also that the base conversion code used in mpn_get_pylong() is
based on GMP code --- I think GMP was LGPLv2+ at the time, so it
should be fine.

Let me know if you have any issues with using this code in gmpy.

If you use the code, can you add a comment to the files along these lines:


Originally written for sage (http://sagemath.org) -- if you improve
these functions, please contribute them back to sage by posting to
sage-devel@googlegroups.com or sending me an email.


Best, Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: norm of a complex number

2010-04-27 Thread Gonzalo Tornaria
2010/4/27 Johan Grönqvist johan.gronqv...@gmail.com:
 The definition of norm on vectors is consistent with definitions of norm
 according to wikipedia [0] and the springer encyclopedia of mathematics [1],
 and (I believe) any book I have ever used. Those did not even mention that
 there is an alternative definition of norm used in number theory.

Here it is: http://en.wikipedia.org/wiki/Field_norm

 The norm on complex numbers is not consistent with viewing the complex
 numbers as a two-dimensional real vector space, according to the definitions
 mentioned above.

One caveat: the norm of a two-dimensional real vector space is not
canonical. In contrast, the norm of a two-dimensional field extension
is uniquely defined.

In the case of Sage, the norm of complex numbers is defined as the
norm for the field extension C over R.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] norm of a complex number

2010-04-26 Thread Gonzalo Tornaria
On Mon, Apr 26, 2010 at 4:26 PM, John Cremona john.crem...@gmail.com wrote:
 In number theory it is very useful to have this norm-alisation, as
 well as the square root one also called abs.  It's a special case of
 the algebraic concept of norm(a) = product of conjugates of a.

And the determinant of the action of a on C (as an R-vector space of
dimension 2) by complex multiplication.

However, this doesn't seem correct:

sage: sqrt(-3).norm()
-3

(I think the problem is with conjugates)

---

Anyhow, the norm for complex numbers is fine as is, but for the
symbolic ring, it makes me uneasy, e.g.

sage: SR(2).norm()
4
sage: CC(2).norm()
4.00
sage: QQ(2).norm()
2
sage: ZZ(2).norm()
...
AttributeError: 'sage.rings.integer.Integer' object has no attribute 'norm'
sage: RR(2).norm()
...
AttributeError: 'sage.rings.real_mpfr.RealNumber' object has no attribute 'norm'


Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Translation of coercion

2010-04-25 Thread Gonzalo Tornaria
On Fri, Apr 23, 2010 at 11:07 PM, Nathan O'Treally not.rea...@online.de wrote:
 [...] A coercion from one parent to another must be defined on the
 whole domain, and always succeeds. As it may be invoked implicitly, it
 should be obvious and natural (in both the mathematically rigorous and
 colloquial sense of the word). [...]
 There are situations where I would relax that and raise an exception
 e.g. if a specific value can't be implicitly converted because it has
 no representation in the target domain.
 For conversions in Sage it is said that success might depend on the
 actual values (as opposed to their types).

I think one of the cases, we argued about it a lot (SD4 and later), is
whether the canonical partial map QQ -- GF(p) should be an
(automatic) coercion or not. This is for the defined on the whole
domain part.

Also, the == doesn't fail part seems to force this, since it would
be even more awkward to hide the coercion failure.

I'd rather have

sage: 1/3 == GF(3)(1)

raise a ZeroDivisionError, and

sage: 1/4 == GF(3)(1)
True
sage: 1/5 == GF(3)(1)
False

but others didn't agree with me.

You may have a point with the exact domain -- inexact domain
coercions being partial. I think the reasoning is that as long as you
only coerce from the exact domain into the inexact domain, there
shouldn't be problems. Also, inexact domains are NOT rings, so you
don't require the coercions to be ring homomorphisms.

With respect to NaN, it seems to me sage gets it wrong...

sage: 0.0/0.0 == 0.0/0.0
True


Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] Re: Sage relocation (bug?)

2010-04-25 Thread Gonzalo Tornaria
On Sun, Apr 25, 2010 at 2:07 PM, Gonzalo Tornaria
torna...@math.utexas.edu wrote:
 I'm having an issue with sage relocation, and wonder if this is known or not.
 [...]
 Moreover, if I move the directory /scratch/tornaria/sage-4.3.3 away,
 and restart sage, it works perfectly, and sqlite and freetype are
 loaded from my home.

With risk of being a little obnoxious, I did the following experiment:

In addition to moving the directory from the scratch build of sage, I
also moved away the libsqlite* files in my home install of sage, since
I have libsqlite3-0 3.5.9-6 installed (from debian lenny, i.e.
stable). Now sage runs without a hitch mapping the system libraries:

$ cat /proc/3283/maps  | grep libsqlite
7f95db986000-7f95db9fa000 r-xp  fe:01 918139
  /usr/lib/libsqlite3.so.0.8.6
7f95db9fa000-7f95dbbfa000 ---p 00074000 fe:01 918139
  /usr/lib/libsqlite3.so.0.8.6
7f95dbbfa000-7f95dbbfc000 rw-p 00074000 fe:01 918139
  /usr/lib/libsqlite3.so.0.8.6

The same works for libfreetype (also with the version from debian stable).

---

Update: using the system wide sqlite, all tests pass except one test
in devel/sage/sage/graphs/graph_database.py, and the difference looks
like one of ordering (i.e. seems a query for a list of graphs returns
in a different order for the system wide sqlite).

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Translation of coercion

2010-04-25 Thread Gonzalo Tornaria
On Sun, Apr 25, 2010 at 1:26 PM, Nathan O'Treally not.rea...@online.de wrote:
 On 25 Apr., 17:11, Gonzalo Tornaria torna...@math.utexas.edu wrote:
 I'd rather have

     sage: 1/3 == GF(3)(1)

 raise a ZeroDivisionError, and

 I'd prefer TypeError (or coercion error, incompatible types, not yet
 existent I guess)

I think you may be missing my point. I'm not arguing about
incompatible types raising an error instead of returning false. I'm
arguing that there should (IMO) be a canonical coercion

QQ --- GF(3)

defined in the natural way:

   a / b  |--- GF(3)(a / b)

and since GF(3)(1 / 3)  raises a ZeroDivisionError, it makes more sense IMO.

     sage: 1/4 == GF(3)(1)
     True
     sage: 1/5 == GF(3)(1)
     False

 but others didn't agree with me.

 I think I won't either. ;-)

Well, indeed 1/4 == 1 and 1/5 != 1 in  GF(3). In fact, I don't think
anybody disagrees with that, and

sage: GF(3)(1/4) == GF(3)(1)
True
sage: GF(3)(1/5) == GF(3)(1)
False

actually works. The point in question is whether this explicit
conversion from QQ to GF(3) as above should also be an implicit
coercion.

 You may have a point with the exact domain -- inexact domain
 coercions being partial. I think the reasoning is that as long as you
 only coerce from the exact domain into the inexact domain, there
 shouldn't be problems.

 Why? Or did you mean coercing from the *in*exact domain to the exact
 one?

I mean the reasoning in the coercion model of sage is: when you
operate between an exact domain and an inexact domain, it only makes
sense to work in the inexact domain.

Coercing from an inexact domain to an exact domain makes nosense at
all, don't you think?.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Sage relocation (bug?)

2010-04-25 Thread Gonzalo Tornaria
On Sun, Apr 25, 2010 at 2:59 PM, Nathan O'Treally not.rea...@online.de wrote:
 On 25 Apr., 19:07, Gonzalo Tornaria torna...@math.utexas.edu wrote:
 This is actually a security issue, too. (Imagine e.g. a Sage bdist was
 compiled in /tmp: Everybody could place arbitrary code in a fake
 library there. Or he could even look into the Sage binary and find
 appropriate directories to create and put malware libs into.)

Yikes! You are right... :-(

 I hope that somebody has a better idea of how to fix this bug.

 At least chmod og-r on all binaries, too (on a multiuser/open system).

I don't see how that fixes anything (that isn't fixed by just moving
away the build directory or building in a random location).

 Did you open a ticket for that?

No, I didn't. I hoped to get some comments before.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: How to doc-test tab completion, revisited

2010-04-04 Thread Gonzalo Tornaria
On Fri, Apr 2, 2010 at 12:31 PM, Simon King simon.k...@nuigalway.ie wrote:
 Hi John!

 On 2 Apr., 17:10, John Cremona john.crem...@gmail.com wrote:
 On your local machine running linux (which is the only thing I know
 about) I type

 ssh selmer -L 8123:localhost:8000

 and I get the usual prompt on selmer *and* now in my browser I can go
 tohttps://localhost:8123  and get selmer's Sage login page, since
 ssh magically transforms port 8123 on localhost to port 8000 on
 selmer.

 Cool!
 Two problems though:
 - My netbook got Windows.
 - When I want to ssh to the computer in my office, the university
 forces me to use a Cisco AnyConnect VPN client on my netbook. The
 interesting thing is that I am unable to open *any* webpage located at
 my university while the VPN client is running.

If you can ssh into your office computer in some way, you should be
able to tunnel connections through it.
For instance, using putty on windows:
http://www.cs.uu.nl/technical/services/ssh/putty/puttyfw.html

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

To unsubscribe, reply using remove me as the subject.


Re: [sage-devel] Does sage.math have stack protection?

2010-03-29 Thread Gonzalo Tornaria
On Mon, Mar 29, 2010 at 11:04 AM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 When I try the same program on sage.math, it dumps core there too. So I
 don't know if sage.math has protection of the stack enabled. If it does,
 then it is strange that SELinux has problems, whereas sage.math does not.

The stack is not executable by default (on NX hardware, I assume).

You can make your program work by adding something like this:

   mprotect((void*)((long)a  ~0xfff), 0x1000,
PROT_READ|PROT_WRITE|PROT_EXEC);

before the call to fnptr(), which will make the page where a lives executable.

I don't think SELinux is installed on sage.math.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

To unsubscribe from this group, send email to 
sage-devel+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: [sage-devel] Does sage.math have stack protection?

2010-03-29 Thread Gonzalo Tornaria
On Mon, Mar 29, 2010 at 5:41 PM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 I'm just puzzled why SELinux is indicating problems with code trying to
 execute the stack, whereas there are no such complaints on sage.math,
 despite the fact attempting to execute the stacks dumps core on sage.math.

No, it doesn't if you do it properly. Did you try (at least read) what I wrote?

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

To unsubscribe from this group, send email to 
sage-devel+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: [sage-devel] Re: Bug: Elliptic Curve Point Counting

2010-03-29 Thread Gonzalo Tornaria
On Sun, Mar 28, 2010 at 3:13 AM, William Stein wst...@gmail.com wrote:
 We should definitely move to PARI 2.4.  We haven't only because it is
 indeed a monumental task.  Perhaps I'll do the move, since I wrote
 most of the Sage wrapper of PARI anyways, and surely porting is much
 less work than writing the whole wrapper in the first place.      If
 anybody wants to help, please volunteer.  For starters:

I'm willing to help, but not lead, on this effort.

  * What is the relevant trac ticket?

  * Whoever tried last (Nick?), can they summarize some of the issues
 they encountered.

Yes, please do. What's so significative about the API changes in pari 2.4?

 It could be worth moving straight to the pari 2.4 series for Sage-5.0.

+1

If api changes are indeed relevant, syncing the changes with a 5.0
release of sage seems very sensible.

Note that the latest released version of pari is 2.4.2.alpha, dated
dec/2007... is this what we should aim for, or the svn HEAD?

 In case there is confusion, I had some long chats about Pari 2.4
 versus 2.3 with Karim Belebas (lead Pari dev) last time I was in
 Bordeaux.  The Pari 2.4 series is the one anybody should use if they
 can use it.  It's meant to be solid for normal research applications.
 The reason it is called unstable is because the C API is not stable,
 i.e., the PARI devs reserve the right to change the C API from version
 to version.

If the C API is not stable, changes they do may bite the Sage
interface at some point?

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

To unsubscribe from this group, send email to 
sage-devel+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: [sage-devel] Does sage.math have stack protection?

2010-03-29 Thread Gonzalo Tornaria
On Mon, Mar 29, 2010 at 8:16 PM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 I don't know how practical it is going to be for a Sage developer to change
 the the source code of PARI, NTL and whatever else has this problem, to add
 mprotect() where needed. I suspect that might be a bit difficult, and
 perhaps slow the code.

uh?

 The reason I used that code was to check if executing the stack caused a
 problem. As such, there was little point in me adding mprotect - it rather
 defeated the object of the program.

I presume that the software which wants to execute code in the stack
makes the call the mprotect as needed.

The proper code (with the call to mprotect) shows that executing the
stack doesn't cause a problem, if you follow the posix standard [
stack is not executable by default (only this wasn't enforced before
cpus had NX support). ] YMMV, but you didn't post any evidence on the
contrary.

Did you try the fixed code (i.e. with call to mprotect) both in a
non-SELinux and a SELinux enabled kernel to see if there actually is a
difference? Running the code under strace(1) may help know what is
going on. I'd guess that SELinux will return EACCESS in the mprotect
call...

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

To unsubscribe from this group, send email to 
sage-devel+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: [sage-devel] Re: Category for IntegerModRing(n)

2010-03-21 Thread Gonzalo Tornaria
On Sat, Mar 20, 2010 at 11:52 AM, Rob Beezer goo...@beezer.cotse.net wrote:
 (2) IntegerModRing(n) is always in CommutativeRings()

IMO this is the one that makes sense, by the same reasons why:

sage: parent(2/1)
Rational Field

IOW, IntegerModRing should be a map from ZZ to CommutativeRings()

This is the only natural definition, as the only possible generic
property you know about IntegerModRing(n) is that it is commutative.

This seems to lead to IntegerModRing(0) returning a ZZ in category
CommutativeRings(). I don't know if that's right or even possible.

You would have the same issue for R.quotient(I) where R is a ring and
I is an R-ideal... You wouldn't want having to check properties of I
and make inconsistent definitions for different R, etc.


 (3) Same thing, unless the user specifies the category:

     IntegerModRing(5, Fields())

     Although in that case, he might as well call GF(5).

I think it's ok to add a category=other argument, again for
consistency with the case:

R.quotient(I, category=blah)

where you may not have an alternate notation as the GF(p) one.



 (4) IntegerModRing(n) always do a primality test, unless the user
     specifies himself the category.

No way as already explained by others in this thread.

 (5) When n is not too big, IntegerModRing(n) checks the primality of
     n, and sets the category accordingly. Otherwise it always uses
     CommutativeRings().

 (6) When n is not too big, IntegerModRing(n) checks the primality of
     n, and returns GF(n) or a plain IntegerModRing(n) accordingly.

Making things depend on when n is not too big is as far away as I
can possibly imagine from a categorical approach :-)

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

To unsubscribe from this group, send email to 
sage-devel+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: syntax support for _sig_on / _sig_off in cython (Re: [sage-devel] Re: Memory leak)

2010-03-15 Thread Gonzalo Tornaria
On Mon, Mar 15, 2010 at 3:57 PM, Brian Granger ellisonbg@gmail.com wrote:
 Thanks for describing this better, it helps me to understand what the
 current _sig_on/_sig_off does.  Because of the licensing issues, I am
 not looking at the code in Sage until it has been officially re-licensed.
  Once that has been done, I will dig into the code to see what it actually
 does.

Wow, you are serious about licensing. I don't think it would be a
problem for you t look at it --- everybody agreed to relicense
anyway...

 PPS: this seems to be very ingrained with the sage inners for
 library interfaces, and it's already in there, so it's hard to make a
 list of reasons we want to use (e.g. issues we would have otherwise,
 features we want it to support, etc). Since you are coming from a
 different camp, maybe you can try to list your reasons -- what
 problems do you think this would fix for you, and what enhancements
 would this bring up. [ok, I know some reasons for sage, but I'm not
 listing any to avoid biasing you... ]


 I am not sure I am following what you are asking.  Can you elaborate on this
 question?

Sorry. I'll rephrase:

What are your reasons for needing this _sig_on/_sig_off stuff. What
problems do you have that you think this would fix for you, and what
enhancements you think this would this bring up.

It will be helpful to have the perspective of somebody outside of sage.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: syntax support for _sig_on / _sig_off in cython (Re: [sage-devel] Re: Memory leak)

2010-03-14 Thread Gonzalo Tornaria
On Sat, Mar 13, 2010 at 7:22 PM, Robert Bradshaw
rober...@math.washington.edu wrote:
 On Mar 13, 2010, at 4:04 PM, Gonzalo Tornaria wrote:
 What are the options for supporting this (either the
 decorator/function attribute or the with-clause)?

 We can support both. We could support custom signal handlers via something
 like

 @cython.setup_signal_handler(some_func_ptr, other_data, ...)
 def blah(...):
   ...

Great. How does that actually work? Is the decorator somehow modifying
the code of blah at compile time, or is a python wrapper produced?
Minimal overhead would be if the only difference in the C code is that
calls to _sig_on/_sig_off are added in the entry/exit code, etc.


 for ultimate flexibility. It would also help if they were documented
 explained better--my understanding of _sig_on and _sig_off is very shallow:
 one needs them to be able to interrupt C code, they need to come in pairs,
 and doing Python stuff while holding the signal is dangerous (though I
 think we do it all the time). On that last note, we can actually enforce
 pure C inside a sig_on/sig_off block.

I'm going to try to write a summary documentation of what's the issue,
why we want this, and how it works in original /current / proposed
implementation. Keep tuned (it could take me a while, but I don't want
to hold this message).

 There's also the question of naming--sig_on probably isn't the clearest
 name.

Definitely. Maybe something like with trap_signals, since that's
more in line with the desired effect: we want certain signals which
may be raised during execution of c code to be trapped and raised as
exceptions to python.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: syntax support for _sig_on / _sig_off in cython (Re: [sage-devel] Re: Memory leak)

2010-03-14 Thread Gonzalo Tornaria
On Sun, Mar 14, 2010 at 9:21 PM, Brian Granger ellisonbg@gmail.com wrote:
 Gonzalo,
 Thanks for starting this discussion.  I am willing to help with this effort
 as I definitely need this capability.  Part of the challenge will be
 figuring out how to do this on Windows.

Not necessarily. I think signals(2) is part of C89, and setjmp(3) /
longjmp(3) are as well, so they should work on windows (although it's
probably good for trapping ctrl-c and fp exceptions and not much more
-- but what else do you need?). Note that sigsetjmp(3) / siglongmp(3)
don't seem to be part of ansi c, though... I'm not sure atm why we use
that --- possibly only makes sense on unix and those can be changed to
the no-sig counterparts on windows)

 In terms of syntax, I am not sure that the decorator approach would work.
  The reason the that you probably don't want to enable this for entire
 functions.  Because it is such an invasive things, you want it on as little
 as possible.  Thus, I almost think the with syntax would work better:
 with c_signals:
     

I wouldn't call this invasive. Rather, it's expensive to set up
(because of the setjmp). Thus, if a codepath uses this, it's better if
it get's called only once, rather than having several (unnested) pairs
during the execution. In fact, the key about supporting nesting is
that we only setjmp at the outer level. So, for instance, if you have
a function f which loops over a function g, and you know g traps the
signals, then you may be better off (performancewise) to trap signals
in f itself, so g doesn't have to repeatedly call setjmp.

IOW, the hard part of trapping the signals is not trapping them, but
recovering. Python recovers using the exception handling mechanism,
but for C code that won't work, which is the reason python can't do
anything with the signals when it's running c code.

To recover, you need to call setjmp() beforehand, at a place where you
know how to recover so you can use longjmp() to actually recover to a
sane state. [setjmp saves the stack context, so longjmp restores, this
is effectively the same as unwinding the stack, except you don't need
support from the intermediate functions as you do in python or c++
exceptions]

 Thoughts?
 Cheers,
 Brian

Best,
Gonzalo

PS: I'll still try to look at the code and write something more
detailed about it. I feel that would help to decide on what's the sane
syntax/name, since there is a bit of confusion on what _sig_on /
_sig_off actually do.

PPS: this seems to be very ingrained with the sage inners for
library interfaces, and it's already in there, so it's hard to make a
list of reasons we want to use (e.g. issues we would have otherwise,
features we want it to support, etc). Since you are coming from a
different camp, maybe you can try to list your reasons -- what
problems do you think this would fix for you, and what enhancements
would this bring up. [ok, I know some reasons for sage, but I'm not
listing any to avoid biasing you... ]

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] testing on t2

2010-03-13 Thread Gonzalo Tornaria
On Fri, Mar 12, 2010 at 10:03 PM, Minh Nguyen nguyenmi...@gmail.com wrote:
 ...
 if [ $UNAME = Darwin ]; then
    OPT=Rp
 else
    OPT=ra
 fi

 I'm referring to the option a, which is passed to cp later on in
 that script. With sage-bdist as is, I can't wrap up my build. But if I
 remove the option a, then there is some progress. A better approach
 is to systematically go through the script sage-bdist and purge it of
 GNUism. That way, the script would happily run on t2.math, and indeed
 on Cygwin, Linux, Mac OS X, Solaris.

This has already been discussed. Please check out

http://groups.google.com/group/sage-devel/browse_thread/thread/9a45c5417e3d57a0/fd1c6c873df2d6d1?#fd1c6c873df2d6d1

before changing cp -a to something else.

Long story short: using cp -Rp wouldn't preserve symlinks, leading
to bloat on the bdist. You would need to use cp -PRp which is the
closest to cp -a posix allows.

There's also the issue of hard links which are handled by -a but not
by the posix counterpart... according to the post I referred to above,
there was exactly one hardlink in the sage bdist, namely the python
binary (hard linked to python2.6 in the local/bin directory) which
should be replaced by a symlink anyway.

In the thread referred above I posted a few suggestions of how to fix
these issues -- the python hard link issue, how to test the diferent
behaviours of cp in different systems, etc.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


syntax support for _sig_on / _sig_off in cython (Re: [sage-devel] Re: Memory leak)

2010-03-13 Thread Gonzalo Tornaria
On Sat, Mar 13, 2010 at 2:30 PM, Robert Bradshaw
rober...@math.washington.edu wrote:
 On Mar 13, 2010, at 5:29 AM, Nicolas M. Thiery wrote:

  def bla(...):
      with sig_on:
        if ...
           raise ...
        elif ...
           return
        ...

This is exactly the required semantics. I didn't know cython supported
with-guards. Are they lightweight enough? We really only want to add a
call to _sig_on macro at start and a call to _sig_off macro at end,
and no other bloat. the whole process should have very tiny overhead,
except for the first call to _sig_on (when signal trapping is enabled:
there must be a call to sigsetjmp(3) which is somehow costly). While
nesting is not supported atm, it should, and nested calls to _sig_on
should be almost overhead free as well.

 Yes, for sure--I've been thinking about borrowing the with syntax as well.
 Perhaps there could also be syntax/a decorator for marking an entire
 function as getting and releasing the signal handler too (just as we have
 with the GIL). As part of incorporating this into Cython, some syntactic
 improvements should be considered. Any other ideas?

What's the syntax for supporting the GIL? Something like that could
work, I guess.

Something along this lines:

@with_sig_on
def bla(...):
if ...
raise ...
elif ...
return
    ...

Would be great (or whatever other syntax, like an attribute for the
function, etc). The key point being that one can add or remove the
with_sig_on without touching the function body. In the with
syntax, the whole body needs to be reindented. Moreover, when there's
a docstring, the with clause goes after the docstring, while the
decorator syntax clearly displays at the top the fact that the
function catches signals.

The with clause is more flexible, though -- sometimes one wants to
compute quickly (no signal catching) for small arguments (say you know
the computation will be pretty fast) but catch the signals in other
cases all in the same body.

What are the options for supporting this (either the
decorator/function attribute or the with-clause)?

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Memory leak

2010-03-10 Thread Gonzalo Tornaria
On Fri, Mar 5, 2010 at 7:47 AM, Simon King simon.k...@nuigalway.ie wrote:
 I created a ticket at
  http://trac.sagemath.org/sage_trac/ticket/8444

Thanks Simon. I posted a patch with an explanation into that ticket,
which is now awaiting review (it's one line patch).

I was looking around gen.pyx, and there seems to be some more
unbalanced _sig_on / _sig_off pairs, and some dubious ones. But I
don't want to mess too much with that --- the proper fix would be to
rewrite _sig_on / _sig_off to allow nesting while checking the balance
at runtime. The hard part of this plan is that if we enforce balancing
these, we would need a huge amount of effort to actually fix sage in
places where there's no balance

We tried this with Craig back in SD5 days, and there were *a lot* of
unbalances --- though I think Craig committed fixes for some my 4.3.3
sage fails pretty badly at start if I add minimal checks like the ones
commented out in interrupt.h, even if I do it *only* for gen.pyx...

Maybe some general framework for this, more robust, can be made
directly into cython (cf. Brian Granger's efforts in another thread)
and sage usage of this can slowly migrate to the cython methods.

By robust I mean
 - reentrancy
 - proper nesting
 - threads
 - runtime balance check (warn/abort in case of unbalance)

What may actually be nice is to have some kind of support in cython to
declare we want signals enabled for a whole function (something like a
decorator or attribute). Cython would then add the calls to every
entry and exit point, so we avoid the common pitfall of missing some
exit code-paths.

Best,
Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Memory leak

2010-03-05 Thread Gonzalo Tornaria
On Fri, Mar 5, 2010 at 10:47 AM, Simon King simon.k...@nuigalway.ie wrote
 Hi!

 I created a ticket at
  http://trac.sagemath.org/sage_trac/ticket/8444

I think this is caused by a duplicate _sig_on in the bottom part of
pari.__call__.

I'll post details and (possible) solution later (feel free to ping me
in a few days if I forget).

Best,
Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] non-ASCII characters in the Sage library

2010-01-21 Thread Gonzalo Tornaria
On Thu, Jan 21, 2010 at 3:22 AM, Pat LeSmithe qed...@gmail.com wrote:
 Should we put

 # -*- coding: utf-8 -*-

 at the top of all .py and .pyx(?) files in the Sage library?

 I think this will allow us to use Unicode literal strings in Sage code,
 doctests, documentation --- without raising coding errors.

I had to patch sagenb b/c doctests don't display in the notebook when
they have utf-8 (this was rc0,

However, I just discovered that the sagenb (in
local/lib/python2.6/site-packages/sagenb-0.5-py2.6.egg/sagenb) is not
under hg, so I will need to dig what I actually changed...

The relevant ticket is http://trac.sagemath.org/sage_trac/ticket/6682

I'll post more about this later.

BTW a few questions:

a. is it necessary to put the utf-8 stanza on all files, or only on
those which include non-ascii characters?

b. the way the line is written, I think it will be recognized by
emacs, but not by vim. Do we care about that?

c. is there a way to do a sanity check to the source to make sure we
don't get incorrect encodings?

d. should doctests with non-ascii characters be created as unicode
strings, or as regular strings with utf-8 encoding?

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: sage-4.3.1.rc0 released!

2010-01-21 Thread Gonzalo Tornaria
On Wed, Jan 20, 2010 at 5:47 PM, Peter Jeremy peterjer...@acm.org wrote:
 My personal feeling is that it would be nice if some of the more generic
 packages (eg bzip, zlib, readline, mercurial) were moved out of sage
 and made explicit requirements.

+1

I think Sage is mature enough now to slowly migrate toward this.
Besides, there can still be spkgs for those packages, and there could
be a sage-with-batteries-included tarball with dependencies included.

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: non-ASCII characters in the Sage library

2010-01-21 Thread Gonzalo Tornaria
On Thu, Jan 21, 2010 at 12:16 PM, kcrisman kcris...@gmail.com wrote:
 Not everyone can easily use a text editor which recognizes all non-
 ASCII character properly, so I think we should be careful about
 this.

I don't think that's true anymore. It may have been true ten years
ago, but nowadays unicode and utf-8 is pretty much standard.

For the sage source code itself, it probably amounts only to be able
to spell most names correctly. But it will help fully supporting
unicode, which is necessary for translations, and even for the english
version students want to write comments and text in their own
language, so the support is quite important.

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] non-ASCII characters in the Sage library

2010-01-21 Thread Gonzalo Tornaria
On Fri, Jan 22, 2010 at 12:46 AM, Minh Nguyen nguyenmi...@gmail.com wrote:
 With or without the above Unicode preamble, a non-ASCII character in a
 docstring can cause the PDF version of a document to fail to build.
 See ticket #8036 [1] for an example of a case where a source file
 contains the above preamble, but the PDF version of the reference
 manual fails to build due to non-ASCII characters in the docstring of
 a method.

That needs to be fixed in the latex preamble, i.e. let latex know the
file is encoded with utf8.

See my comments in the ticket (and attached latex example file)

 [1] http://trac.sagemath.org/sage_trac/ticket/8036

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: sage-4.3.1.rc0 released!

2010-01-21 Thread Gonzalo Tornaria
On Thu, Jan 21, 2010 at 6:05 PM, Robert Bradshaw
rober...@math.washington.edu wrote:
 On Jan 21, 2010, at 6:31 AM, Gonzalo Tornaria wrote:

 On Wed, Jan 20, 2010 at 5:47 PM, Peter Jeremy peterjer...@acm.org wrote:

 My personal feeling is that it would be nice if some of the more generic
 packages (eg bzip, zlib, readline, mercurial) were moved out of sage
 and made explicit requirements.

 +1

 I think Sage is mature enough now to slowly migrate toward this.
 Besides, there can still be spkgs for those packages, and there could
 be a sage-with-batteries-included tarball with dependencies included.

 What would be the advantage? The easier it is for users to go from a
 standard distro/OS X box to a running Sage the better. Also, there's the
 much more important Windows port to consider.

In the long run, I think it's way easier if sage actually *comes* with
the standard distro / fink / etc.

If it could be done with gfortran, it can be done with other
dependencies. We didn't see mountains crumbling because of that (I was
annoyed as others, but only because the prereq didn't warn me, and
because the change was made in the last 24 hours before release).

 One of the reasons we ship our own of so much stuff is that we require
 specific versions (e.g. you can't just drop in a new version of pari,
 maxima, or gap, and have it Just Work). Is that an issue for any of the
 above packages? Also, we require the dev versions of the above packages, not
 just binaries (which is what many systems come with).

Agreed. The OP didn't suggest to drop those out of sage. I didn't
either (not at this stage, anyway). But some of the more generic
packages could **slowly** migrate toward this. I don't think there
are very specific version needs for bzip, zlib, readline, mercurial,
etc. (possibly a newer-than version check, and readline may be icky,
etc).

If sage could just work with my own distro dev libraries for some of
those, that would be a huge step forward, IMO. Once it's doable with a
few, the rest will follow at its own pace.

Plus, there can *still* be spkgs for all the dependencies. And there
could be a sage-with-batteries-included tarball which works just as
it does now. And another
sage-reduced-for-expert-developers-and-distros tarball which doesn't
include the spkgs which can be replaced by distro packages. Even the
prereq script could actually *check* the dependencies, and (offer to)
download the required spkg !!! (then the tarballs could be named
sage-full-install vs. sage-net-install.)

IMO sage is mature enough now.

Best, Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: sage-4.3.1.rc0 released!

2010-01-21 Thread Gonzalo Tornaria
On Thu, Jan 21, 2010 at 7:11 PM, William Stein wst...@gmail.com wrote:
 +1 to Robert's comments.  I can't tell you how many people just in the
 last few days have told me that they use (and work on!) Sage *only*
 because when they try to build it on their computer it just worked.

Do people tell you when they just skip sage because of the massive
download and prospect of compiling it? Download 600Mb binary? That's
20% of the monthly allowance for some common adsl plans around here
(and I think we have one of the higher levels of internet penetration
in latin-america, if not the highest). Getting mathematica is almost
cheaper here.

Note that I *love* the fact that most of the time I can type make
and it just works. Thumbs up for that!!!

 If it hadn't, they definitely wouldn't be involved with Sage now.
 Removing bzip, zlib, readline, mercurial, etc. is simply going to
 greatly reduce the chances for such people.

 I see my goal with the Sage project as *not* to compete with Pari or
 Singular or Macaulay2 or to try to get users that would otherwise use
 those systems.   My goal is that Sage can compete with programs such
 as Mathematica which are self-contained and easy to install on many
 platforms.   I want to make Sage something that appeals to users who
 do not currently use systems like Pari, Singular, etc., because they
 find installation and usability of those systems too icky.  I think

apt-get install pari-gp is the trivialest thing... I haven't
compiled pari for eons. Especially because when software matures, it
won't affect me as much to not have the bleeding edge release.

And hey, compiling pari *also* just worked most of the time.

It's not only about being easy to build --- it's also about convincing
people it's easy to build, despite the scary looking size of the
tarball, and moreover covincing people it's easy to develop, and worth
giving code back to the commons!!! Another two thumbs up for that (and
metcalfe's law).

 http://sagenb.org (and the notebook in general) is a little first step

More like a big leap, IMO.

 in that direction, but there are many other steps.  Make building Sage
 from source more difficult isn't a good step though.

You are jumping to conclusions. Nobody wants to make building sage
from source more difficult. Move back two spaces and read again. It
was really meant to be constructive.

Best,
Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: sage-4.3.1.rc0 released!

2010-01-21 Thread Gonzalo Tornaria
On Fri, Jan 22, 2010 at 3:24 AM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 But sorting out whether the version of libraries on a system are suitable,
 can be tricky. Even having the right versions does not guarantee they will
 be found in preference to some other version.

Sure. We already have related issues. For example, the prereq checks
perl is installed, but it doesn't check for some perl modules which
are required (but not part of debian's perl-base --- not really needed
for anything except building sage).

As long as it builds with libraries in current debian / fedora /
ubuntu, it's ok.

 If you are only going to shave off 20 MB or so from the source code, it
 might be more hassle than it is worth. If you could cut the download time by
 30%, then I could see it would probably be worth the effort in doing this.
 But I'm not so sure you would be able to do that. Too many packages are
 probably too specialised.

sage 3.0.5 was 188MB, but the debian package (binary) was only 42MB.
The source for the debian package is 57.6MB.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: Sage-4.3.1.rc1 released!

2010-01-19 Thread Gonzalo Tornaria
On Tue, Jan 19, 2010 at 7:48 AM, Dag Sverre Seljebotn
da...@student.matnat.uio.no wrote:
 Dima Pasechnik wrote:

 is it possible to make patches, instead/as well as posting full source
 releases?
 It took 4+ hours here to download rc0...


 One thing one could try out is to play with rsync over SSH to an account on
 boxen.math. rsync the rc1 file with a local copy of the rc0 tarball, and
 have rsync deal with computing deltas etc.

 If that works out well (I'm not sure how much compressed data would change)
 then it's probably a method with lower maintenance overhead than making
 patches.

No, that doesn't help.

What does help, to a certain extent is the following:

boxen$ tar xvf sage-4.3.1.rc1.tar
local$ tar xvf sage-4.3.1.rc0.tar
local$ mv sage-4.3.1.rc0 sage-4.3.1.rc1
local$ rsync -avP boxen:sage-4.3.1.rc1 .
[ ... I had about 97M transfer here IIRC ]
local$ tar cvf sage-4.3.1.rc1.tar sage-4.3.1
local$ rsync -avP boxen:sage-4.3.1.rc1.tar .
[ ... about 1M transfer IIRC ]
local$ md5sum sage-4.3.1.rc1.tar
32f20dbab7aeec8529085ec41bf61552  sage-4.3.1.rc1.tar

This is still way non-optimal, but a big savings anyway (100M transfer
vs. 267M normal download).

The reason it takes so long is because the .spkg files are bzipped --
rsync is baffled about them, so a tiny change in one spkg file ends up
transfering the whole spkg.

It would be *really* an advantage to recursively do the same with the
spkg files themselves, but you better use the same options for bzip!!
(maybe rsync the tree, then tar, then rsync the tar, then bzip, then
rsync the bzip).

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] Weird failure compiling 4.3.1.alpha3

2010-01-15 Thread Gonzalo Tornaria
Just after successfully built dsage -- which I believe is the last
spkg which gets installed. The sphinx build fails quite strangely.

Running ./sage fails with the same error (TypeError: unsupported
operand parent(s) for '+': 'Integer Ring' and 'Integer Ring')

Gonzalo


Finished installing dsage-1.0.1.p1.spkg
cd /scratch/tornaria/sage-4.3.1.alpha3  . local/bin/sage-env  cd
local/bin/  ./sage-make_relative
Making script relocatable
make[1]: Leaving directory `/scratch/tornaria/sage-4.3.1.alpha3/spkg'

real91m6.194s
user82m59.055s
sys 7m59.726s
sphinx-build -b html -d
/scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/output/doctrees/en/developer
   /scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/en/developer
/scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/output/html/en/developer
Traceback (most recent call last):
  File /scratch/tornaria/sage-4.3.1.alpha3/local/bin/sphinx-build,
line 6, in module
import sage.all
  File 
/scratch/tornaria/sage-4.3.1.alpha3/local/lib/python2.6/site-packages/sage/all.py,
line 72, in module
from sage.rings.all  import *
  File 
/scratch/tornaria/sage-4.3.1.alpha3/local/lib/python2.6/site-packages/sage/rings/all.py,
line 75, in module
from padics.all import *
  File 
/scratch/tornaria/sage-4.3.1.alpha3/local/lib/python2.6/site-packages/sage/rings/padics/all.py,
line 2, in module
from factory import Zp, Zq, Zp as pAdicRing, ZpCR, ZpCA, ZpFM,
ZqCR, ZqCA, ZqFM #, ZpL, ZqL
  File 
/scratch/tornaria/sage-4.3.1.alpha3/local/lib/python2.6/site-packages/sage/rings/padics/factory.py,
line 27, in module
from padic_extension_leaves import *
  File 
/scratch/tornaria/sage-4.3.1.alpha3/local/lib/python2.6/site-packages/sage/rings/padics/padic_extension_leaves.py,
line 34, in module
from padic_ZZ_pX_FM_element import pAdicZZpXFMElement
  File padic_ZZ_pX_FM_element.pyx, line 1, in init
sage.rings.padics.padic_ZZ_pX_FM_element
(sage/rings/padics/padic_ZZ_pX_FM_element.cpp:11328)
  File padic_ZZ_pX_element.pyx, line 34, in init
sage.rings.padics.padic_ZZ_pX_element
(sage/rings/padics/padic_ZZ_pX_element.cpp:8851)
  File element.pyx, line 808, in
sage.structure.element.ModuleElement.__add__
(sage/structure/element.c:7007)
  File element.pyx, line 814, in
sage.structure.element.ModuleElement._add_
(sage/structure/element.c:7097)
TypeError: unsupported operand parent(s) for '+': 'Integer Ring' and
'Integer Ring'
Build finished.  The built documents can be found in
/scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/output/html/en/developer
sphinx-build -b html -d
/scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/output/doctrees/en/tutorial
   /scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/en/tutorial
/scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/output/html/en/tutorial
Traceback (most recent call last):
  File /scratch/tornaria/sage-4.3.1.alpha3/local/bin/sphinx-build,
line 6, in module
import sage.all
  File 
/scratch/tornaria/sage-4.3.1.alpha3/local/lib/python2.6/site-packages/sage/all.py,
line 72, in module
from sage.rings.all  import *
  File 
/scratch/tornaria/sage-4.3.1.alpha3/local/lib/python2.6/site-packages/sage/rings/all.py,
line 75, in module
from padics.all import *
  File 
/scratch/tornaria/sage-4.3.1.alpha3/local/lib/python2.6/site-packages/sage/rings/padics/all.py,
line 2, in module
from factory import Zp, Zq, Zp as pAdicRing, ZpCR, ZpCA, ZpFM,
ZqCR, ZqCA, ZqFM #, ZpL, ZqL
  File 
/scratch/tornaria/sage-4.3.1.alpha3/local/lib/python2.6/site-packages/sage/rings/padics/factory.py,
line 27, in module
from padic_extension_leaves import *
  File 
/scratch/tornaria/sage-4.3.1.alpha3/local/lib/python2.6/site-packages/sage/rings/padics/padic_extension_leaves.py,
line 34, in module
from padic_ZZ_pX_FM_element import pAdicZZpXFMElement
  File padic_ZZ_pX_FM_element.pyx, line 1, in init
sage.rings.padics.padic_ZZ_pX_FM_element
(sage/rings/padics/padic_ZZ_pX_FM_element.cpp:11328)
  File padic_ZZ_pX_element.pyx, line 34, in init
sage.rings.padics.padic_ZZ_pX_element
(sage/rings/padics/padic_ZZ_pX_element.cpp:8851)
  File element.pyx, line 808, in
sage.structure.element.ModuleElement.__add__
(sage/structure/element.c:7007)
  File element.pyx, line 814, in
sage.structure.element.ModuleElement._add_
(sage/structure/element.c:7097)
TypeError: unsupported operand parent(s) for '+': 'Integer Ring' and
'Integer Ring'
Build finished.  The built documents can be found in
/scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/output/html/en/tutorial
sphinx-build -b html -d
/scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/output/doctrees/en/installation
   /scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/en/installation
/scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/output/html/en/installation
Traceback (most recent call last):
  File /scratch/tornaria/sage-4.3.1.alpha3/local/bin/sphinx-build,
line 6, in module
import sage.all
  File 

Re: [sage-devel] Weird failure compiling 4.3.1.alpha3

2010-01-15 Thread Gonzalo Tornaria
On Fri, Jan 15, 2010 at 4:45 PM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 Gonzalo Tornaria wrote:

 sys     7m59.726s
 sphinx-build -b html -d

 /scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/output/doctrees/en/developer
   /scratch/tornaria/sage-4.3.1.alpha3/devel/sage/doc/en/developer

 I thought you had made a mistake, but see your path contains 4.3.1.alpha3.
 Is there a link to that?

http://boxen.math.washington.edu/home/wstein/farm/src/

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: mpir.1.2.2 fails to build on Open Solaris 06/2009 in VirtualBox

2010-01-13 Thread Gonzalo Tornaria
On Wed, Jan 13, 2010 at 9:18 AM, Bill Hart goodwillh...@googlemail.com wrote:
 Ah, I see in a later trac update you have the same problem in Fedora.
 But surely there you have cat /proc/cpuinfo. What information does it
 give you? We might be able to tackle the problem from there.

  This is in VirtualBox, so virtual processors?

Virtualbox is possibly misreporting the cpu type in cpuid. You need to
figure out which family/model it's actually reporting, and see what
can be done from there. The easiest way, as Bill suggests, is to cat
/proc/cpuinfo on a linux kernel running in the virtualbox, but you
could also copypaste some cpuid code and run that (try unpacking mpir
and playing with config.guess and friends).

See related:

http://trac.sagemath.org/sage_trac/ticket/5516
http://trac.sagemath.org/sage_trac/ticket/5186
http://groups.google.com/group/mpir-devel/browse_thread/thread/aeb271247ae0eec9/a90654677f9db1d5

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: mpir.1.2.2 fails to build on Open Solaris 06/2009 in VirtualBox

2010-01-13 Thread Gonzalo Tornaria
On Wed, Jan 13, 2010 at 11:43 AM, Jaap Spies j.sp...@hccnet.nl wrote:
 gcc version 4.4.2 20091222 (Red Hat 4.4.2-20) (GCC)
 
 checking build system type... x86_64-unknown-linux-gnu
 checking host system type... x86_64-unknown-linux-gnu

Still misdetected, it should be nehalem-unknown-linux-gnu for
optimal results if you are running on an i7. But that is probably be a
virtualbox issue.

On the solaris side you get i486-pc-solaris2.11, but you should be
getting at least x86_64-* (as for linux). I think that you must fix
the config.guess in mpir somehow... Check out

http://groups.google.com/group/mpir-devel/browse_thread/thread/aeb271247ae0eec9/a90654677f9db1d5

which is quite related to this: I had the same issue running on a kvm
virtual cpu, and that fixed it at least for linux. The strategy is
that for 64 bit builds on x86 hardware, you always fallback to
x86_64-* even if the family/model reported by cpuid seems to be of an
older 32 bit only cpu.

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: mpir.1.2.2 fails to build on Open Solaris 06/2009 in VirtualBox

2010-01-13 Thread Gonzalo Tornaria
On Wed, Jan 13, 2010 at 12:06 PM, Jaap Spies j.sp...@hccnet.nl wrote:
 Gonzalo Tornaria wrote:

 On Wed, Jan 13, 2010 at 11:43 AM, Jaap Spiesj.sp...@hccnet.nl  wrote:

 gcc version 4.4.2 20091222 (Red Hat 4.4.2-20) (GCC)
 
 checking build system type... x86_64-unknown-linux-gnu
 checking host system type... x86_64-unknown-linux-gnu

 Still misdetected, it should be nehalem-unknown-linux-gnu for
 optimal results if you are running on an i7. But that is probably be a
 virtualbox issue.


 Not quite. In Fedora 12 on the real machine I get:
 gcc version 4.4.2 20091222 (Red Hat 4.4.2-20) (GCC)
 
 checking build system type... x86_64-unknown-linux-gnu
 checking host system type... x86_64-unknown-linux-gnu

Then that needs to be fixed with mpir itself.

Can you copy cpu family, model and flags from /proc/cpuinfo? I'm think
yours is a model 30 nehalem which is currently undetected by mpir.

CC to mpir-devel as this needs to be fixed in cpuid.c

The processor in question is a core i7 860, namely:
http://processorfinder.intel.com/details.aspx?sSpec=SLBJJ#

[ afaict, the main difference of the i7 800 series wrt the i7 900/xeon
5500 series is the former has 2 memory channels vs. the latter 3
memory channels ]

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] What can I test that makes use of parallel processors?

2010-01-13 Thread Gonzalo Tornaria
On Wed, Jan 13, 2010 at 5:52 PM, William Stein wst...@gmail.com wrote:
 What matters for this benchmark is the number of cores that the computer has.
 Though t2 can manage 128 hardware threads, it only has 16 actual *cores*.

Not quite; the following is in a box with 8 cores -- 16 threads:

sage: time b = bernoulli(10^5, algorithm='bernmm', num_threads=1)
CPU times: user 4.84 s, sys: 0.00 s, total: 4.84 s
Wall time: 4.84 s
sage: timeit(bernoulli(10^5, algorithm='bernmm', num_threads=8))
5 loops, best of 3: 1.06 s per loop
sage: timeit(bernoulli(10^5, algorithm='bernmm', num_threads=16))
5 loops, best of 3: 914 ms per loop

That's 15% speedup for the extra threads... Not bad, given that going
4 -- 8 threads on the same machine or going  8 -- 16 threads on
sage.math gives about 30% speedup for the same computation.

I'd guess for a really cpu-bound task, the number of cores should be
it, but for memory-bound tasks, having more threads may be an
advantage because of memory latencies, as long as the threads don't
have to compete for cache. In the end, whatever optimizes the usage of
cache size / memory bandwidth between threads is probably best.

Also, HT could optimize the use of arithmetic units between threads in
the same core, so unless the inner loops have perfect scheduling,
there's always something to gain from this approach.

Best, Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Fwd: Manual en español

2010-01-12 Thread Gonzalo Tornaria
2010/1/12 William Stein wst...@gmail.com:
 Maybe somebody who speaks Spanish can email this person back?


 -- Forwarded message --
 From: Kelvy Segura Cuevas k.seg...@sisalril.gov.do
 Date: 2010/1/12
 Subject: Manual en español
 To: wst...@gmail.com wst...@gmail.com


 Estimado William Stein,



 Donde podría encontrar un manual completo de Sage en español para
 poderlo usar con mayo probecho, soy lic. En matemática pura de
 republica dominicana.

Kelvy,

En http://www.sagemath.org/help.html hay un par de manuales
introductorios en español.

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] bad rendering of / in notebook

2010-01-11 Thread Gonzalo Tornaria
On Mon, Jan 11, 2010 at 10:55 AM, John Cremona john.crem...@gmail.com wrote:
 In the notebook (4.3), in either a text cell between Sage cells or in
 the output of (for example) show(QuadraticField(-1,'i')) I see the the
 symbol / wrongly rendered as =.  So in that example, what I see is



 Q[i]=(i^2+1)

 (with ^2 as a superscript).  That's not good.  I am using firefox
 3.5.5 on Suse linux enterprise.  Where might the problem lie?

Probably a known issue with jsmath fonts and firefox 3.5. Check out

http://www.math.union.edu/~dpvc/jsMath/download/jsMath-fonts.html

(cf http://trac.sagemath.org/sage_trac/ticket/6483)

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Unsetting MAKE - a better way to do it.

2010-01-11 Thread Gonzalo Tornaria
On Mon, Jan 11, 2010 at 5:42 PM, William Stein wst...@gmail.com wrote:
 Cool.  Instead of suggesting people use bits of code like this in
 their spkg-install's, why don't we make a single *sage sh library*
 that gets used.  It could start as a script

    local/bin/sage-spkg-lib

 that gets sourced before spkg-install gets sourced.  It could contain
 at least the following functions:

    * unsetmake  -- based on what you wrote above

    * check_err    -- based on what Gonzalo posted in another thread.

 I think this would be much better than scattering coding snippets in
 spkg-installs, since there is one place where we can fix/change
 everything related to something like this.

Sounds good... Let me suggest

arg1 ()
{
echo $1
}

resetmake ()
{
MAKE=`arg1 $MAKE`
}

This avoids spawning awk altogether... (won't spawn anything if echo
is builtin as in bash)

Alternative (no echo):

setmake1 ()
{
MAKE=$1
}

resetmake ()
{
setmake1 $MAKE
}


Also, it might be a good idea to define:

sage-spkg-lib ()
{
return
}

The idea is to override the loading of the shell library so it's not
loaded more than once.
(not sure if dashes are allowed in function names, so that may not work).

Alternative:

alias sage-spkg-lib=true

(still no spawning if true is builtin)

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] Problems with sage on core i7 (nehalem)

2010-01-11 Thread Gonzalo Tornaria
As posted before, I am getting  (consistent) test failures when
running sage doctests on a core i7. I've been doing some more
experiments and found some more interesting things about this.

I'm using two different boxes:

core2:

Intel(R) Core(TM)2 Quad  CPU   Q9550  @ 2.83GHz
family=6 model=23 stepping=7

nehalem:

Intel(R) Xeon(R) CPU   E5520  @ 2.27GHz
family=6 model=26 stepping=5

For the sake of this experiment I'm using the released sage-4.3
(doctest still fail on sage-4.3.alpha1 as reported before).

A) sage-4.3 compiled on nehalem, ran on nehalem:

-- doctest failures in symbolic/expression.pyx,
numerical/optimize.py, interfaces/r.py (as reported earlier)

B) sage-4.3 compiled on core2, ran on core2:

-- all doctest pass

C) sage-4.3 compiled on core2, ran on nehalem:

-- all doctest pass

D) sage-4.3 compiled on nehalem, ran on core2:

-- many segfaults, the doctesting aborts in the end

-

Some conclusions:

1. the compilation on nehalem has some subtle issue which causes the
doctest failures [actually the failures look all the same and related
to numpy arrays, except the r failures, which may be due to a missing
dependency since the system is a very bare bones debian lenny].

2. whatever the failures are, they are  triggered at compile time,
since the code compiled on core2 works ok on the i7.

3. the sage-flags.txt are identical on both systems, namely ssse3 mmx
sse2 pni sse cmov. However, something seems to be using i7 features,
causing segfaults when running the same binary on a core2. From
/proc/cpuinfo, the flags are:

nehalem: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
rdtscp lm constant_tsc arch_perfmon pebs bts rep_good pni monitor
ds_cpl vmx est tm2 ssse3 cx16 xtpr dca sse4_1 sse4_2 popcnt lahf_lm
ida

core2: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
lm constant_tsc arch_perfmon pebs bts rep_good pni dtes64 monitor
ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 lahf_lm tpr_shadow
vnmi flexpriority

Only suspicious flag I see is sse4_2, since both have sse4_1 (note
that the old 65nm core2 don't have sse4_1 also).

Best, Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] Re: Problems with sage on core i7 (nehalem)

2010-01-11 Thread Gonzalo Tornaria
On Tue, Jan 12, 2010 at 1:29 AM, Gonzalo Tornaria
torna...@math.utexas.edu wrote:
 Only suspicious flag I see is sse4_2, since both have sse4_1 (note
 that the old 65nm core2 don't have sse4_1 also).

At least mpir uses popcnt on nehalem, which is available for sse4_2
only. So, the sse4_2 flag should be added to the sage-flags.txt.

I don't know about sse4_1. The main test case woud be: build sage on a
core2 with sse4_1 (45nm) and test it on a core2 without it (65nm).
Since mpir doesn't test cpu flags, only cpu models, and doesn't
differentiate between those two (although they do have different model
numbers), maybe sse4_1 is not a problem.

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] Re: doctest failures in sage-4.3.1.alpha1

2010-01-11 Thread Gonzalo Tornaria
On Sun, Jan 10, 2010 at 8:02 PM, Gonzalo Tornaria
torna...@math.utexas.edu wrote:
 cpu = 2 x quad core xeon E5520 (nehalem/i7)
 os = debian 5.0/lenny (64 bit)
...
sage -t  devel/sage/sage/symbolic/expression.pyx # 6 doctests failed
        sage -t  devel/sage/sage/numerical/optimize.py # 6 doctests failed

Not funny look below --- this is a diff of one file in scipy,
between the sage built on core2, vs. the sage built on nehalem...

--- 
sage-core2-x86_64-Linux/local/lib/python2.6/site-packages/scipy/optimize/optimize.py
   2010-01-10 21:18:35.0 -0200
+++ 
sage-nehalem-x86_64-Linux/local/lib/python2.6/site-packages/scipy/optimize/optimize.py
  2009-02-11 00:56:10.0 -0200
@@ -41,12 +41,6 @@
 m = asarray(m)
 return numpy.minimum.reduce(m,axis)

-def is_array_scalar(x):
-Test whether `x` is either a scalar or an array scalar.
-
-
-return len(atleast_1d(x) == 1)
-
 abs = absolute
 import __builtin__
 pymin = __builtin__.min
@@ -1183,12 +1177,13 @@

 
 # Test bounds are of correct form
-
-if not (is_array_scalar(x1) and is_array_scalar(x2)):
-raise ValueError(Optimisation bounds must be scalars
-  or array scalars.)
+x1 = atleast_1d(x1)
+x2 = atleast_1d(x2)
+if len(x1) != 1 or len(x2) != 1:
+raise ValueError, Optimisation bounds must be scalars \
+ or length 1 arrays
 if x1  x2:
-raise ValueError(The lower bound exceeds the upper bound.)
+raise ValueError, The lower bound exceeds the upper bound.

 flag = 0
 header = ' Func-count x  f(x)  Procedure'


-


$ diff --exclude *.pyc --exclude *.so -ru
sage-{core2,nehalem}-x86_64-Linux/local/lib/python2.6/site-packages/scipy
| diffstat
 __config__.py |   10 +-
 integrate/setup.py|   26 --
 interpolate/setup.py  |   17 ++---
 odr/setup.py  |   17 -
 optimize/optimize.py  |   17 ++---
 optimize/setup.py |   14 +-
 special/setup.py  |   20 +++-
 stats/mstats_basic.py |2 +-
 stats/setup.py|   15 +--
 9 files changed, 23 insertions(+), 115 deletions(-)


Why are these files patched differently in nehalem ???

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] Re: doctest failures in sage-4.3.1.alpha1

2010-01-11 Thread Gonzalo Tornaria
On Tue, Jan 12, 2010 at 2:24 AM, Gonzalo Tornaria
torna...@math.utexas.edu wrote:
 On Sun, Jan 10, 2010 at 8:02 PM, Gonzalo Tornaria
 torna...@math.utexas.edu wrote:
 cpu = 2 x quad core xeon E5520 (nehalem/i7)
 os = debian 5.0/lenny (64 bit)
 ...
        sage -t  devel/sage/sage/symbolic/expression.pyx # 6 doctests failed
        sage -t  devel/sage/sage/numerical/optimize.py # 6 doctests failed

 Not funny look below --- this is a diff of one file in scipy,
 between the sage built on core2, vs. the sage built on nehalem...

Ugh can we forbid perl in the install scripts?

It turns out this has nothing to do with the cpu, but rather with perl
modules. Check out #7902. A fix is in the works. I'm testing it right
now...

Wrt the failure in r.py, it's the same root cause (missing perl
modules) -- the issue is already open as #5964.

Gonzalo

PS: Can somebody explain why rebuilding just the scipy spkg triggers
rebuilding the whole damn documentation, which takes way longer than
rebuilding scipy (and it's clearly unnecessary). Doesn't this
discourage developers?
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] doctest failures in sage-4.3.1.alpha1

2010-01-10 Thread Gonzalo Tornaria
cpu = 2 x quad core xeon E5520 (nehalem/i7)
os = debian 5.0/lenny (64 bit)

The following tests failed:

sage -t  devel/sage/sage/symbolic/expression.pyx # 6 doctests failed
sage -t  devel/sage/sage/numerical/optimize.py # 6 doctests failed
sage -t  devel/sage/sage/interfaces/r.py # 3 doctests failed
sage -t  devel/sage/sage/misc/sagedoc.py # 1 doctests failed

The first three are exactly the same failures I got with sage 4.3 (see
below). The fourth is new:

sage -t  devel/sage/sage/misc/sagedoc.py
**
File /scratch/tornaria/sage-4.3.1.alpha1/devel/sage-main/sage/misc/sagedoc.py,
line 897:
sage: browse_sage_doc(identity_matrix, 'html', False)[:59]
Expected:
'div class=docstring\n\n  pstrongFile:/strong /v'
Got:
'div class=docstring\n\n  pstrongFile:/strong /s'
**
1 items had failures:
   1 of   5 in __main__.example_17
***Test Failed*** 1 failures.
For whitespace errors, see the file
/home/tornaria/.sage//tmp/.doctest_sagedoc.py
 [12.4 s]





On Mon, Jan 4, 2010 at 2:07 PM, Gonzalo Tornaria
torna...@math.utexas.edu wrote:
 -- Forwarded message --
 From: Gonzalo Tornaria torna...@math.utexas.edu
 Date: Thu, Dec 31, 2009 at 6:10 PM
 Subject: Re: [sage-release] sage-4.3
 To: sage-rele...@googlegroups.com


 I haven't seen these reported:

 $ \time ./sage -tp 16 devel/sage
 ...
 The following tests failed:

        sage -t  devel/sage/sage/symbolic/expression.pyx # 6 doctests failed
        sage -t  devel/sage/sage/numerical/optimize.py # 6 doctests failed
        sage -t  devel/sage/sage/interfaces/r.py # 3 doctests failed
 --
 Total time for all tests: 458.2 seconds

 (detailed  errors below)

 This is a new machine with 2 * quad core xeon (nehalem) and plenty of
 ram, running stable Debian 5.0 (lenny).
 The compiler is gcc 4.3.2 (stable debian version).

 I'm also getting ocasional errors (in random files) which claim:

 
 A mysterious error (perhaps a memory error?) occurred, which may have
 crashed doctest.
 

 Is there any other explanation of this rather than a memory error? (dammit!)


 Details:

 -

 sage -t  devel/sage/sage/symbolic/expression.pyx
 **
 File 
 /scratch/tornaria/sage-4.3/devel/sage-main/sage/symbolic/expression.pyx,
 line 6103:
    sage: f.find_maximum_on_interval(0,5)
 Expected:
    (0.5610963381910451, 0.8603335890...)
 Got:
    (0.5610963381910451, array([ 0.86033359]))
 **
 File 
 /scratch/tornaria/sage-4.3/devel/sage-main/sage/symbolic/expression.pyx,
 line 6105:
    sage: f.find_maximum_on_interval(0,5, tol=0.1, maxfun=10)
 Expected:
    (0.561090323458081..., 0.857926501456...)
 Got:
    (0.56109032345808163, array([ 0.8579265]))
 **
 File 
 /scratch/tornaria/sage-4.3/devel/sage-main/sage/symbolic/expression.pyx,
 line 6142:
    sage: f.find_minimum_on_interval(1, 5)
 Expected:
    (-3.288371395590..., 3.4256184695...)
 Got:
    (-3.2883713955908962, array([ 3.42561847]))
 **
 File 
 /scratch/tornaria/sage-4.3/devel/sage-main/sage/symbolic/expression.pyx,
 line 6144:
    sage: f.find_minimum_on_interval(1, 5, tol=1e-3)
 Expected:
    (-3.288371361890..., 3.4257507903...)
 Got:
    (-3.288371361890984, array([ 3.42575079]))
 **
 File 
 /scratch/tornaria/sage-4.3/devel/sage-main/sage/symbolic/expression.pyx,
 line 6146:
    sage: f.find_minimum_on_interval(1, 5, tol=1e-2, maxfun=10)
 Expected:
    (-3.288370845983..., 3.4250840220...)
 Got:
    (-3.2883708459837844, array([ 3.42508402]))
 **
 File 
 /scratch/tornaria/sage-4.3/devel/sage-main/sage/symbolic/expression.pyx,
 line 6149:
    sage: f.find_minimum_on_interval(1, 15)
 Expected:
    (-9.477294259479..., 9.5293344109...)
 Got:
    (-9.4772942594797929, array([ 9.52933441]))
 **
 2 items had failures:
   2 of   5 in __main__.example_146
   4 of   8 in __main__.example_147
 ***Test Failed*** 6 failures.
 For whitespace errors, see the file
 /home/tornaria/.sage//tmp/.doctest_expression.py
         [40.2 s]

 -

 sage -t  devel/sage/sage/numerical/optimize.py
 **
 File /scratch/tornaria/sage-4.3/devel/sage-main/sage/numerical/optimize.py,
 line 117:
    sage: find_maximum_on_interval(f, 0,5)
 Expected:
    (0.561096338191..., 0.8603335890...)
 Got:
    (array

Re: [sage-devel] server pool problem

2010-01-10 Thread Gonzalo Tornaria
On Sun, Jan 10, 2010 at 8:49 PM, John Cremona john.crem...@gmail.com wrote:
 The server log ends like this (for some reason I cannot scroll back as
 it is running under screen):

Use C-a [ to enter copy mode which allows you to see the scroll back
of screen itself (pgup, arrows, etc, esc to quit).

Gonzalo
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] How much code to convert to IEEE 754 format ?

2010-01-04 Thread Gonzalo Tornaria
On Sun, Jan 3, 2010 at 3:49 AM, Alex Ghitza aghi...@gmail.com wrote:
 On Sun, 3 Jan 2010 05:35:37 +, David Kirkby david.kir...@onetel.net 
 wrote:

 Was there a good reason for choosing the name 'sgn'? It sems a bit
 strange to me.


 That's the standard mathematical notation for this function, see

 http://en.wikipedia.org/wiki/Sign_function


Ken Thompson was once asked what he would do differently if he were
redesigning the UNIX system. His reply: I'd spell creat with an e.


(http://en.wikiquote.org/wiki/Kenneth_Thompson)

Best, Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] doctest failures due to rounding errors on Solaris.

2009-12-31 Thread Gonzalo Tornaria
On Wed, Dec 30, 2009 at 10:38 PM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 Em, This is very odd.  exp(1) gives a different result on SPARC if you build
 with gcc or Sun Studio. GCC is correct, and Sun Studio is wrong. Yet Sage on
 't2' was build with gcc, not Sun Studio.

gcc is actually inlining exp(1.0) to its correct value. The exp() from
the sun library is incorrect. Try this program instead:

#include math.h
#include stdio.h
#include stdlib.h

int main(int argc, char **argv) {
  double x = 1.0;
  if (argc1)
x = atof(argv[1]);
  printf(%.16lf\n,exp(x));
}

Best, Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Notebook changes for Ipod touch and Iphone

2009-11-25 Thread Gonzalo Tornaria
On Wed, Nov 25, 2009 at 11:04 PM, William Stein wst...@gmail.com wrote:
 Another nice addition would be to use Tachyon instead of Java by
 default to render 3d images on the iphone.  I.e.,

    I = icosahedron()
    I.show(viewer='tachyon')

 works fine on the iphone, but it is tedious to type viewer='tachyon'.

What about a global (per-worsheet?) way of choosing viewer (maybe with
a pull down at the top of the ws)?

Some of us don't have neither an iphone nor java. It /is/ tedious to
type viewer='tachyon'.

Best,
Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


Re: [sage-devel] Re: A Sage NSF proposal to the Computational Mathematics Program

2009-11-23 Thread Gonzalo Tornaria
On Mon, Nov 23, 2009 at 7:04 PM, rjf fate...@gmail.com wrote:
 That's helpful.  Forgive me for asking for information.  I see,
 somewhat later, that this has to do with adding type declarations.
 Just the ticket.  To me is suggests that Python is inappropriate for
 numerical work -- for which C is more appropriate.

Indeed, Python is inappropriate for programming anything which is
cpu-intensive. IMHO, were not for cython/pyrex, sage would be doomed.
Actually, I believe pyrex is one of the main reasons William settled
with python for sage.

 And so the veneer
 of Python is insufficient.  Of course using (optional) declarations in
 Lisp helps some compilers to produce better numerical code. Some of
 that code generation (depending on the Lisp system) is even done with
 C as an intermediary.  And has been done that way since, oh, 1984 or
 so.

The goal of Python/Cython is to code with  *less* parenthesis than C.
Other than that, it's probably the same venerable idea.

Gonzalo

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org


[sage-devel] Re: Implementation of Q(t) and monomials

2009-11-15 Thread Gonzalo Tornaria

On Sun, Nov 15, 2009 at 3:32 AM, William Stein wst...@gmail.com wrote:
    model name      : Dual-Core AMD Opteron(tm) Processor 8220
    cpu MHz         : 1000.000

 Why do you say 1000 MHZ when that particular processor is a 2800Mhz
 (=2.8Ghz) processor?
 [...]
    model name      : Intel(R) Core(TM)2 Duo CPU     P8400  @ 2.26GHz
    cpu MHz         : 800.000


 That cpu MHz of 800 makes no sense, given that your CPU is 2.26GHz.
 I'm just curious.

CPU throttling?

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: xdg-open and Solaris.

2009-11-10 Thread Gonzalo Tornaria

On Tue, Nov 10, 2009 at 4:02 PM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 /opt/kirkby/sage-4.2-Solaris-10-SPARC-sun4u-SunOS/local/bin/sage-native-execute:
 xdg-open: not found

 Is 'xdg-open' supposed to be included in Sage anywhere, or is the user 
 expected
 to have it on their machine?

Check out

http://portland.freedesktop.org/wiki/

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] openSSL import error

2009-11-09 Thread Gonzalo Tornaria

I've just finished compilation of sage-4.2 on a netbook (atom N280) --
6h47m walltime.

The OS is debian (testing, very minimal install).

I ran notebook() from sage, iceweasel (3.0.14) launches, I tried to
upload a worksheet using an url, and after hitting Upload Worksheet
the notebook crashes with the following error:

   
from OpenSSL import SSL
exceptions.ImportError: No module named OpenSSL

I didn't spot anything strange in the build, but I wasn't really looking at it.
I don't have any libssl*-dev installed if that matters. But gnutls
seems to have compiled ok.

I'm downloading the prebuilt binary for atom to see if it works.

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: openSSL import error

2009-11-09 Thread Gonzalo Tornaria

On Mon, Nov 9, 2009 at 6:20 PM, William Stein wst...@gmail.com wrote:
 Upload from a URL can't upload from a published worksheet that is
 published as http or https, actually.  It never occurred to me to
 implement that.  It's meant for uploading sws files, which might be
 sitting on the web somewhere.     Uploading from the URL of a
 published worksheet is an interesting idea.

The published worksheet has a Download link to a .sws file. I was
using that as the url. I didn't expect the url of the worksheet itself
to work, although it would be great to have.

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Could not get source code

2009-11-09 Thread Gonzalo Tornaria

This is with sage 4.2 notebook (both in the atom install mentioned
above and with sagenb.org):

 1. enter def f(n): // return n+1 on a cell, evaluate
 2. enter f?? on the second cell, evaluate.

the result is a box with could not get source code.

Docstrings do work.

Gonzalo.

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Set reorders elements

2009-11-08 Thread Gonzalo Tornaria

On Sun, Nov 8, 2009 at 2:29 AM, Alex Ghitza aghi...@gmail.com wrote:


 This is a bit disconcerting:

 sage: Set(['a', 'b', 'c'])
 {'a', 'c', 'b'}


I am surprised by the following:

sage: s = set(['a', 'b', 'c'])
sage: repr(s)
set(['a', 'c', 'b'])
sage: str(s)
set(['a', 'c', 'b'])

so far so good, however:

sage: s
set(['a', 'b', 'c'])

???

This behaviour happens in 4.2, but NOT in 3.4.1

This doesn't happen in sage -python, but it does happen in sage
-ipython, so I guess is ipython related. However, both versions seem
to be using ipython 9.1...

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Do we need cp -a - or would 'cp -pR' do ?

2009-11-08 Thread Gonzalo Tornaria

On Sat, Nov 7, 2009 at 11:00 PM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 But how did you find out these two were hard links? I'm not aware of any way 
 to
 find if A is a hard link of B, unless one finds the inodes and compares them,
 which would be next to impossible where there are a lot of files. I assume 
 there
 is some way you do this.

$ ls -l sage-4.1.1/local/bin/python*
-rwxr-xr-x 2 tornaria tornaria 5528068 2009-09-04 21:45
sage-4.1.1/local/bin/python
-rwxr-xr-x 2 tornaria tornaria 5528068 2009-09-04 21:45
sage-4.1.1/local/bin/python2.6
-rwxr-xr-x 1 tornaria tornaria1419 2009-09-04 23:54
sage-4.1.1/local/bin/python2.6-config
lrwxrwxrwx 1 tornaria tornaria  16 2009-10-30 01:25
sage-4.1.1/local/bin/python-config - python2.6-config

The 2 in the second column indicates the number of hard link
references; you can guess they are the same file b/c they have the
same metadata --- you can confirm by looking at the inode numbers.


What I actually did, is check out the tarball:

$ tar tvf sage-4.1.1-core2-jsmath_fonts-x86_64-Linux.tar.gz  | grep ^h
hrwxr-xr-x tornaria/tornaria0 2009-09-04 21:45
sage-4.1.1-core2-jsmath_fonts-x86_64-Linux/local/bin/python link to
sage-4.1.1-core2-jsmath_fonts-x86_64-Linux/local/bin/python2.6


WRT symlinks:

$ tar tvf sage-4.1.1-core2-jsmath_fonts-x86_64-Linux.tar.gz  | grep ^l | wc -l
125


 a. fix installation of python so that a symlink is used instead of a hard 
 link

 Do you know where this bit of code is? As I say, from what I can see, the link
 should be created as a symbolic link, not a hard link.

 I suppose in the python spkg...

 [a. is not critical, but as long as it's not done, sage-bdist should
 keep using -a or -d on gnu systems, to avoid bloat in the bdist
 tarfile]

 Though the bloat will already exist on OS X, as OS X uses -pR, and no -a.

Their choice ;-)

 not waste much time over it. Clearly the use of this non-POSIX option '-a' 
 needs
 to be removed asap, as it stops a binary being created on Solaris. I'm 
 reluctant
 to put tests in the script to handle Solaris differently to linux, when POSIX
 options should be suitable for either. If its possible to do something which
 works on all platforms (HP-UX etc), so much the better. But that is hardly 
 that
 important.

rant
POSIX is not suitable. There's no posix way to copy hardlinks. The
standard is just too restrictive, like a dinosaur: big, fat, and slow.
We can try to adjust to posix, for the sake of portability, but that
doesn't make it suitable. We can do it because we are small, lean, and
fast :-)
/rant

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Do we need cp -a - or would 'cp -pR' do ?

2009-11-08 Thread Gonzalo Tornaria

On Sat, Nov 7, 2009 at 11:00 PM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 Gonzalo Tornaria wrote:
 Is it really necessary for sage-bdist to preserve hardlinks?

 [ ... checking a bdist tarball of 4.1.1 ... ]

 there is exactly one hardlink in this bdist tarball:
 local/bin/python is a hardlink to local/bin/python2.6.

 IOW, using -P instead of -d would produce a tarball with two copies of
 the python binary. Shouldn't this be handled with a symbolic link
 instead?

 I would have thought so too. But I'm puzzled, as python-2.6.2.p4/spkg-install
 creates a symbolic link. It has the line:

 ln -s python2.6 python

This is actually creating a local/lib/python symlink to local/lib/python2.6.

It seems to me the line at fault is in file
python-2.6.2.p4/src/Makefile.pre.in, line 763:

(cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))

an -s option to that could make a difference, I think. (I didn't try it)

 My suggestion would be:

 a. fix installation of python so that a symlink is used instead of a hard 
 link

 Do you know where this bit of code is? As I say, from what I can see, the link
 should be created as a symbolic link, not a hard link.

 b. use -PRp as options for cp (this is posix!)
 c. for the sage-main directory, use the trailing / trick so the -L /
 -H option is not necessary (double check this with whoever wrote the
 sage-bdist script to use -L option)

Actually, use a trailing /. as this is more portable.

 d. for systems where -P is not supported, figure out a way to copy
 preserving symlinks.

For the HP-UX, it turns out that cp -Rp is good. It preserves
symlinks, and it turned out also hard links.

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Do we need cp -a - or would 'cp -pR' do ?

2009-11-08 Thread Gonzalo Tornaria

On Sun, Nov 8, 2009 at 9:31 PM, David Kirkby david.kir...@onetel.net wrote:
 Hopefully, -pR may work for any POSIX system if the reason for the
 hard link is known. I can't see what creates that link myself. You
 clearly have a much greater understanding of the issues than me.

Just to clarify, the option -pR is not enough, even disregarding the
hard link issue. In fact, for solaris, using -pR means that also the
symlinks are not handled properly!

IOW, it's really necessary to use -pRP (both p and P) --- this
should work for any posix system (except for the hard link issue).

 This is quite an old release of HP-UX. The more modern versions are
 probabably better, but they will not run on my PA-RISC machine. I
 believe they will only run on Itanium systems.

Then I would guess a newer release of HP-UX actually supports the -P
option to cp.

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Why is local/bin/python a hardlink to local/bin/python2.6.??

2009-11-08 Thread Gonzalo Tornaria

David,

On Sun, Nov 8, 2009 at 10:15 PM, David Kirkby david.kir...@onetel.net wrote:

 If you look on the thread

  Do we need cp -a - or would 'cp -pR' do ?

 you may have noticed that Gonzalo Tornaria  has discovered that
 local/bin/python is a hardlink to local/bin/python2.6. From what I
 understand, this is the only hard link in Sage. It would be better if
 this could be replaced by a symbolic link.

you missed my answer in the other thread:

 I would have thought so too. But I'm puzzled, as python-2.6.2.p4/spkg-install
 creates a symbolic link. It has the line:

 ln -s python2.6 python

This is actually creating a local/lib/python symlink to local/lib/python2.6.

It seems to me the line at fault is in file
python-2.6.2.p4/src/Makefile.pre.in, line 763:

   (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON))

an -s option to that could make a difference, I think. (I didn't try it)

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Do we need cp -a - or would 'cp -pR' do ?

2009-11-07 Thread Gonzalo Tornaria
On Sat, Nov 7, 2009 at 6:48 AM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 cp -L$OPT devel/sage-main $TMP/devel/sage-main

Maybe this is done to handle the case where sage-main is a symlink
to an actual directory. The option -L means to copy symlinks as real
files. Otherwise, the symlink may be copied (when using -a, at least
--- unspecified by posix when using -Rp).

As a matter of fact, using cp -Lra does NOT work as claimed above,
because the -a option implies -P which overrides the -L option. Using
cp -raL would copy symlinks, though.

The actual meaning of -a in gnu cp is really -dRp, not just -Rp.
The -d option should be replaced with -P posix option (preserve
symlinks), except the -d also preserves hard links. I don't think
posix has an option to preserve hard links.

For the line with -L, if the only motivation is to follow the symlink
in case sage-main itself is a symlink, the correct option is -H rather
than -L, but it may be possible to use (instead of -H or -L):

cp -$OPT devel/sage-main/ $TMP/devel/sage-main

the extra / at the end of the source operand makes it to expand the
symlink, if any.

Maybe somebody (wstein?) can comment on why the -L was added to the script?



WRT -d option (preserve symlinks + hardlinks). It's clearly necessary
to preserve symbolic links. For instance, dynamic libraries use
symlinks.

Is it really necessary for sage-bdist to preserve hardlinks?

[ ... checking a bdist tarball of 4.1.1 ... ]

there is exactly one hardlink in this bdist tarball:
local/bin/python is a hardlink to local/bin/python2.6.

IOW, using -P instead of -d would produce a tarball with two copies of
the python binary. Shouldn't this be handled with a symbolic link
instead?

-

My suggestion would be:

a. fix installation of python so that a symlink is used instead of a hard link
b. use -PRp as options for cp (this is posix!)
c. for the sage-main directory, use the trailing / trick so the -L /
-H option is not necessary (double check this with whoever wrote the
sage-bdist script to use -L option)
d. for systems where -P is not supported, figure out a way to copy
preserving symlinks.

[a. is not critical, but as long as it's not done, sage-bdist should
keep using -a or -d on gnu systems, to avoid bloat in the bdist
tarfile]

Gonzalo
PS: I've attached a shell script which exhibits the different
behaviours of cp with different options. You can try something like
that in HP-UX to see if there is a way to preserve symbolic links in a
copy.

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



cp-test.sh
Description: Bourne shell script


[sage-devel] Re: sqrt(2) is real or not

2009-11-04 Thread Gonzalo Tornaria

On Wed, Nov 4, 2009 at 2:43 PM, William Stein wst...@gmail.com wrote:
            sage: Integers(7)(3) in ZZ
            True

I found this one funny:

sage: a = Integers(7)(3)
sage: a in ZZ
True
sage: a in QQ
False


In the same vein:

sage: b = Integers(11)(3)
sage: a in ZZ
True
sage: b in ZZ
True
sage: a + b
...
TypeError: unsupported operand parent(s) for '+': 'Ring of integers
modulo 7' and 'Ring of integers modulo 11'

On the bright side, the error message in this last one is very clear.

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: sqrt(2) is real or not

2009-11-03 Thread Gonzalo Tornaria

On Tue, Nov 3, 2009 at 3:22 PM, Florent Hivert
florent.hiv...@univ-rouen.fr wrote:
 +1 to no simplification...

 Rationale: I think indeed that it is very important that the type of the
 result of an operator depends only of the type of the operands and not of
 their actual values. If  is a constructor for symbolic equation, it sounds me
 perfectly good that sage returns the following:
 sage: SR
 Symbolic Ring
 sage: SR(1)  SR(2)
 1  2
 because it returns:
 sage: x  2
 x  2
 if x is symbolic.

Should I expect

sage: SR(1) + SR(2)
1 + 2

just because

sage: SR(x) + SR(2)
x + 2


Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: sqrt(2) is real or not

2009-11-03 Thread Gonzalo Tornaria

On Tue, Nov 3, 2009 at 3:05 PM, William Stein wst...@gmail.com wrote:
 This reminds me of / being a constructor for elements of QQ, no matter
 what, i.e., a/b for a and b both integers (with b!=0) is a rational,
 no matter what:

 sage: type(2/3)
 type 'sage.rings.rational.Rational'
 sage: type(2/1)
 type 'sage.rings.rational.Rational'

 This was an important design decision that David Kohel pushed hard for
 early on.   Having sqrt(2)  1 *not* simplify by default is consistent
 with this design decision in that foo  bar for either foo or bar
 symbolic, is a constructor for a symbolic equation.

I strongly agree with this design decision. However, the no
simplification policy doesn't follow from this. Rather, I think, the
design leads to

sage: sqrt(2)  1
True
sage: parent(sqrt(2)  1)
Symbolic Ring

i.e. a symbolic True or False

this would be consistent with, e.g.

sage: (SR(x) + 1) - SR(x)
1

which is 1 in SR, not in ZZ; or even

sage: 2/1
2

which is 2 in QQ, not in ZZ.

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: PPA for Sage in Ubuntu

2009-10-30 Thread Gonzalo Tornaria

On Fri, Oct 30, 2009 at 10:54 PM, Ondrej Certik ond...@certik.cz wrote:
 I solve this problem by using gmail, filtering all messages into the
 sage label (folder) and then when I want to check threads, which I
 am involved in, I click on the sent emails link and gmail will
 highlight those threads that contain new emails. So it's super easy
 for me to see if someone has said anything. The only disadvantage is
 that sometimes someone replies a week later, and thus the highlighted
 thread will be on some older page in the sent emails view in gmail.
 So some button show unread would be cool.

Try label:sent label:unread in the gmail search box.

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: cache sizes

2009-10-28 Thread Gonzalo Tornaria

Laptop:

Intel(R) Core(TM)2 CPU T5300  @ 1.73GHz
8 0.023 7.611
   16 0.046 2.018
   32 0.093 2.034
   64 0.289 3.097
  128 0.641 2.216
  256 0.744 1.160
  512 1.542 2.073
 1024 3.394 2.202
 2048 7.826 2.305
 409652.330 6.687
 8192   146.481 2.799
16384   314.824 2.149
32768   662.751 2.105
65536  1331.857 2.010
 32 2048

This is correct.

Server:
Intel(R) Core(TM)2 Quad  CPU   Q9550  @ 2.83GHz
8 0.014 7.452
   16 0.027 2.014
   32 0.055 1.999
   64 0.175 3.188
  128 0.400 2.282
  256 0.446 1.116
  512 0.919 2.060
 1024 1.867 2.030
 2048 3.779 2.024
 4096 8.177 2.164
 819225.677 3.140
16384   164.208 6.395
32768   383.568 2.336
65536   802.709 2.093
 32 8192

Not quite; this core 2 quad has two 6M L2 caches (one for each pair of
cores) for a total 12M of L2 (no shared L3). The L1 is correct.

Gonzalo

On Tue, Oct 27, 2009 at 6:51 PM, Martin Albrecht
m...@informatik.uni-bremen.de wrote:

 Hi there,

 in the thread

    http://is.gd/4EMT8

 David and I agreed that M4RI should have a better, more robust and cross-
 platform mechanism to check for cache sizes.

 Thus I wrote a little C program to check for the cache size using timings of
 random-ish memory access.

 The program is available at:

  http://sage.math.washington.edu/home/malb/cache.c

 On my Core 2 Duo and on my Opteron (both running Linux 64-bit) it does report
 correct sizes. So far so good. On sage.math it reports L3 cache size instead
 of L2 but I guess that this is probably what we want anyway (well, L2 is 3MB
 which I don't check explicitly since I only check powers of two)

 I'd appreciate if those people on this list who have different hardware or
 software (OSX, Solaris, PPC, Sparc) could compile the program and report back
 whether the program reports correct sizes for them. To compile and run:

  gcc -std=c99 -O3 cache.c -o cache
  ./cache

 Cheers,
 Martin


 --
 name: Martin Albrecht
 _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x8EF0DC99
 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
 _www: http://www.informatik.uni-bremen.de/~malb
 _jab: martinralbre...@jabber.ccc.de


 


--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: PIL -- new python imaging library

2009-10-26 Thread Gonzalo Tornaria

On Sun, Oct 25, 2009 at 11:57 PM, William Stein wst...@gmail.com wrote:

 On Sun, Oct 25, 2009 at 10:45 AM, John Cremona john.crem...@gmail.com wrote:

 Beautiful, thanks.  Yes, I do recognise it from Lloyd's book.

 Here are some other images by Tom Boothby, by the way:

   http://8tb.us/home/boothby/cover/samples/


Awesome!

Is it possible to read some analytic or geometric information off
the pictures?

Should modularity imply some kind of self-similarity in the pictures?

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: virtualbox speed

2009-10-24 Thread Gonzalo Tornaria

On Fri, Oct 23, 2009 at 11:41 PM, Ondrej Certik ond...@certik.cz wrote:
 On Fri, Oct 23, 2009 at 4:21 PM, Ondrej Certik ond...@certik.cz wrote:
 Interesting. Do you have some notes about your KVM setup? I want to
 try it as well, as the ubuntu guys seem to prefer it over virtualbox:

I'm using kvm directly (not libvirt / virt-manager). This is kvm 0.72
from debian/lenny.
The command line is long, and includes the following options --- I'll
add a comment on them:

-m 2048### 2 GB of memory for this virtual machine
-smp 2  ### 2 virtual cpus
-nographic### no virtual vga

-net nic,model=virtio   ### virtio network card in the guest
-net user  ### user mode network support in the host

-drive file=debian-1.raw,if=virtio,boot=on
### this is the OS image (9.4GB raw file -- using virtio disk drive)

-drive file=swap-1.raw,if=virtio,cache=off
### another one for swap (4 GB)

-monitor unix:/home/vm/debian/debian-1.monitor,server,nowait
### unix socket used for control of the VM

-cpu qemu64,model=15,+ht,+ssse3,+cx16,model_id=Intel(R) Core(TM)2
Quad  CPU   Q9550  @ 2.83GHz
### this makes it so the cpuid in the virtual machine reports good
flags -- important when compiling sage

-kernel /boot/vmlinuz-2.6.26-1-amd64
-initrd /boot/initrd.img-2.6.26-1-amd64
-append root=/dev/vda1  ro quiet console=ttyS0,115200
### kernel options for booting the VM. I'm using 2.6.26, this is a
kernel from debian
### it's actually booting a kernel in the /boot directory of the host
OS --- but the host itself is running 2.6.29-2.
### The console option for the kernel makes it so that guest console
goes through ttyS0 (because I don't have VGA hardware in the guest)

-redir tcp:11022::22
### I can ssh to the guest through port 11022 in the host

-redir tcp:8000::8000
### I can access to port 8000 in the guest through port 8000 in the
host --- this is where the sage notebook listens

-

The host system is debian lenny
The guest system is also debian lenny

Both are 64 bit.

The machine is a core 2 quad Q9550 with 8Gb of ram.

I also explored using huge pages for the kvm memory, and it seems to
make a bit of a difference, but I'm not using that in production.



This is a shell script I use in /etc/init.d, so the VM runs
automatically at startup, etc:

---
#! /bin/sh
# Start/stop the Sage notebook server.
#
### BEGIN INIT INFO
# Provides:  kvm-sage1
# Required-Start:$kvm
# Required-Stop: $kvm
# Default-Start: 2 3 4 5
# Default-Stop:  1
# Short-Description: KVM for sage1.
# Description:   KVM for sage1.
### END INIT INFO

NAME=kvm-sage1
USER=tornaria
MONFILE=/home/vm/debian/debian-1.monitor
PIDFILE=/home/vm/debian/debian-1.pid
DIR=/home/vm/debian
SCRIPT=run.sh

. /lib/lsb/init-functions

case $1 in
start) log_daemon_msg Starting KVM for sage1 ${SCRIPT}
   start-stop-daemon --start --quiet --pidfile ${PIDFILE} --chuid
${USER} --chdir ${DIR} --startas /usr/bin/screen -- -dmS ${NAME}
${DIR}/${SCRIPT}
   log_end_msg $?
   ;;
stop)  log_daemon_msg Stopping KVM for sage1 ${SCRIPT}
   echo system_powerdown | socat -t 30 - UNIX-CONNECT:$MONFILE 
/dev/null 21 ||
   start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
   log_end_msg $?
   ;;
*) log_action_msg Usage: /etc/init.d/kvm-sage1 {start|stop}
   exit 2
   ;;
esac
exit 0
-


You can see in the stop part how to use the monitor socket to control
the KVM. In the example, we issue system_powerdown, that's the
virtual equivalent of pressing the power button; the guest OS should
get an ACPI powerdown event, and it has 30 seconds to cleanly shutdown
(-t 30 option for socat).


Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: virtualbox speed

2009-10-23 Thread Gonzalo Tornaria

For comparision, I'm using kvm to virtualize our sage notebook server.
Here's the timings for your scripts:

A) the real hardware

0.196608066559
1

0.191864967346
-50

B) the kvm instance

0.219820976257 (11.8% slowdown)
1

0.213951826096 (11.5% slowdown)
-50

Gonzalo

On Fri, Oct 23, 2009 at 7:38 PM, Ondrej Certik ond...@certik.cz wrote:

 Hi,

 I tried the latest Sage virtualbox appliance, it works on ubuntu 9.04, 64bit.

 I then used this simple script (in a terminal) to get some idea how fast it 
 is:

 from timeit  import default_timer as clock
 def test1():
    a = 0
    t = clock()
    for i in range(1, 10**6):
        a += 1/i**2
    t = clock() - t
    print t
    return a

 print test1()


 and then test it on my system:

 $ python2.5 t.py
 0.198249101639
 1


 and in the virtualbox:

 # python a.py
 2.60369110107

 E.g. it's about 13x slower.

 For comparison, in the virtual machine at linode.com, I get:

 $ python t.py
 0.25862288475
 1

 Then it occured to me that maybe just floating point stuff is slow, or
 maybe i**2 is too big. So I modified the script:


 from timeit  import default_timer as clock
 def test1():
    a = 0
    t = clock()
    for i in range(1, 10**6):
        if i % 2 == 0:
            a += i
        else:
            a -= i
    t = clock() - t
    print t
    return a

 print test1()

 which runs on ubuntu:

 $ python2.5 t.py
 0.212127923965
 -50


 and in the virtualbox on the same machine:

 # python a.py
 0.267327070236
 -50


 Which is only about 1.2x slower. So apparently virtualbox is very fast
 for some things.

 Ondrej

 


--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: webMathematica 3 -- mathematica's take on web-based manipulate

2009-10-22 Thread Gonzalo Tornaria

On Thu, Oct 22, 2009 at 2:52 AM, William Stein wst...@gmail.com wrote:

 Hi,

 Mathematica released their web-based *manipulate* implementation:

          http://wolfram.com/products/webmathematica/

Alternate HTML content should be placed here. This content requires
the Adobe Flash Player. Get Flash

This rules it out for me...

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: sage notebook servers

2009-10-16 Thread Gonzalo Tornaria

On Fri, Oct 16, 2009 at 2:18 AM, William Stein wst...@gmail.com wrote:
   1. Where?     (E.g., Dept. of Mathematics, University of Maryland)

Centro de Matemática, Universidad de la República (Montevideo, Uruguay)

   2. Why?   (E.g, for our Math 411 course on differential equations)

Graduate and undergraduate math courses in general and for researchers.

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: Sage notebook in Korean

2009-10-15 Thread Gonzalo Tornaria

On Thu, Oct 15, 2009 at 2:06 PM, Timothy Clemans
timothy.clem...@gmail.com wrote:

 On Thu, Oct 15, 2009 at 2:42 AM, Dan Drake dr...@kaist.edu wrote:
 Here's a complete translation of the Sage notebook into Korean:

 http://math1.skku.ac.kr/

 Go ahead and log in -- username test, password test95. This is the
 work of a couple students and professors at Sungkyunkwan University.
 They also translated Rob Beezer's linear algebra quick reference and
 have a neat mobile phone interface -- click on the different examples
 (예제) and check out the results.

 I would really like to see their translation integrated into the
 notebook, so that the notebook front page has a language selector.

+1

 I really like the homepage they created. Could that homepage along
 with the language translation be added to the notebook?

+1

I can try to have the spanish translation done if somebody else
figures out the details needed to support i18n (say, figure out
gettext for python, produce the .pot files for translation, load the
.po files from the notebook, the language selector feature, etc.)

Best, Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: sage releases

2009-10-14 Thread Gonzalo Tornaria

On Wed, Oct 14, 2009 at 6:49 AM, Burcin Erocal bur...@erocal.org wrote:
 The status of lieutenant is the equivalent of having commit access
 in other open source projects. I would prefer a different term for
 lieutenant, but I don't have anything better now.

What about editor?

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: sage releases

2009-10-14 Thread Gonzalo Tornaria

On Wed, Oct 14, 2009 at 7:12 AM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 2) When submitting a patch, they attach logs showing building on all
 platforms, *except* the one they normally work on, since one can assume
 they have probably got their patch working there.

I don't think this would work at all, unless there is an *easy*
automated procedure to submit a patch to a bot which (a) applies the
patch to the current tree (b) compiles in all platforms (c) attaches
the logs to the ticket and possibly flags the ticket depending on the
result of the test.

OTOH, maybe if  binary distributions for t2 were readily available
(as they are (?) for sage.math), that would encourage some people to
actually try some patches in solaris.

rant
BTW, logging into T2 and getting errors in my .bashrc already
discourages me to get anywhere near solaris. Just one small sample:

grep: illegal option -- q
Usage: grep -hblcnsviw pattern file . . .

Can you please check for me whether grep -q is posix or not?
/rant

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: How should we handle the case of no gcc or g++ in the path?

2009-10-14 Thread Gonzalo Tornaria

On Wed, Oct 14, 2009 at 10:06 AM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 ---
 3) Exit if gcc or g++ can not be found unless SAGE_PORT is exported to
 some non-empty value. Currently SAGE_PORT is only needed on some
 operating systems, and has nothing to do with compilers, but we could
 extend it's usage to mean any unsupported operating systems or
 unsupported compiler.

 If SAGE_PORT is exported to some non-empty value, then the build can
 proceed without gcc and g++ even if gcc and g++ are not in the path.
 ---

What compiler will be used if gcc and g++ are not in the path?
Presumably, this will only work if CC and CXX are set to proper
compilers, right? Doesn't it make sense to:

  4)  check for gcc and g++ except when CC and/or CXX are set, in
which case, check for CC and CXX

??

I'm probably missing something... haven't looked at prereq in a while.

Best,
Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: spkg-install's [was Re: Using a random number generator to tell the time!]

2009-10-12 Thread Gonzalo Tornaria

On Mon, Oct 12, 2009 at 8:45 AM, Dr. David Kirkby
david.kir...@onetel.net wrote:
 I really like Gonzalo's suggestion to think of specific tools and also
 the actual people involved, rather than abstractions and standards.

 [...]

 I can see some advantages in this too, but also some pretty significant
 disadvantages.

 * Native compilers are normally better than the GNU ones (I know you
 [...]

I totally agree targetting different compilers is a worthwhile goal. I
don't think targetting different versions of cp et al is. Especially
if some of them are botched. I don't think e.g. the awk srand() hack
is funny at all; the posix standard at the shell level is deficient
--- for instance, computing the time in seconds since the epoch is a
fairly reasonable requirement which posix fails to address in a
straightforward way.

Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: notebook help needed

2009-10-12 Thread Gonzalo Tornaria

On Mon, Oct 12, 2009 at 2:42 PM, William Stein wst...@gmail.com wrote:
 name using os.path.join, which doesn't put a trailing slash in.  One
 should write code using os.path.join too, which means you shouldn't
 depend on a slash being forward -- it might be backwards (on windows
 it is).

Note that dos and windows accept both forward and backward slashes as
path separators. It's just the command line  which usually overrides
forward slashes to be command options. Try

dir C:/WINDOWS

(with the quotes)

Just 2 pennies worth of trivia... using os.path.sep sounds like the
right think to do anyway...
Gonzalo

PS: the separator for MacOS  10, though, was just : IIRC, but I
don't think it's relevant anymore.

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-devel] Re: alpha.sagenb.org

2009-10-12 Thread Gonzalo Tornaria
On Mon, Oct 12, 2009 at 11:44 PM, Jason Grout
jason-s...@creativetrax.com wrote:
 Thanks.  One more question; how do I start/stop the server?  No screen
 sessions are running, for example.

Since you mention screen, and in case it's useful for somebody, here's
my init.d script to start the sage notebook automatically in a screen
session -- so this is fully automated, but one can still attach to the
running notebook in case something goes wrong... (I have a script
which ssh's to the server as nbuser and runs screen)

This is running in a debian 5.0 (lenny). The sage-notebook script goes
into /etc/init.d, and the notebook.py script goes into /home/nbuser.

Best, Gonzalo

--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



sage-notebook
Description: Binary data
from sage.all import notebook

notebook(directory='/home/nbuser/nbfiles',
 port=8000,
 address='',
 secure=True,
 accounts=True,
 ulimit='-u 200 -v 50 -t 3600',
 open_viewer=False,
 timeout=120,
 ##server_pool=['nbu...@localhost']
)


[sage-devel] Re: Using a random number generator to tell the time!

2009-10-11 Thread Gonzalo Tornaria

Would it make more sense to include something like busybox
(www.busybox.net) into sage? Busybox includes a shell (ash, I think),
and most shellutils and textutils one would probably want to use (this
includes awk, sed, etc).  Instead of trying to fix the sage shell
scripts to work in any combination of shell/utils/etc, just target the
busybox shell with its corresponding utils.

I don't know how feasible it is to compile busybox on OSX, solaris, or
other unices, though.

Gonzalo


BusyBox combines tiny versions of many common UNIX utilities into a
single small executable. It provides replacements for most of the
utilities you usually find in GNU fileutils, shellutils, etc. The
utilities in BusyBox generally have fewer options than their
full-featured GNU cousins; however, the options that are included
provide the expected functionality and behave very much like their GNU
counterparts. BusyBox provides a fairly complete environment for any
small or embedded system.



On Sun, Oct 11, 2009 at 8:45 AM, Dr. David Kirkby
david.kir...@onetel.net wrote:

 I thought all  you mathematicians could not resist looking at this.

 I know it sounds crazy, but it actually forms the basis of a portable
 method of getting the number of seconds since 1/1/1970 on Unix.

 Learn more from my ticket at

 http://sagetrac.org/sage_trac/ticket/7188


 which needs review!

 dave


 


--~--~-~--~~~---~--~~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



  1   2   >