[sage-support] How to make view open pdf-viewer in background

2014-12-09 Thread 'Martin R' via sage-support
Hi there!

I'm using view to display my graphs and posets.  I would like to have it 
run the viewer (xdg-open, which in the case at hand is evince) in the 
background.  This is on a linux box, running sage 6.5.beta2.

Many many thanks!

Martin

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


[sage-support] Re: Improving a Sage program that is heavy on matrix multipliaction

2014-12-09 Thread Dima Pasechnik
On 2014-12-07, Jernej azi.std...@gmail.com wrote:
 --=_Part_3308_1073346028.1417954673282
 Content-Type: multipart/alternative; 
   boundary==_Part_3309_733817265.1417954673282

 --=_Part_3309_733817265.1417954673282
 Content-Type: text/plain; charset=UTF-8

 Just for fun I wrote an equivalent program in C and tested the Sage 
 function and an equivalent C program on 1 instance of the problem.

===
 $ time ./a.out test

 real0m0.366s
 user0m0.306s
 sys 0m0.060s
===

 And Sage

===
 $ time sage test.sage test

 real2m6.285s
 user2m5.256s
 sys 0m0.858s
===

 I thought that may be interesting to you as well.

 Best,

 Jernej


 On Wednesday, 3 December 2014 22:33:46 UTC+1, Jernej wrote:

 Dear sage-support,

 I have stumbled into a performance bottleneck in one of my Sage programs. 
 I would like to share the relevant problem  here in hope anyone has a 
 constructive suggestion for optimizing the given program.

 I am given a n x n, (0,1) matrix C  where n  20. C has up to 30% of 
 nonzero elements. 

 I define the inner product u,v = u (2I - C) v^t and need to compute the 
 set S of all (0,1) n-vectors u such that u,u = 2 and u,j = -1, where j 
 is the vector with all ones. Finally I need to record all pairs u,v from S 
 such that u,v == -1 or 0.

 The one optimization that I use is to cache the product u*(2I-C). Other 
 than that I don't see any other way to optimize the program hence it looks 
 like

u,j=-1 is a linear condition on u.
Shouldn't you only pick up u from the corresponding hyperplane?


 
 global vectors
 field = RR # this looks like the fastest option
RDF should be faster, IMHO.


 def init_vectors(n):
 global vectors
 vectors = [matrix(field,b) for b in product(*[[0,1]]*n)]
 def foo(C,output): 
 
 global vectors

 n = C.nrows()
 # we compute the inverse in QQ just to gain a bit of numerical 
 stability 
 D  = (2*identity_matrix(n)-C).inverse()
 D = Matrix(field,D)

 j = matrix(field, tuple([1 for _ in xrange(n)]))
 cur = 1 

 vec2int = {}
 cache = {}

 for bm in vectors:
 val = bm*D
 if abs( (val*bm.transpose())[0,0]-2) = 0.01 and 
 abs((val*j.transpose())[0,0]+1) = 0.01: 
 vec2int[cur] = bm
 output.write(str(el for el in bm[0])+'\n')
 cache[cur] = val 
 cur+=1

 for i in xrange(1, cur):
 for j in xrange(i+1, cur):
 iv = (cache[i]*vec2int[j].transpose())[0,0]
 if abs(iv) = 0.001 or abs(iv+1) = 0.01: 
output.write(str(i) + ' ' + str(j) + '\n')
 ===

 For convenience's sake I have attached the result of %prun on one instance 
 of the problem. From the output of prun I suppose it would make sense to 
 cache the transpose of the vectors as well, though I am not sure this is 
 going to make the crucial difference.

 On average it takes 200s to process one matrix and given that I have 
 millions of such matrices it would take years to process all the input.  

 Other than rewriting the whole thing in C I currently do not see any 
 viable solution. Hence I am wondering: Do you guys happen to see any clever 
 optimization? Is there a way to compute the named product more efficiently? 
You could use Cython instead of C, and numpy arrays instead of Sage
matrices (numpy arrays interface quite well with Cython).
Alas, currently plain Sage matrices are very slow.

As your matrices are quite small, alternatively you might experiment
with computing modulo p, for p a prime or order bigger than n^2.


 Best,

 Jernej



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


Re: [sage-support] Running Sage.app installed by another user

