[sage-devel] Re: OS X (or BSD) testers needed

2018-02-22 Thread kcrisman


Confirming Justin on an older OS X:


$ uname -a

Darwin GC06259 15.6.0 Darwin Kernel Version 15.6.0: Mon Nov 13 21:58:35 PST 
2017; root:xnu-3248.72.11~1/RELEASE_X86_64 x86_64


$ gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack

status = 4

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: gambit does not build (sage 8.2.beta6)

2018-02-22 Thread Matthias Koeppe
See https://trac.sagemath.org/ticket/21864

On Wednesday, February 21, 2018 at 4:41:10 AM UTC-8, Jeroen Demeyer wrote:
>
> If somebody wants to fix this, you should try pip. gambit is currently 
> one of the few Python packages that are installed using the classical 
> setup.py script instead of pip. 
>
> Changing to pip is an obvious thing to do anyway and it might even fix 
> the problem. 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: BUGS in tensor products of algebras

2018-02-22 Thread Travis Scrimshaw
Hey Vit,

   Some of these issues are probably related to bad input. Let us start 
>> with *.algebras_generators(). It is useful to look at the output:
>>
>> sage: PBW.algebra_generators()
>> Finite family {-alpha[1]: PBW[-alpha[1]], alpha[1]: PBW[alpha[1]], 
>> alphacheck[1]: PBW[alphacheck[1]]}
>>
>> So it is expecting a simple root as input. Similarly, for your tensor 
>> product:
>>
>  
>
>>
>> sage: UC = PBW.tensor(C)
>> Lazy family (Term map from Image of Cartesian product of Free abelian 
>> monoid indexed by {alpha[1], alphacheck[1], -alpha[1]}, Subsets of {0, 1} 
>> by  to Universal enveloping algebra of Lie algebra of ['A', 
>> 1] in the Chevalley basis in the Poincare-Birkhoff-Witt basis # The 
>> Clifford algebra of the Quadratic form in 2 variables over Rational Field 
>> with coefficients: 
>> [ 1 0 ]
>> [ * 1 ](i))_{i in Image of Cartesian product of Free abelian monoid 
>> indexed by {alpha[1], alphacheck[1], -alpha[1]}, Subsets of {0, 1} by > 'tuple'>}
>>
>> The tensor product as QQ-modules knows that it is a QQ-algebra, but it 
>> plays it safe and uses its basis as the generating set, which in turn, is a 
>> Cartesian product of the bases of its factors. Subsequently, the keys for 
>> the basis is the Cartesian product of the keys of the factors. So in this 
>> case, the (1,1) corresponds to the keys for the Clifford algebra basis 
>> (more of a by-product of the implementation, but the subsets are natural):
>>
>>
> That sounds fine. But for a newcomer it's really hard to figure out what 
> should he input. I am still not sure myself. Consider this:
>
> alpha = PBW.algebra_generators().keys()
> PBW.basis()[alpha[0]] == PBW.algebra_generators()[alpha[0]]
>
>
>
> I think this is a bug. 
>

No, it is not. The keys for the basis of the PBW are different than those 
for the algebra generators. See the output:

sage: PBW.basis()
Lazy family (Term map from Free abelian monoid indexed by {alpha[1], 
alphacheck[1], -alpha[1]} to Universal enveloping algebra of Lie algebra of 
['A', 1] in the Chevalley basis in the Poincare-Birkhoff-Witt basis(i))_{i 
in Free abelian monoid indexed by {alpha[1], alphacheck[1], -alpha[1]}}
sage: PBW.algebra_generators()
Finite family {-alpha[1]: PBW[-alpha[1]], alpha[1]: PBW[alpha[1]], 
alphacheck[1]: PBW[alphacheck[1]]}

It clearly indicates that the basis keys should be an element of a free 
abelian monoid. LBYL. Now in this case, if we did try to convert the input 
into the keys, it should work. See https://trac.sagemath.org/ticket/18750. 
Actually, it is not as bad as I remembered in terms of outright timings, 
but there are some other technical issues.


>  
>
>> sage: C.basis()
>> Lazy family (Term map from Subsets of {0, 1} to The Clifford algebra of 
>> the Quadratic form in 2 variables over Rational Field with coefficients: 
>> [ 1 0 ]
>> [ * 1 ](i))_{i in Subsets of {0, 1}}
>>
>> So it is expecting subsets and that the user will not input bad data. 
>> There is no reason for it to simplify and not a bug. Granted, we could put 
>> a check on the user input here, but there is a speed penalty as this can be 
>> a well-used code path internally. Moreover, ducktyping can also be useful. 
>> So we are fairly permissive here, but not without due cause IMO.
>>
>>
> Pardon my ignorance, but If there is no simplification then what is all 
> this good for? It does simplify for universal enveloping algebra and so it 
> should do it for Clifford algebras as well. Also I have a big issue with 
> naming convention here. The method basis() does not produce a basis!
>