2014-12-09 Thread Jérôme Tremblay


 Then the chmod trick should work until we get a better fix.  

 
They workaround works fine. I chmoded 777 the executable 
/Applications/Sage.app/Contents/Resources/sage/sage. Thank you.
 

 exits normally, so I can’t use that.  Maybe saving the user’s answer would 
 be sufficient?  So they would only get asked once (per sage version).


Why not once per _location_ instead of version? The users home directory, 
their DOT_SAGE, is in their account and is persistent, while the .app 
version can change anytime between sessions. 
 

 -Ivan


Thanks a lot for your help,


Jerome Tremblay
LaCIM, UQAM 

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


[sage-support] Re: error with help(notebook)

2014-12-09 Thread a . barbieri009


Il giorno martedì 9 dicembre 2014 02:33:50 UTC+1, kcrisman ha scritto:


 I would read the notebook help but it fails:

 sage: help (notebook)



 This is in fact expected.  Try

 sage: notebook?

 for what you most likely want.  Or, 

 sage: import sagenb
 sage: help(sagenb.notebook)

 this is because `help` needs a Python module, not just a command.   In 
 general, the ? syntax is the way to go for help - see e.g. 
 http://sagemath.org/doc/prep/Intro-Tutorial.html#help-inside-sage for 
 more examples.  Good luck!

 - kcrisman


Thank you, just what i wanted. 

-- 
Informativa sulla Privacy: http://www.unibs.it/node/8155

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


Re: [sage-support] Running Sage.app installed by another user

2014-12-09 Thread Ivan Andrus
On Tue, Dec 9, 2014 at 8:37 AM, Jérôme Tremblay jerome.tremb...@gmail.com
wrote:


 Then the chmod trick should work until we get a better fix.


 They workaround works fine. I chmoded 777 the executable
 /Applications/Sage.app/Contents/Resources/sage/sage. Thank you.


Excellent.  Glad to hear it.


 exits normally, so I can’t use that.  Maybe saving the user’s answer would
 be sufficient?  So they would only get asked once (per sage version).


 Why not once per _location_ instead of version? The users home directory,
 their DOT_SAGE, is in their account and is persistent, while the .app
 version can change anytime between sessions.


Sorry, location is exactly what I meant.

-Ivan

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


Re: [sage-support] Running Sage.app installed by another user

2014-12-09 Thread Ivan Andrus
On Tue, Dec 9, 2014 at 8:03 AM, kcrisman kcris...@gmail.com wrote:

 Does someone want to open a trac ticket (or is there already one)?


 Go ahead, I still don't understand the details enough as to why it is
 giving that warning if they can indeed write to the file Sage will need to
 write to.


Okay, http://trac.sagemath.org/ticket/17479

The reason is that Sage *will* write to .sage, but *might* have to write to
the sage install because of sage-location (which they can't).

Does that make sense?

-Ivan

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


[sage-support]

2014-12-09 Thread Christophe Bal
Hello.

Is there an easy way to load a picture into an array so as to apply a
matrix transformation to all the xy-corrdinates ? If a solution without
using numpy exists, this would be cool.


*Christophe BAL*
*Enseignant de mathématiques en Lycée **et développeur Python amateur*
*---*
*French math teacher in a Lycée **and **Python **amateur developer*

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


Re: [sage-support] Running Sage.app installed by another user

2014-12-09 Thread kcrisman


 The reason is that Sage *will* write to .sage, but *might* have to write 
 to the sage install because of sage-location (which they can't).


Oh right, that's right. 

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


Re: [sage-support]

2014-12-09 Thread Vincent Delecroix
Hello,

I would say PIL is an alternative (but less powerful than numpy). A
bit of googling brought me to this very nice post

http://stackoverflow.com/questions/14177744/how-does-perspective-transformation-work-in-pil

Best
Vincent

2014-12-10 0:33 UTC+01:00, Christophe Bal projet...@gmail.com:
 Hello.

 Is there an easy way to load a picture into an array so as to apply a
 matrix transformation to all the xy-corrdinates ? If a solution without
 using numpy exists, this would be cool.


 *Christophe BAL*
 *Enseignant de mathématiques en Lycée **et développeur Python amateur*
 *---*
 *French math teacher in a Lycée **and **Python **amateur developer*

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


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