it is *bad input*. It does produce a basis, one indexed by *subsets*, not 
words/multisets. In math terms, if you have a sequence (x_i)_{i \in I}, 
then want x_j, where j \notin I, then you have an error. With #18750, this 
input might instead raise an error. If you want to do that, then you can do 
this:

sage: Q = QuadraticForm(QQ, 2, [1,0,1])
sage: C = CliffordAlgebra(Q)
sage: g = list(C.algebra_generators()); g
[e0, e1]
sage: prod(g[i] for i in [0,0,1,0,1,1,0,0])
-e0*e1

If you took your input and wrapped it with set:

sage: set((1,1,0,1))
{0, 1}

which would be the other possible outcome with #18750.
 

>  I understand that it might be convenient for implementation details to 
> use tuples of numbers (not subsets!!!) to index elements, but why can I 
> index with E, F and H in the universal enveloping algebra case and not with 
> e and f in the Clifford algebra case?
>
> It seems that accessing Clifford algebra elements through basis just 
> messes up with the simplification.
>
> x = cb[(1,1,0,1)]
> print(simplify(x))
> print(type(x))
> print(f*f*e*f)
> print(type(f*f*e*f))
> print(f*f*e*f == x)
>
>
> Do not confuse a bug with a not-yet-implemented feature: (noncommutative) 
>> polynomial rings are not in AlgebrasWithBasis, so it is not expected that 
>> they work with something like tensor(). However, it would be a good feature 
>> to add. :)
>>
>
> I guess are referring to my complaints about not 

Re: [sage-devel] Re: OS X (or BSD) testers needed

2018-02-22 Thread Volker Braun
Fun fact: in Apple's Swift language an array out of bounds access also 
terminates with SIGILL


On Thursday, February 22, 2018 at 8:54:18 PM UTC+1, Jeroen Demeyer wrote:
>
> On 2018-02-22 17:32, Dima Pasechnik wrote: 
> > $ clang forksigaltstack.c -o forksigaltstack && ./forksigaltstack 
> > got signal 11 
> > status = 0 
>
> Excellent. So it's only Apply who is crazy. 
>
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Problems building maxima in the sage 8.1 (stable)

2018-02-22 Thread Matic Šavli
Hi,

Thanks for all the suggestions. I found the problem.
Pretty stupid actually but sometimes it happens. I don't know how I 
couldn't think about that yesterday. 
When removing roswell from my environment I forgot to "make clean".

Anyway if I ./configure again (witouth my local roswell in env) and then 
make. Everything seems to be ok!

So, yes. If you have a local roswell environment it seems to be some 
potential issues for maxima.


Thanks for all the help.
cheers,
matic

On Thursday, 22 February 2018 10:29:28 UTC+1, Dima Pasechnik wrote:
>
>
>
> On Thursday, February 22, 2018 at 5:05:40 AM UTC, Robert Dodier wrote:
>>
>> On 2018-02-21, Matic Šavli  wrote: 
>>
>> > In particular, problems are with the package maxima-5.39.0.p0. 
>> > I understand that sage will build local copy of ecl lisp 
>> implementation, 
>> > which is maxima depends on. 
>> > From the logfile (attached) it seems that maxima tries to create file 
>> > ~/roswell/lisp/quicklisp/setup.lisp and failes. 
>>
>> Not sure what's going on here, but, for the record, Maxima doesn't make 
>> use of quicklisp or roswell (not yet, anyway). So I think any references 
>> to those packages must be coming from the build environment. 
>>
>> quicklisp is bundled with ECL (the Lisp compiler used in Sage to run 
> Maxima)
>  
>
>> Sorry I can't be more helpful, 
>> Robert Dodier 
>>
>>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] OS X (or BSD) testers needed

2018-02-22 Thread Justin C. Walker

> On Feb 22, 2018, at 07:10 , Jeroen Demeyer  wrote:
> 
> If you have an OS X (or BSD) system installed with development tools, please 
> run:
> 
> uname -a
> gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack
> 
> and post the output. This code is a reduction of a test failure in cysignals. 
> I consider that failure to be an OS X bug. I want to have some better idea of 
> which systems are affected.
> 
> The expected output is
> 
> got signal 11
> status = 0
> 
> but on some (presumably broken) systems I get
> 
> status = 4

Bringing up the rear, I get this:

$ uname -a
Darwin Artin.local 15.6.0 Darwin Kernel Version 15.6.0: Tue Jan  9 20:12:05 PST 
2018; root:xnu-3248.73.5~1/RELEASE_X86_64 x86_64
$ ./forksigaltstack 
status = 4

In case it sheds light, I'm attaching the crash log.

Justin

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


forksigaltstack_2018-02-22-121735_Artin.crash
Description: Binary data


--
Justin C. Walker
Curmudgeon-at-large
Director
Institute for the Absorption of Federal Funds

186,000 Miles per Second
Not just a good idea:
  it's the law!


-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: OS X (or BSD) testers needed

2018-02-22 Thread Jeroen Demeyer

On 2018-02-22 17:32, Dima Pasechnik wrote:

$ clang forksigaltstack.c -o forksigaltstack && ./forksigaltstack
got signal 11
status = 0


Excellent. So it's only Apply who is crazy.

--
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: embedding sage in c or c++

2018-02-22 Thread Dima Pasechnik


On Thursday, February 22, 2018 at 3:31:46 PM UTC, Erik Bray wrote:
>
> On Thu, Feb 22, 2018 at 11:44 AM, J. Javan  > wrote: 
> > Dear Erik, 
> > 
> > I highly appreciate you for taking the time and helping people. 
> > Basically, we have some mathematical problems in a GUI application 
> > implemented in Qt-C++ which sage is capable of computing them. This is 
> why 
> > we decided to integrate sage in our app. 
> > 
> > However, As you mentioned it is a very complex or even impossible task 
> to 
> > integrate sage into a windows application since sage is a software suit 
> > rather than a python library. 
> > 
> > After googling some, I found another project called SageMathCell which 
> > provides REST interface to a sage server. I guess this is the best of 
> way 
> > achieving what we are looking for. Unless I'm very much mistaken, with 
> > SageMathCell we can run all sage scripts with peace of mind. 
>
> I probably wouldn't--depending on what your application does it would 
> only slow things down to be passing data between two executables over 
> the HTTP stack.  This may be a relatively easy way but there are 
> betters. 
>
> If your application already depends fully on Sage (which, granted, is 
> a big dependency), then why not build your application in the Sage + 
> Cygwin environment?  There's no reason you couldn't do that, and would 
> allow you to incorporate the Python interpreter directly into your 
> application.  Additional, perhaps the C++ component of your 
> application can be refactored into a library, and the GUI component 
> can use PyQT or a similar library, which would simplify building (so 
> long as you have no trouble getting PyQT built against Sage's Python). 
> (Or maybe the C++ component can go away entirely if it's only for the 
> GUI--either way). 
>

Cantor (https://github.com/KDE/cantor) is a KDE frontend to computer 
algebra systems, including Sagemath.
So this looks similar to what you're after, no?


> Beyond that, without seeing your code it's hard to comment much, but I 
> wouldn't overcomplicate things.  Again, if Sage is a hard dependency 
> of your project then you might as well build the project fully in 
> Sage's runtime environment. 
>
>
>
> > As mentioned in this tutorial one should URL encode the sage script and 
> POST 
> > it to 
> > http://{IP address of your SageMathCell server}:/service. 
> > 
> > This perfectly works however I cannot it get to work for some scripts. 
> > 
> > For instance calling the service with below code works: 
> > 
> > QNetworkRequest request; 
> > 
> > request.setUrl(QUrl("http://192.168.224.130:/service;)); 
> > 
> > request.setHeader(QNetworkRequest::ContentTypeHeader, 
> > "application/x-www-form-urlencoded"); 
> > 
> > arrReqBody = "code=print(1+1)"; // This is the sage script which is put 
> in 
> > HTTP body request 
> > 
> > arrReqBody = request.url().toPercentEncoding(arrReqBody, "=()[].:,"); 
> > 
> > QNetworkAccessManager *netMgr = new QNetworkAccessManager(); 
> > 
> > QObject::connect(netMgr, SIGNAL(finished(QNetworkReply*)), this, 
> > SLOT(sageReply(QNetworkReply*))); 
> > 
> > netMgr->post(request, arrReqBody); 
> > 
> > Which returns the result in stdout as shown below: 
> > "{\"execute_reply\": {\"status\": \"ok\", \"execution_count\": 1, 
> > \"user_expressions\": {}, \"payload\": []}, \"success\": true, 
> \"stdout\": 
> > \"2\\n\"}" 
> > 
> > On the other hand, changing sage script to below does not work. 
> > 
> > arrReqBody = 
> > 
> "code='Y=Polyhedron(vertices=[(0,0,0,0,0,0,0,0),(0,0,0,1,0,1,0,1),(0,0,0,1,0,1,1,1),(0,0,0,1,1,1,0,1)])";
>  
>
> > 
> > arrReqBody += "for v in Y.inequality_generator():print v'"; 
> > 
> > 
> > Above HTTP body returns below which states that the script has been 
> > successfully ran but I've no idea why stdout is missing. 
> > 
> > "{\"execute_reply\": {\"status\": \"ok\", \"execution_count\": 1, 
> > \"user_expressions\": {}, \"payload\": []}, \"success\": true}" 
>
> It looks like you have some extra quoting here.  You have 
>
>arrReqBody="code='...'" 
>
> So the 'code' in this case is just a string literal '...' that happens 
> to contain the actual code you want.  AFAICT there's no reason for 
> those extra single-quotes.  Just as guess though. 
>
> Best, 
> E 
>
>
> > My best guess is that there is something wrong about the encoding 
> however no 
> > luck until now. 
> > I would appreciate it if someone could lend me a hand on this. 
> > 
> > Thanks, 
> > Javan 
> > 
> > 
> > 
> > On Wednesday, January 31, 2018 at 5:30:16 PM UTC+3:30, Erik Bray wrote: 
> >> 
> >> On Tue, Jan 30, 2018 at 2:35 PM, J. Javan  wrote: 
> >> > I can see that you have successfully linked against sage. 
> >> > I also have a Qt GUI application which needs to do some mathematics 
> in 
> >> > the 
> >> > background. 
> >> > This application is targeted for windows platforms. I have installed 
> >> > sage 
> >> > from this link. 
> >> > 

[sage-devel] Re: OS X (or BSD) testers needed

2018-02-22 Thread Dima Pasechnik


On Thursday, February 22, 2018 at 3:10:12 PM UTC, Jeroen Demeyer wrote:
>
> If you have an OS X (or BSD) system installed with development tools, 
> please run: 
>
> uname -a 
> gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack 
>
> and post the output. This code is a reduction of a test failure in 
> cysignals. I consider that failure to be an OS X bug. I want to have 
> some better idea of which systems are affected. 
>
> The expected output is 
>
> got signal 11 
> status = 0 
>

this is what I get on FreeBSD, with gcc6, or clang 4.0.0, or clang 6.0.0

uname -a 
FreeBSD dimpase-bsd.cs.ox.ac.uk 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: 
Tue Nov 14 06:12:40 UTC 2017
 r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
 
$ clang forksigaltstack.c -o forksigaltstack && ./forksigaltstack 
got signal 11
status = 0


> but on some (presumably broken) systems I get 
>
> status = 4 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: BUGS in tensor products of algebras

2018-02-22 Thread Vít Tuček
Hey Travis,
 thank you for clarification.

Dne čtvrtek 22. února 2018 2:44:44 UTC+1 Travis Scrimshaw napsal(a):
>
> Hey Vit,
>Some of these issues are probably related to bad input. Let us start 
> with *.algebras_generators(). It is useful to look at the output:
>
> sage: PBW.algebra_generators()
> Finite family {-alpha[1]: PBW[-alpha[1]], alpha[1]: PBW[alpha[1]], 
> alphacheck[1]: PBW[alphacheck[1]]}
>
> So it is expecting a simple root as input. Similarly, for your tensor 
> product:
>
 

>
> sage: UC = PBW.tensor(C)
> Lazy family (Term map from Image of Cartesian product of Free abelian 
> monoid indexed by {alpha[1], alphacheck[1], -alpha[1]}, Subsets of {0, 1} 
> by  to Universal enveloping algebra of Lie algebra of ['A', 
> 1] in the Chevalley basis in the Poincare-Birkhoff-Witt basis # The 
> Clifford algebra of the Quadratic form in 2 variables over Rational Field 
> with coefficients: 
> [ 1 0 ]
> [ * 1 ](i))_{i in Image of Cartesian product of Free abelian monoid 
> indexed by {alpha[1], alphacheck[1], -alpha[1]}, Subsets of {0, 1} by  'tuple'>}
>
> The tensor product as QQ-modules knows that it is a QQ-algebra, but it 
> plays it safe and uses its basis as the generating set, which in turn, is a 
> Cartesian product of the bases of its factors. Subsequently, the keys for 
> the basis is the Cartesian product of the keys of the factors. So in this 
> case, the (1,1) corresponds to the keys for the Clifford algebra basis 
> (more of a by-product of the implementation, but the subsets are natural):
>
>
That sounds fine. But for a newcomer it's really hard to figure out what 
should he input. I am still not sure myself. Consider this:

alpha = PBW.algebra_generators().keys()
PBW.basis()[alpha[0]] == PBW.algebra_generators()[alpha[0]]



I think this is a bug. 

 

> sage: C.basis()
> Lazy family (Term map from Subsets of {0, 1} to The Clifford algebra of 
> the Quadratic form in 2 variables over Rational Field with coefficients: 
> [ 1 0 ]
> [ * 1 ](i))_{i in Subsets of {0, 1}}
>
> So it is expecting subsets and that the user will not input bad data. 
> There is no reason for it to simplify and not a bug. Granted, we could put 
> a check on the user input here, but there is a speed penalty as this can be 
> a well-used code path internally. Moreover, ducktyping can also be useful. 
> So we are fairly permissive here, but not without due cause IMO.
>
>
Pardon my ignorance, but If there is no simplification then what is all 
this good for? It does simplify for universal enveloping algebra and so it 
should do it for Clifford algebras as well. Also I have a big issue with 
naming convention here. The method basis() does not produce a basis!

 I understand that it might be convenient for implementation details to use 
tuples of numbers (not subsets!!!) to index elements, but why can I index 
with E, F and H in the universal enveloping algebra case and not with e and 
f in the Clifford algebra case?

It seems that accessing Clifford algebra elements through basis just messes 
up with the simplification.

x = cb[(1,1,0,1)]
print(simplify(x))
print(type(x))
print(f*f*e*f)
print(type(f*f*e*f))
print(f*f*e*f == x)



 

> Do not confuse a bug with a not-yet-implemented feature: (noncommutative) 
> polynomial rings are not in AlgebrasWithBasis, so it is not expected that 
> they work with something like tensor(). However, it would be a good feature 
> to add. :)
>

I guess are referring to my complaints about not being able to take tensor 
product with noncommutative ring. I see the naming convention as a BUG. If 
the method has "algebra" in it's name, it should produce algebra and not a 
ring. If a method has "basis" in its name, it should produce basis not a 
generating set as C.basis() does or a basis and not an algebra as 
pbw_basis() does. 
 

>
> if you want to access the basis, use the .basis() method.
>
> Also, how is pbw_basis not an intuitive name for obtaining the PBW basis 
> (there is also the fully spelled out version too)? If you want to change 
> the ordering, RTM of "PBW?" to pass in an ordering function to 
> L.pbw_basis().
>
>
For naming conventions see above. I checked out helpstring for PBW and I am 
still not sure how to produce e.g. E, F, H ordering. I suggest to move this 
helpstring to L.pbw_basis(). 
 

> Now the fact that you sometimes obtaining random attribute errors when 
> running that code block is a definite bug. Please submit a trac ticket.
>
>  
Submitted as https://trac.sagemath.org/ticket/24822
 

> In general, I think it is difficult to determine the tensor product of two 
> (non commutative, non PBW) algebras over an arbitrary subalgebra. There is 
> some code for doing smash products somewhere on #15874, but it has 
> bitrotted and IDK if that will give you what you want. I did write some 
> code to compute Verma modules via the PBW basis. I had to work somewhat 
> hard to make it work, and it wasn't apparent to me how to extend that to 
> more general framework.

Re: [sage-devel] OS X (or BSD) testers needed

2018-02-22 Thread John H Palmieri
$ uname -a
Darwin John-iMac-2017.local 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 
09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
$ gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack

status = 4



On Thursday, February 22, 2018 at 7:24:00 AM UTC-8, David Roe wrote:
>
>
> Darwin Davids-MBP 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 
> PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
> status = 4
>
> On Thu, Feb 22, 2018 at 4:21 PM, David Joyner  > wrote:
>
>> On Thu, Feb 22, 2018 at 10:16 AM, Jeroen Demeyer > > wrote:
>> > On 2018-02-22 16:13, David Joyner wrote:
>> >>
>> >> clang: error: no such file or directory: 'forksigaltstack.c'
>> >> clang: error: no input files
>> >
>> >
>> > Sorry, I obviously forgot to mention the step "copy the attached file
>> > forksigaltstack.c to the current working directory" and then run
>> >
>> > uname -a
>> > gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack
>> >
>>
>> jeeves:~ wdj$ gcc forksigaltstack.c -o forksigaltstack && 
>> ./forksigaltstack
>> status = 4
>>
>>
>>
>> > --
>> > 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 post to this group, send email to sage-...@googlegroups.com 
>> .
>> > Visit this group at https://groups.google.com/group/sage-devel.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> 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 post to this group, send email to sage-...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/sage-devel.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: embedding sage in c or c++

2018-02-22 Thread Erik Bray
On Thu, Feb 22, 2018 at 11:44 AM, J. Javan  wrote:
> Dear Erik,
>
> I highly appreciate you for taking the time and helping people.
> Basically, we have some mathematical problems in a GUI application
> implemented in Qt-C++ which sage is capable of computing them. This is why
> we decided to integrate sage in our app.
>
> However, As you mentioned it is a very complex or even impossible task to
> integrate sage into a windows application since sage is a software suit
> rather than a python library.
>
> After googling some, I found another project called SageMathCell which
> provides REST interface to a sage server. I guess this is the best of way
> achieving what we are looking for. Unless I'm very much mistaken, with
> SageMathCell we can run all sage scripts with peace of mind.

I probably wouldn't--depending on what your application does it would
only slow things down to be passing data between two executables over
the HTTP stack.  This may be a relatively easy way but there are
betters.

If your application already depends fully on Sage (which, granted, is
a big dependency), then why not build your application in the Sage +
Cygwin environment?  There's no reason you couldn't do that, and would
allow you to incorporate the Python interpreter directly into your
application.  Additional, perhaps the C++ component of your
application can be refactored into a library, and the GUI component
can use PyQT or a similar library, which would simplify building (so
long as you have no trouble getting PyQT built against Sage's Python).
(Or maybe the C++ component can go away entirely if it's only for the
GUI--either way).

Beyond that, without seeing your code it's hard to comment much, but I
wouldn't overcomplicate things.  Again, if Sage is a hard dependency
of your project then you might as well build the project fully in
Sage's runtime environment.



> As mentioned in this tutorial one should URL encode the sage script and POST
> it to
> http://{IP address of your SageMathCell server}:/service.
>
> This perfectly works however I cannot it get to work for some scripts.
>
> For instance calling the service with below code works:
>
> QNetworkRequest request;
>
> request.setUrl(QUrl("http://192.168.224.130:/service;));
>
> request.setHeader(QNetworkRequest::ContentTypeHeader,
> "application/x-www-form-urlencoded");
>
> arrReqBody = "code=print(1+1)"; // This is the sage script which is put in
> HTTP body request
>
> arrReqBody = request.url().toPercentEncoding(arrReqBody, "=()[].:,");
>
> QNetworkAccessManager *netMgr = new QNetworkAccessManager();
>
> QObject::connect(netMgr, SIGNAL(finished(QNetworkReply*)), this,
> SLOT(sageReply(QNetworkReply*)));
>
> netMgr->post(request, arrReqBody);
>
> Which returns the result in stdout as shown below:
> "{\"execute_reply\": {\"status\": \"ok\", \"execution_count\": 1,
> \"user_expressions\": {}, \"payload\": []}, \"success\": true, \"stdout\":
> \"2\\n\"}"
>
> On the other hand, changing sage script to below does not work.
>
> arrReqBody =
> "code='Y=Polyhedron(vertices=[(0,0,0,0,0,0,0,0),(0,0,0,1,0,1,0,1),(0,0,0,1,0,1,1,1),(0,0,0,1,1,1,0,1)])";
>
> arrReqBody += "for v in Y.inequality_generator():print v'";
>
>
> Above HTTP body returns below which states that the script has been
> successfully ran but I've no idea why stdout is missing.
>
> "{\"execute_reply\": {\"status\": \"ok\", \"execution_count\": 1,
> \"user_expressions\": {}, \"payload\": []}, \"success\": true}"

It looks like you have some extra quoting here.  You have

   arrReqBody="code='...'"

So the 'code' in this case is just a string literal '...' that happens
to contain the actual code you want.  AFAICT there's no reason for
those extra single-quotes.  Just as guess though.

Best,
E


> My best guess is that there is something wrong about the encoding however no
> luck until now.
> I would appreciate it if someone could lend me a hand on this.
>
> Thanks,
> Javan
>
>
>
> On Wednesday, January 31, 2018 at 5:30:16 PM UTC+3:30, Erik Bray wrote:
>>
>> On Tue, Jan 30, 2018 at 2:35 PM, J. Javan  wrote:
>> > I can see that you have successfully linked against sage.
>> > I also have a Qt GUI application which needs to do some mathematics in
>> > the
>> > background.
>> > This application is targeted for windows platforms. I have installed
>> > sage
>> > from this link.
>> > Could you please guide me on how to link my app with sage?
>> >
>> > I'm running your code as below
>> >
>> > #include 
>> >
>> >
>> > int main(int argc, char *argv[])
>> >
>> > {
>> >
>> >
>> > int retVal = 0;
>> >
>> > Py_Initialize();
>> >
>> > PySys_SetArgv(argc, (wchar_t**) argv);
>> >
>> > printf("1+1:\n");
>> >
>> > PyRun_SimpleString("print (1+1)");
>> >
>> > printf("Load sage \n");
>> >
>> > retVal = PyRun_SimpleString("from sage.all import *");
>> >
>> > printf("Factor 2310:\n");
>> >
>> > PyRun_SimpleString("print factor(2310)");
>> >
>> >

Re: [sage-devel] OS X (or BSD) testers needed

2018-02-22 Thread David Roe
Darwin Davids-MBP 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27
PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
status = 4

On Thu, Feb 22, 2018 at 4:21 PM, David Joyner  wrote:

> On Thu, Feb 22, 2018 at 10:16 AM, Jeroen Demeyer 
> wrote:
> > On 2018-02-22 16:13, David Joyner wrote:
> >>
> >> clang: error: no such file or directory: 'forksigaltstack.c'
> >> clang: error: no input files
> >
> >
> > Sorry, I obviously forgot to mention the step "copy the attached file
> > forksigaltstack.c to the current working directory" and then run
> >
> > uname -a
> > gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack
> >
>
> jeeves:~ wdj$ gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack
> status = 4
>
>
>
> > --
> > 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 https://groups.google.com/group/sage-devel.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] OS X (or BSD) testers needed

2018-02-22 Thread David Joyner
On Thu, Feb 22, 2018 at 10:16 AM, Jeroen Demeyer  wrote:
> On 2018-02-22 16:13, David Joyner wrote:
>>
>> clang: error: no such file or directory: 'forksigaltstack.c'
>> clang: error: no input files
>
>
> Sorry, I obviously forgot to mention the step "copy the attached file
> forksigaltstack.c to the current working directory" and then run
>
> uname -a
> gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack
>

jeeves:~ wdj$ gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack
status = 4



> --
> 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 https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] OS X (or BSD) testers needed

2018-02-22 Thread Jeroen Demeyer

On 2018-02-22 16:13, David Joyner wrote:

clang: error: no such file or directory: 'forksigaltstack.c'
clang: error: no input files


Sorry, I obviously forgot to mention the step "copy the attached file 
forksigaltstack.c to the current working directory" and then run


uname -a
gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack

--
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
#include 
#include 
#include 
#include 
#include 

static void handler(int sig)
{
fprintf(stderr, "got signal %i\n", sig);
fflush(stderr);
_exit(0);
}

volatile int yes;
static void stack_overflow(void)
{
yes = 1;
if (yes) stack_overflow();
if (yes) stack_overflow();
}

int main(int argc, char** argv)
{
static char alt_stack_space[1 << 16];
stack_t ss;
ss.ss_sp = alt_stack_space;
ss.ss_size = sizeof(alt_stack_space);
ss.ss_flags = 0;
if (sigaltstack(, NULL)) {perror("sigaltstack"); exit(1);}

struct sigaction sa;
sa.sa_handler = handler;
sigemptyset(_mask);
sa.sa_flags = SA_ONSTACK;
if (sigaction(SIGSEGV, , NULL)) {perror("sigaction"); exit(1);}
if (sigaction(SIGBUS, , NULL)) {perror("sigaction"); exit(1);}
if (sigaction(SIGILL, , NULL)) {perror("sigaction"); exit(1);}

pid_t child = fork();

if (!child)
{
/* Child process */
stack_overflow();
}

int status;
if (wait() != child) {fputs("wait() did not return child\n", stderr); exit(1);}

printf("status = %i\n", status);
return 0;
}


Re: [sage-devel] OS X (or BSD) testers needed

2018-02-22 Thread David Joyner
On Thu, Feb 22, 2018 at 10:10 AM, Jeroen Demeyer  wrote:
> If you have an OS X (or BSD) system installed with development tools, please
> run:
>
> uname -a
> gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack
>
> and post the output. This code is a reduction of a test failure in


jeeves:~ wdj$ uname -a
Darwin jeeves.fios-router.home 17.5.0 Darwin Kernel Version 17.5.0:
Mon Jan 29 02:17:30 PST 2018; root:xnu-4570.50.257~17/RELEASE_X86_64
x86_64
jeeves:~ wdj$ gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack
clang: error: no such file or directory: 'forksigaltstack.c'
clang: error: no input files

OS:10.13.4 beta.

> cysignals. I consider that failure to be an OS X bug. I want to have some
> better idea of which systems are affected.
>
> The expected output is
>
> got signal 11
> status = 0
>
> but on some (presumably broken) systems I get
>
> status = 4
>
> --
> 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 https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] OS X (or BSD) testers needed

2018-02-22 Thread Jeroen Demeyer
If you have an OS X (or BSD) system installed with development tools, 
please run:


uname -a
gcc forksigaltstack.c -o forksigaltstack && ./forksigaltstack

and post the output. This code is a reduction of a test failure in 
cysignals. I consider that failure to be an OS X bug. I want to have 
some better idea of which systems are affected.


The expected output is

got signal 11
status = 0

but on some (presumably broken) systems I get

status = 4

--
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.
#include 
#include 
#include 
#include 
#include 

static void handler(int sig)
{
fprintf(stderr, "got signal %i\n", sig);
fflush(stderr);
_exit(0);
}

volatile int yes;
static void stack_overflow(void)
{
yes = 1;
if (yes) stack_overflow();
if (yes) stack_overflow();
}

int main(int argc, char** argv)
{
static char alt_stack_space[1 << 16];
stack_t ss;
ss.ss_sp = alt_stack_space;
ss.ss_size = sizeof(alt_stack_space);
ss.ss_flags = 0;
if (sigaltstack(, NULL)) {perror("sigaltstack"); exit(1);}

struct sigaction sa;
sa.sa_handler = handler;
sigemptyset(_mask);
sa.sa_flags = SA_ONSTACK;
if (sigaction(SIGSEGV, , NULL)) {perror("sigaction"); exit(1);}
if (sigaction(SIGBUS, , NULL)) {perror("sigaction"); exit(1);}
if (sigaction(SIGILL, , NULL)) {perror("sigaction"); exit(1);}

pid_t child = fork();

if (!child)
{
/* Child process */
stack_overflow();
}

int status;
if (wait() != child) {fputs("wait() did not return child\n", stderr); exit(1);}

printf("status = %i\n", status);
return 0;
}


Re: [sage-devel] [Crypto] S-box Linear Approximation Matrix scaling

2018-02-22 Thread Friedrich Wiemer
I opened a ticket for this: #24819 

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: embedding sage in c or c++

2018-02-22 Thread J. Javan
Dear Erik,

I highly appreciate you for taking the time and helping people. 
Basically, we have some mathematical problems in a GUI application 
implemented in Qt-C++ which sage is capable of computing them. This is why 
we decided to integrate sage in our app.

However, As you mentioned it is a very complex or even impossible task to 
integrate sage into a windows application since sage is a software suit 
rather than a python library.

After googling some, I found another project called SageMathCell 
 which provides REST 
 interface 
to a sage server. I guess this is the best of way achieving what we are 
looking for. Unless I'm very much mistaken, with SageMathCell we can run 
all sage scripts with peace of mind. 

As mentioned in this tutorial 

 one 
should URL encode the sage script and POST it to 
http://{IP address of your SageMathCell server}:/service.

This perfectly works however I cannot it get to work for some scripts.

For instance calling the service with below code works:

QNetworkRequest request;

request.setUrl(QUrl("http://192.168.224.130:/service;));

request.setHeader(QNetworkRequest::ContentTypeHeader, 
"application/x-www-form-urlencoded");

arrReqBody = "code=print(1+1)"; // This is the sage script which is put in HTTP 
body request

arrReqBody = request.url().toPercentEncoding(arrReqBody, "=()[].:,");

QNetworkAccessManager *netMgr = new QNetworkAccessManager();

QObject::connect(netMgr, SIGNAL(finished(QNetworkReply*)), this, 
SLOT(sageReply(QNetworkReply*)));

netMgr->post(request, arrReqBody);

Which returns the result in stdout as shown below:
"{\"execute_reply\": {\"status\": \"ok\", \"execution_count\": 1, 
\"user_expressions\": {}, \"payload\": []}, \"success\": true, \"stdout\": 
\"2\\n\"}"

On the other hand, changing sage script to below does not work.

arrReqBody = 
"code='Y=Polyhedron(vertices=[(0,0,0,0,0,0,0,0),(0,0,0,1,0,1,0,1),(0,0,0,1,0,1,1,1),(0,0,0,1,1,1,0,1)])";

arrReqBody += "for v in Y.inequality_generator():print v'";


Above HTTP body returns below which states that the script has been 
successfully ran but I've no idea why stdout is missing.

"{\"execute_reply\": {\"status\": \"ok\", \"execution_count\": 1, 
\"user_expressions\": {}, \"payload\": []}, \"success\": true}"



My best guess is that there is something wrong about the encoding however 
no luck until now.
I would appreciate it if someone could lend me a hand on this.

Thanks,
Javan



On Wednesday, January 31, 2018 at 5:30:16 PM UTC+3:30, Erik Bray wrote:
>
> On Tue, Jan 30, 2018 at 2:35 PM, J. Javan  > wrote: 
> > I can see that you have successfully linked against sage. 
> > I also have a Qt GUI application which needs to do some mathematics in 
> the 
> > background. 
> > This application is targeted for windows platforms. I have installed 
> sage 
> > from this link. 
> > Could you please guide me on how to link my app with sage? 
> > 
> > I'm running your code as below 
> > 
> > #include  
> > 
> > 
> > int main(int argc, char *argv[]) 
> > 
> > { 
> > 
> > 
> > int retVal = 0; 
> > 
> > Py_Initialize(); 
> > 
> > PySys_SetArgv(argc, (wchar_t**) argv); 
> > 
> > printf("1+1:\n"); 
> > 
> > PyRun_SimpleString("print (1+1)"); 
> > 
> > printf("Load sage \n"); 
> > 
> > retVal = PyRun_SimpleString("from sage.all import *"); 
> > 
> > printf("Factor 2310:\n"); 
> > 
> > PyRun_SimpleString("print factor(2310)"); 
> > 
> > Py_Finalize(); 
> > 
> > return 0; 
> > 
> > } 
> > 
> > 
> > And this gives me the following output: 
> > 
> > 1+1: 
> > 2 
> > Load sage 
> > Traceback (most recent call last): 
> >   File "", line 1, in  
> > ModuleNotFoundError: No module named 'sage' 
> > Factor 2310: 
> >   File "", line 1 
> > print factor(2310) 
> >^ 
> > SyntaxError: invalid syntax 
> > Press  to close this window... 
> > 
> > The output is clearly stating that sage cannot be found. 
> > This is because I have linked to my locally compiled python static 
> > libraries(Actually I have downloaded python source code and linked 
> against 
> > it.) which are not aware of sage. 
> > 
> > Also I tried to link against python provided in sage installation but I 
> > can't find any "python.lib" in it. 
> > I have also set an environment variable $SAGE_LOCAL pointing to 
> "C:\Program 
> > Files\SageMath 8.1\runtime\opt\sagemath-8.1\local" but no luck. 
> > 
> > Environment: 
> > Qt_v5.9 
> > Windows 7 
> > Python_v3.6.4 
> > Sage_v8.1 
>
> Hi, 
>
> I saw this mail forwarded to sage-devel, but it appears to be missing 
> quite a lot of context.  What, specifically, is it that you're trying 
> to do? 
>
> To be clear, Sage for Windows is not just a Python module.  It's an 
> entire software suite, including its own Python interpreter. 

[sage-devel] Re: Problems building maxima in the sage 8.1 (stable)

2018-02-22 Thread Dima Pasechnik


On Thursday, February 22, 2018 at 5:05:40 AM UTC, Robert Dodier wrote:
>
> On 2018-02-21, Matic Šavli  wrote: 
>
> > In particular, problems are with the package maxima-5.39.0.p0. 
> > I understand that sage will build local copy of ecl lisp implementation, 
> > which is maxima depends on. 
> > From the logfile (attached) it seems that maxima tries to create file 
> > ~/roswell/lisp/quicklisp/setup.lisp and failes. 
>
> Not sure what's going on here, but, for the record, Maxima doesn't make 
> use of quicklisp or roswell (not yet, anyway). So I think any references 
> to those packages must be coming from the build environment. 
>
> quicklisp is bundled with ECL (the Lisp compiler used in Sage to run 
Maxima)
 

> Sorry I can't be more helpful, 
> Robert Dodier 
>
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.