Sage: Ticket #7797: Full interface to letterplace from singular
https://trac.sagemath.org/ticket/7797
<p>
The new aim of this ticket is to add an interface to the <a class="ext-link" href="http://www.singular.uni-kl.de/Manual/latest/sing_427.htm#SEC480"><span class="icon"></span>letterplace</a> component of Singular, that actually goes beyond what Singular offers.
</p>
<p>
The patch provides
</p>
<ul><li>A new implementation of free algebras with fast arithmetic, but restricted to weighted homogeneous elements, with positive integral degree weights.
</li><li>Degree-wise Gröbner basis computation for twosided weighted homogeneous ideals of free algebras. If a finite complete Gröbner basis exists, it can be computed.
</li><li>Normal form computation with respect to such ideals.
</li><li>Quotient rings of such ideals
</li></ul><p>
(Note that the original purpose was merely to compute Groebner bases up to a degree bound of two-sided ideals of free algebras, but without normal form computation etc.)
</p>
<p>
Examples are below, in the comments.
</p>
<p>
Apply
</p>
<p>
<a class="attachment" href="https://trac.sagemath.org/attachment/ticket/7797/trac7797-full_letterplace_wrapper_combined.patch" title="Attachment 'trac7797-full_letterplace_wrapper_combined.patch' in Ticket #7797">trac7797-full_letterplace_wrapper_combined.patch</a><a class="trac-rawlink" href="https://trac.sagemath.org/raw-attachment/ticket/7797/trac7797-full_letterplace_wrapper_combined.patch" title="Download"></a> and <a class="attachment" href="https://trac.sagemath.org/attachment/ticket/7797/trac_7797-ref.patch" title="Attachment 'trac_7797-ref.patch' in Ticket #7797">trac_7797-ref.patch</a><a class="trac-rawlink" href="https://trac.sagemath.org/raw-attachment/ticket/7797/trac_7797-ref.patch" title="Download"></a>
</p>
<p>
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a> <a class="closed ticket" href="https://trac.sagemath.org/ticket/11268" title="defect: singular_function should turn the Singular documentation into a block ... (closed: fixed)">#11268</a> <a class="closed ticket" href="https://trac.sagemath.org/ticket/12641" title="defect: magma_free interface is broken (closed: duplicate)">#12641</a> <a class="closed ticket" href="https://trac.sagemath.org/ticket/12749" title="enhancement: Raise algebras/free_algebra.py coverage to 100% (closed: fixed)">#12749</a>
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/7797
Trac 1.1.6burcinWed, 30 Dec 2009 21:46:39 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac_7797-letterplace_ring_hack.patch</em>
</li>
</ul>
<p>
hack to create an MPolynomialRing as a parent for letterplace polynomials
</p>
TicketburcinWed, 30 Dec 2009 21:47:33 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac_7797-letterplace.patch</em>
</li>
</ul>
<p>
basic interface to compute groebner bases with letterplace
</p>
TicketburcinWed, 30 Dec 2009 21:47:50 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:1
https://trac.sagemath.org/ticket/7797#comment:1
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
</ul>
TicketburcinMon, 12 Apr 2010 08:19:59 GMTdescription changed
https://trac.sagemath.org/ticket/7797#comment:2
https://trac.sagemath.org/ticket/7797#comment:2
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=2">diff</a>)
</li>
</ul>
TicketmalbThu, 03 Jun 2010 22:21:04 GMT
https://trac.sagemath.org/ticket/7797#comment:3
https://trac.sagemath.org/ticket/7797#comment:3
<p>
Doctest failure on sage.math:
</p>
<pre class="wiki">File "/mnt/usb1/scratch/malb/sage-4.4/devel/sage-main/sage/libs/singular/letterplace.py", line 32:
sage: freegb(l, 10)
Exception raised:
Traceback (most recent call last):
File "/mnt/usb1/scratch/malb/sage-4.4/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/mnt/usb1/scratch/malb/sage-4.4/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/mnt/usb1/scratch/malb/sage-4.4/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_1[5]>", line 1, in <module>
freegb(l, Integer(10))###line 32:
sage: freegb(l, 10)
File "/mnt/usb1/scratch/malb/sage-4.4/local/lib/python/site-packages/sage/libs/singular/letterplace.py", line 70, in freegb
libsingular_options(bck)
TypeError: 'sage.libs.singular.option.LibSingularOptions' object is not callable
</pre><p>
I think we used to allow calling libsingular option objects earlier, however load() replaces it.
</p>
TicketmalbThu, 24 Jun 2010 14:29:42 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:4
https://trac.sagemath.org/ticket/7797#comment:4
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
Actually, this doesn't make sense to me:
</p>
<div class="wiki-code"><div class="code"><pre>bck <span class="o">=</span> <span class="nb">int</span><span class="p">(</span>libsingular_options<span class="p">)</span>
<span class="c">#letter place needs these options</span>
libsingular_options<span class="p">[</span><span class="s">'redTail'</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
libsingular_options<span class="p">[</span><span class="s">'redSB'</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
libsingular_options<span class="p">(</span>bck<span class="p">)</span>
</pre></div></div><p>
First bck is stored and then options are changed. So far fine. However, then bck is loaded and thus overwrites the options just set.
</p>
TicketPolyBoRiWed, 30 Jun 2010 09:06:53 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac_7797-letterplace.2.patch</em>
</li>
</ul>
<p>
letter place singular interface
</p>
TicketPolyBoRiWed, 30 Jun 2010 09:07:40 GMT
https://trac.sagemath.org/ticket/7797#comment:5
https://trac.sagemath.org/ticket/7797#comment:5
<p>
Hi!
</p>
<p>
I have corrected that using the new context interface.
</p>
<p>
Cheers,
Michael
</p>
TicketPolyBoRiWed, 30 Jun 2010 09:07:47 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:6
https://trac.sagemath.org/ticket/7797#comment:6
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
TicketPolyBoRiWed, 30 Jun 2010 09:10:23 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac_7797-letterplace.3.patch</em>
</li>
</ul>
TicketmalbWed, 14 Jul 2010 22:24:34 GMT
https://trac.sagemath.org/ticket/7797#comment:7
https://trac.sagemath.org/ticket/7797#comment:7
<ul><li>While there are doctests, there is no documentation, no explanation what the functions are doing
</li><li>freegb should accept ideals (?)
</li><li>Why are you calling "singular_system"?
</li></ul>
TicketmalbWed, 14 Jul 2010 22:41:41 GMT
https://trac.sagemath.org/ticket/7797#comment:8
https://trac.sagemath.org/ticket/7797#comment:8
<pre class="wiki">File "/mnt/usb1/scratch/malb/sage-4.4/devel/sage-main/sage/libs/singular/letterplace.py", line 32:
sage: freegb(l, 10)
Expected:
[3*y*x*z^7*y + y*x*z^8, 3*y*x*z^6*y + y*x*z^7, y*x*z^6*x*z + 314928*y^2*x*z^2*x^5, 3*y*x*z^5*y + y*x*z^6, y*x*z^5*x*z - 17496*y^2*x*z^2*x^4, 3*y*x*z^4*y + y*x*z^5, y*x*z^4*x*z + 972*y^2*x*z^2*x^3, 3*y*x*z^4*x^2*z*y + y*x*z^4*x^2*z^2, 3*y*x*z^3*y + y*x*z^4, y*x*z^3*x*z - 54*y^2*x*z^2*x^2, 3*y*x*z^3*x^2*z^2*y + y*x*z^3*x^2*z^3, 3*y*x*z^3*x^2*z*y + y*x*z^3*x^2*z^2, 3*y*x*z^3*x^3*z*y + y*x*z^3*x^3*z^2, 3*y*x*z^2*y + y*x*z^3, y*x*z^2*x*z + 3*y^2*x*z^2*x, 3*y*x*z^2*x^2*z^3*y + y*x*z^2*x^2*z^4, 3*y*x*z^2*x^2*z^2*y + y*x*z^2*x^2*z^3, y*x*z^2*x^2*z^2*x*z + 3*y^2*x*z^2*x^2*z^2*x, 3*y*x*z^2*x^2*z*y + y*x*z^2*x^2*z^2, 3*y*x*z^2*x^3*z^2*y + y*x*z^2*x^3*z^3, 3*y*x*z^2*x^3*z*y + y*x*z^2*x^3*z^2, 3*y*x*z^2*x^4*z*y + y*x*z^2*x^4*z^2, 3*y*x*z*y + y*x*z^2, x*z*y^6*x*z - 7776*y*x*z^2*x^6, x*z*y^5*x*z - 1296*y*x*z^2*x^5, x*z*y^4*x*z - 216*y*x*z^2*x^4, x*z*y^3*x*z - 36*y*x*z^2*x^3, x*z*y^2*x*z - 6*y*x*z^2*x^2, x*z*y*x*z - y*x*z^2*x, 6*x*z*x - y*x*z, 3*x*y + x*z]
Got
[3*x*y + x*z, 6*x*z*x - y*x*z, 3*y*x*z*y + y*x*z^2, 3*y*x*z^2*y + y*x*z^3, x*z*y*x*z - y*x*z^2*x, 3*y*x*z^3*y + y*x*z^4, y*x*z^2*x*z + 3*y^2*x*z^2*x, x*z*y^2*x*z - 6*y*x*z^2*x^2, 3*y*x*z^4*y + y*x*z^5, y*x*z^3*x*z - 54*y^2*x*z^2*x^2, x*z*y^3*x*z - 36*y*x*z^2*x^3, 3*y*x*z^5*y + y*x*z^6, y*x*z^4*x*z + 972*y^2*x*z^2*x^3, 3*y*x*z^2*x^2*z*y + y*x*z^2*x^2*z^2, x*z*y^4*x*z - 216*y*x*z^2*x^4, 3*y*x*z^6*y + y*x*z^7, y*x*z^5*x*z - 17496*y^2*x*z^2*x^4, 3*y*x*z^3*x^2*z*y + y*x*z^3*x^2*z^2, 3*y*x*z^2*x^2*z^2*y + y*x*z^2*x^2*z^3, 3*y*x*z^2*x^3*z*y + y*x*z^2*x^3*z^2, x*z*y^5*x*z - 1296*y*x*z^2*x^5, 3*y*x*z^7*y + y*x*z^8, y*x*z^6*x*z + 314928*y^2*x*z^2*x^5, 3*y*x*z^4*x^2*z*y + y*x*z^4*x^2*z^2, 3*y*x*z^3*x^2*z^2*y + y*x*z^3*x^2*z^3, 3*y*x*z^3*x^3*z*y + y*x*z^3*x^3*z^2, 3*y*x*z^2*x^2*z^3*y + y*x*z^2*x^2*z^4, y*x*z^2*x^2*z^2*x*z + 3*y^2*x*z^2*x^2*z^2*x, 3*y*x*z^2*x^3*z^2*y + y*x*z^2*x^3*z^3, 3*y*x*z^2*x^4*z*y + y*x*z^2*x^4*z^2, x*z*y^6*x*z - 7776*y*x*z^2*x^6]
</pre><p>
This is with Singular 3-1-1-3 though.
</p>
TicketPolyBoRiThu, 15 Jul 2010 08:22:48 GMT
https://trac.sagemath.org/ticket/7797#comment:9
https://trac.sagemath.org/ticket/7797#comment:9
<p>
Aufruf von System ist offiziell, heißt aber nur, dass es nicht als extra Kommando eingebaut ist.
</p>
<p>
<a class="ext-link" href="http://www.singular.uni-kl.de/Manual/latest/sing_433.htm"><span class="icon"></span>http://www.singular.uni-kl.de/Manual/latest/sing_433.htm</a>
</p>
TicketPolyBoRiThu, 15 Jul 2010 08:25:19 GMT
https://trac.sagemath.org/ticket/7797#comment:10
https://trac.sagemath.org/ticket/7797#comment:10
<p>
sorry, for the language:
calling system is official. Using singular system was easier for the authors of freegb.
</p>
<p>
<a class="ext-link" href="http://www.singular.uni-kl.de/Manual/latest/sing_433.htm"><span class="icon"></span>http://www.singular.uni-kl.de/Manual/latest/sing_433.htm</a>
</p>
TicketPolyBoRiThu, 15 Jul 2010 08:42:31 GMT
https://trac.sagemath.org/ticket/7797#comment:11
https://trac.sagemath.org/ticket/7797#comment:11
<p>
the result seem to differ just in order.
</p>
<p>
What Ideal class is used for free algebras?
</p>
TicketPolyBoRiThu, 15 Jul 2010 13:21:24 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>plural_functions.patch</em>
</li>
</ul>
<p>
some improvements to plural interface, still not much working
</p>
TicketmalbThu, 15 Jul 2010 15:27:33 GMT
https://trac.sagemath.org/ticket/7797#comment:12
https://trac.sagemath.org/ticket/7797#comment:12
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:11" title="Comment 11">PolyBoRi</a>:
</p>
<blockquote class="citation">
<p>
the result seem to differ just in order. What Ideal class is used for free algebras?
</p>
</blockquote>
<p>
Apparently, we don't have one which works yet
</p>
<pre class="wiki">sage: P.<a,b,c> = FreeAlgebra(QQ,3)
sage: P
Free Algebra on 3 generators (a, b, c) over Rational Field
sage: P.ideal([a*b+c,a+1])
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/malb/<ipython console> in <module>()
/usr/local/sage-4.3/local/lib/python2.6/site-packages/sage/rings/ring.so in sage.rings.ring.Ring.ideal (sage/rings/ring.c:3426)()
/usr/local/sage-4.3/local/lib/python2.6/site-packages/sage/rings/ideal.pyc in Ideal(*args, **kwds)
187
188 if not commutative_ring.is_CommutativeRing(R):
--> 189 raise TypeError, "R must be a commutative ring"
190
191 if len(gens) == 0:
TypeError: R must be a commutative ring
</pre>
TicketSimonKingFri, 01 Oct 2010 19:17:24 GMT
https://trac.sagemath.org/ticket/7797#comment:13
https://trac.sagemath.org/ticket/7797#comment:13
<p>
Do I understand correctly that in this ticket it is <em>not</em> attempted to replace <code>FreeAlgebra</code> by a more efficient implementation based on Singular's Letterplace Algebra? This ticket is only about wrapping free Groebner bases, but not about wrapping the basic arithmetic?
</p>
<p>
What Sage currently does in free algebras is generic and slow. As pointed out on <a class="ext-link" href="http://groups.google.com/group/sage-devel/browse_thread/thread/ad16f4fbe4ab66f"><span class="icon"></span>sage-devel</a>, bot Singular and Gap are faster in basic arithmetic than the current implementation in Sage.
</p>
<p>
But this should be on a different ticket, right?
</p>
<p>
Best regards,
Simon
</p>
TicketAlexanderDreyerFri, 01 Oct 2010 20:19:41 GMT
https://trac.sagemath.org/ticket/7797#comment:14
https://trac.sagemath.org/ticket/7797#comment:14
<p>
As I understand, this makes the Singular's letterplace functionality accessible to Sage (in addition to the Plural functionality of <a class="closed ticket" href="https://trac.sagemath.org/ticket/4539" title="enhancement: plural wrapper (closed: fixed)">#4539</a>).
</p>
TicketburcinFri, 01 Oct 2010 20:28:46 GMT
https://trac.sagemath.org/ticket/7797#comment:15
https://trac.sagemath.org/ticket/7797#comment:15
<p>
This ticket is only about exposing the Groebner basis computation. We didn't think arithmetic was usable since
</p>
<ul><li>there is a degree bound, and
</li><li>it is a hack in Singular.
</li></ul><p>
If you think the arithmetic should be wrapped as well, that should be on a different ticket. I don't know how much the Plural wrapper (<a class="closed ticket" href="https://trac.sagemath.org/ticket/4539" title="enhancement: plural wrapper (closed: fixed)">#4539</a>) will help with that.
</p>
TicketSimonKingSat, 02 Oct 2010 07:41:50 GMT
https://trac.sagemath.org/ticket/7797#comment:16
https://trac.sagemath.org/ticket/7797#comment:16
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:14" title="Comment 14">AlexanderDreyer</a>:
</p>
<blockquote class="citation">
<p>
As I understand, this makes the Singular's letterplace functionality accessible to Sage (in addition to the Plural functionality of <a class="closed ticket" href="https://trac.sagemath.org/ticket/4539" title="enhancement: plural wrapper (closed: fixed)">#4539</a>).
</p>
</blockquote>
<p>
What is meant by "Letterplace functionality"? Is it "simply" computing Gröbner basis with degree bound in free associative algebras?
</p>
<p>
Something that irritates me (and I already asked in the Singular forum) is that I could not find a way to <em>apply</em> such Groebner basis, e.g., in order to compute a normal form of an element of the free associative algebra w.r.t. this Gröbner basis. Also I tend to call <em>basic arithmetic</em> a funtionality.
</p>
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:15" title="Comment 15">burcin</a>:
</p>
<blockquote class="citation">
<p>
This ticket is only about exposing the Groebner basis computation. We didn't think arithmetic was usable since
</p>
<ul><li>there is a degree bound, and
</li><li>it is a hack in Singular.
</li></ul><p>
If you think the arithmetic should be wrapped as well, that should be on a different ticket. I don't know how much the Plural wrapper (<a class="closed ticket" href="https://trac.sagemath.org/ticket/4539" title="enhancement: plural wrapper (closed: fixed)">#4539</a>) will help with that.
</p>
</blockquote>
<p>
OK. <em>If</em> I find the time, I'll finish the wrappers that I hacked together yesterday. The new ticket will then provide two alternative implementations of free (associative) algebras. One will be based on Gap, the other on Letterplace. The latter will be a hack as well: While doing arithmetic, the degree bound will be dynamically adapted. Currently I use Expect interfaces, but I guess using the Plural wrapper will improve things further.
</p>
<p>
Cheers,
Simon
</p>
TicketSimonKingThu, 17 Mar 2011 14:32:50 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:17
https://trac.sagemath.org/ticket/7797#comment:17
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
I tried to apply the patches - apparently it is
</p>
<p>
Apply trac_7797-letterplace_ring_hack.patch trac_7797-letterplace.3.patch plural_functions.patch
</p>
<p>
Correct?
</p>
<p>
Unfortunately, plural_functions.patch fails. Can you rebase it, please?
</p>
TicketSimonKingThu, 17 Mar 2011 14:36:38 GMTwork_issues set
https://trac.sagemath.org/ticket/7797#comment:18
https://trac.sagemath.org/ticket/7797#comment:18
<ul>
<li><strong>work_issues</strong>
set to <em>rebase, doctests</em>
</li>
</ul>
<p>
In addition, one doc test has a different result:
</p>
<pre class="wiki">sage: from sage.libs.singular.letterplace import freegb
sage: F.<x,y,z> = FreeAlgebra(QQ, 3); F
Free Algebra on 3 generators (x, y, z) over Rational Field
sage: l=[2*x*z*x+y*x*y, 3*x*y+x*z]
sage: freegb(l, 10)
[3*x*y + x*z, 6*x*z*x - y*x*z, 3*y*x*z*y + y*x*z^2, 3*y*x*z^2*y + y*x*z^3, x*z*y*x*z - y*x*z^2*x, 3*y*x*z^3*y + y*x*z^4, y*x*z^2*x*z + 3*y^2*x*z^2*x, x*z*y^2*x*z - 6*y*x*z^2*x^2, 3*y*x*z^4*y + y*x*z^5, y*x*z^3*x*z - 54*y^2*x*z^2*x^2, x*z*y^3*x*z - 36*y*x*z^2*x^3, 3*y*x*z^5*y + y*x*z^6, y*x*z^4*x*z + 972*y^2*x*z^2*x^3, 3*y*x*z^2*x^2*z*y + y*x*z^2*x^2*z^2, x*z*y^4*x*z - 216*y*x*z^2*x^4, 3*y*x*z^6*y + y*x*z^7, y*x*z^5*x*z - 17496*y^2*x*z^2*x^4, 3*y*x*z^3*x^2*z*y + y*x*z^3*x^2*z^2, 3*y*x*z^2*x^2*z^2*y + y*x*z^2*x^2*z^3, 3*y*x*z^2*x^3*z*y + y*x*z^2*x^3*z^2, x*z*y^5*x*z - 1296*y*x*z^2*x^5, 3*y*x*z^7*y + y*x*z^8, y*x*z^6*x*z + 314928*y^2*x*z^2*x^5, 3*y*x*z^4*x^2*z*y + y*x*z^4*x^2*z^2, 3*y*x*z^3*x^2*z^2*y + y*x*z^3*x^2*z^3, 3*y*x*z^3*x^3*z*y + y*x*z^3*x^3*z^2, 3*y*x*z^2*x^2*z^3*y + y*x*z^2*x^2*z^4, y*x*z^2*x^2*z^2*x*z + 3*y^2*x*z^2*x^2*z^2*x, 3*y*x*z^2*x^3*z^2*y + y*x*z^2*x^3*z^3, 3*y*x*z^2*x^4*z*y + y*x*z^2*x^4*z^2, x*z*y^6*x*z - 7776*y*x*z^2*x^6]
</pre><p>
Which one is correct?
</p>
TicketSimonKingSat, 19 Mar 2011 08:19:21 GMT
https://trac.sagemath.org/ticket/7797#comment:19
https://trac.sagemath.org/ticket/7797#comment:19
<p>
FYI: As I mentioned in an earlier post, just having a two-sided Gröbner basis is not enough for my envisioned applications. I also need a competitive arithmetic for free associative algebras, normal form computation, and, if possible, ideals in non-commutative rings, and ring quotients.
</p>
<p>
So, I implemented something from scratch, <em>not</em> based on the previous patches. I already got an implementation of free associative algebras based on letterplace (with a dynamic degree bound). For example, computing <code>(x+y)**20</code> is 84 times faster than with the old implementation of free algebras.
</p>
<p>
I also have a base class for left, right and twosided ideals: If R is any ring and L a list of elements, then R*L is a left ideal, L*R a right ideal, and R*L*R a twosided ideal.
</p>
<p>
Using freegb for the computation of a two-sided Gröbner basis will be straight forward. In addition, Grischa Studzinski and Viktor Levandoskyy provided me with some code for computing normal forms in free algebras, that is supposed to be in a future Singular release. My plan is to back-port it.
</p>
<p>
And then there's documentation to write...
</p>
TicketSimonKingThu, 24 Mar 2011 15:28:08 GMTdescription, author changed; work_issues deleted
https://trac.sagemath.org/ticket/7797#comment:20
https://trac.sagemath.org/ticket/7797#comment:20
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=20">diff</a>)
</li>
<li><strong>work_issues</strong>
<em>rebase, doctests</em> deleted
</li>
<li><strong>author</strong>
changed from <em>Michael Brickenstein, Burcin Erocal</em> to <em>Simon King, Michael Brickenstein, Burcin Erocal</em>
</li>
</ul>
TicketSimonKingThu, 24 Mar 2011 16:21:53 GMTsummary changed
https://trac.sagemath.org/ticket/7797#comment:21
https://trac.sagemath.org/ticket/7797#comment:21
<ul>
<li><strong>summary</strong>
changed from <em>basic interface to letterplace from singular</em> to <em>Full interface to letterplace from singular</em>
</li>
</ul>
<p>
I have attached a new patch that replaces all previous patches and provides a lot more functionality.
</p>
<p>
Since I learned much from the previous patches, I hesitate to remove Michael and Burcin from the author list. But perhaps you like to be referee? Then you should move your name into the reviewer field.
</p>
<p>
<strong><span class="underline">Technical Remarks</span></strong>
</p>
<p>
<code>singular_function</code> is very useful! However, it was impossible to simply call the <code>freegb.lib</code> library functions of Singular, since they rely on ring attributes -- but ring attributes have not been wrapped in <code>libSingular</code>.
</p>
<p>
Moreover, it is not a good idea to call the <code>makeLetterplaceRing</code> function from Singular and then transform the resulting <code>RingWrap</code> into a polynomial ring. It <em>is</em> possible -- but the result can not be pickled, since its variable names look like <code>x(1),y(1),x(2),y(2)</code> and are thus no valid identifiers.
</p>
<p>
But it is no problem to create another ring with more sober variable names, and apply the letterplace functions to it. One just needs to work around the attribute tests that these functions do. In fact, these functions do only one thing after the checking, namely a system call. So, I simply did this system calls as well.
</p>
<p>
In the current release, Singular does provide the Gröbner basis computations in free algebras, but it does <em>not</em> provide normal form computations. Grischa Studzinski has send me some code that is supposed to become part of <code>freegb.lib</code> -- again, I can not call it directly, but it was fairly straight forward to implement along the lines of Grischa's code.
</p>
<p>
<strong><span class="underline">New Features</span></strong>
</p>
<p>
<em><span class="underline">Free Algebra constructor as <code>UniqueFactory</code></span></em>
</p>
<p>
Up to now, the <code>FreeAlgebra</code> constructor was based on an incomplete way of caching: When you pickle and unpickle a free algebra, you would not get the same object.
</p>
<pre class="wiki"># old behaviour
sage: F.<a,b,c> = FreeAlgebra(QQ,3)
sage: loads(dumps(F)) is F
False
</pre><p>
This is now resolved. Moreover, it is not needed to explicitly provide the number of generators, when it is obvious from the list of names:
</p>
<pre class="wiki">sage: F.<x,y,z> = FreeAlgebra(QQ)
sage: loads(dumps(F)) is F
True
</pre><p>
I did one change that may be subject to criticism, and I wouldn't oppose to revert it. A free algebra in one generator is a polynomial ring. So, I return a polynomial ring:
</p>
<pre class="wiki">sage: FreeAlgebra(QQ,'x')
Univariate Polynomial Ring in x over Rational Field
</pre><p>
The constructor can now also be asked for a different implementation, as in all examples below.
</p>
<p>
<em><span class="underline">Free Algebra via Letterplace</span></em>
</p>
<p>
I provide a new implementation of free algebras. It can be constructed as follows:
</p>
<pre class="wiki">sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace')
sage: F
Free Associative Unital Algebra on 3 generators ('x', 'y', 'z') over Rational Field
</pre><p>
Due to some shortcomings of Singular's letterplace implementation, unfortunately we need to restrict to homogeneous elements:
</p>
<pre class="wiki">sage: (x+2*y)^2
x*x + 2*x*y + 2*y*x + 4*y*y
sage: x+0
x
Traceback (most recent call last):
...
ArithmeticError: Can only add elements of the same degree
</pre><p>
This is why the new implementation can not yet become the default.
</p>
<p>
However, the arithmetic in the new implementation is much faster than the old:
</p>
<pre class="wiki">sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace')
sage: F_old.<a,b,c> = FreeAlgebra(QQ)
sage: timeit('t=(x+y)^15')
5 loops, best of 3: 27.7 ms per loop
sage: timeit('t=(a+b)^15')
sage: %time t=(a+b)^15
CPU times: user 4.51 s, sys: 0.09 s, total: 4.60 s
Wall time: 6.46 s
sage: 4510/27.7
162.815884476534
sage: timeit('t=(x+y)^15')
25 loops, best of 3: 19.7 ms per loop
sage: %time t=(a+b)^15
CPU times: user 2.70 s, sys: 0.02 s, total: 2.72 s
Wall time: 2.73 s
sage: 2700/19.7
137.055837563452
</pre><p>
<em><span class="underline">One- and Twosided Ideals of Noncommutative Rings</span></em>
</p>
<p>
I implemented it in a fairly general way, ideals can be created for any ring:
</p>
<pre class="wiki">sage: A = SteenrodAlgebra(2)
sage: IL = A*[A.1+A.2,A.1^2]; IL
Left Ideal (Sq(2) + Sq(4), Sq(1,1)) of mod 2 Steenrod algebra
sage: IR = [A.1+A.2,A.1^2]*A; IR
Right Ideal (Sq(2) + Sq(4), Sq(1,1)) of mod 2 Steenrod algebra
sage: IT = A*[A.1+A.2,A.1^2]*A; IT
Twosided Ideal (Sq(2) + Sq(4), Sq(1,1)) of mod 2 Steenrod algebra
</pre><p>
Note some nastyness: The parent of an ideal still is the "monoid of ideals of a ring". But we actually have no multiplication in the non-commutative setting:
</p>
<pre class="wiki">sage: IL*IR
Traceback (most recent call last):
...
NotImplementedError: Can not multiply non-commutative ideals.
</pre><p>
Of course, in general, we have no way to solve the ideal containment problem. But in free algebras, we have letterplace:
</p>
<pre class="wiki">sage: I.groebner_basis(degbound=3)
Twosided Ideal (y*y*y - y*y*z + y*z*y - y*z*z, y*y*x + y*y*z + y*z*x + y*z*z, x*y + y*z, x*x - y*x - y*y - y*z) of Free Associative Unital Algebra on 3 generators ('x', 'y', 'z') over Rational Field
sage: (x*y*z*y*x).normal_form(I)
y*z*z*y*z + y*z*z*z*x + y*z*z*z*z
sage: x*y*z*y*x - (x*y*z*y*x).normal_form(I) in I
True
sage: x*I.0-I.1*y+I.0*y in I
True
sage: 1 in I
False
</pre><p>
<em><span class="underline">Quotient Rings</span></em>
</p>
<p>
Previously, quotient rings have only been available for rings that inherit from the base class of commutative rings. My patch makes them available for all rings, and actually it should work to some extent even for objects that belong to the category <code>Rings()</code> but do not inherit from <code>sage.rings.ring.Ring</code>.
</p>
<p>
The requirement is that we mod by an ideal <code>I</code> that is <em>twosided</em> and that has a method <code>I.reduce(x)</code> that returns a normal form of an element <code>x</code> with respect to <code>I</code>. That requirement holds for ideals of polynomial rings, and also for homogeneous ideals of free associative algebras. In particular:
</p>
<pre class="wiki">sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace')
sage: I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F
sage: Q.<a,b,c> = F.quo(I); Q
Quotient of Free Associative Unital Algebra on 3 generators ('x', 'y', 'z') over Rational Field by the ideal (x*y + y*z, x*x + x*y - y*x - y*y)
sage: a*b
-b*c
sage: a^3
-b*c*a - b*c*b - b*c*c
sage: J = Q*[a^3-b^3]*Q
sage: R.<i,j,k> = Q.quo(J); R
Quotient of Free Associative Unital Algebra on 3 generators ('x', 'y', 'z') over Rational Field by the ideal (-y*y*z - y*z*x - 2*y*z*z, x*y + y*z, x*x + x*y - y*x - y*y)
sage: i^3
-j*k*i - j*k*j - j*k*k
sage: j^3
-j*k*i - j*k*j - j*k*k
</pre><p>
One can also test if the quotient is commutative:
</p>
<pre class="wiki">sage: Q.is_commutative()
False
sage: J = F*[x*y-y*x,x*z-z*x,y*z-z*y,x^3-y^3]*F
sage: R = F.quo(J)
sage: R.is_commutative()
True
</pre><p>
<strong><span class="underline">Miscellaneous</span></strong>
</p>
<p>
I inserted the documentation of the new modules into the reference manual - I think it looks nice, but I guess a referee should double check.
</p>
<p>
Doc tests pass for me. Thus: Ready for review!!
</p>
TicketSimonKingThu, 24 Mar 2011 16:22:08 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:22
https://trac.sagemath.org/ticket/7797#comment:22
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
TicketSimonKingThu, 24 Mar 2011 16:26:07 GMT
https://trac.sagemath.org/ticket/7797#comment:23
https://trac.sagemath.org/ticket/7797#comment:23
<p>
I forgot one technical detail:
</p>
<p>
Not all rings inherit from the base class of rings. Examples are matrix algebras. In order to support non-commutative ideals for such rings, I provide the relevant methods as <code>ParentMethods</code> in the category of <code>Rings()</code>. Perhaps this duplication of code is considered a code smell.
</p>
<p>
At least, it enables the following:
</p>
<pre class="wiki">sage: MS = MatrixSpace(QQ,2,2)
sage: MS*[MS.1,2]
Left Ideal
(
[0 1]
[0 0],
[2 0]
[0 2]
)
of Full MatrixSpace of 2 by 2 dense matrices over Rational Field
</pre>
TicketSimonKingThu, 24 Mar 2011 16:28:56 GMT
https://trac.sagemath.org/ticket/7797#comment:24
https://trac.sagemath.org/ticket/7797#comment:24
<p>
Apparently the patchbot does not read the ticket description.
</p>
<p>
Apply trac7797-full_letterplace_wrapper.patch
</p>
TicketSimonKingThu, 24 Mar 2011 16:38:04 GMT
https://trac.sagemath.org/ticket/7797#comment:25
https://trac.sagemath.org/ticket/7797#comment:25
<p>
I realise that I made at least two copy-and-paste errors in the examples above: One of the "timeit" commands should be removed, and the ideals <code>I</code> always is the same, namely <code>I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F</code>.
</p>
<p>
Sorry, Simon
</p>
TicketjhpalmieriThu, 24 Mar 2011 19:25:46 GMTcc changed
https://trac.sagemath.org/ticket/7797#comment:26
https://trac.sagemath.org/ticket/7797#comment:26
<ul>
<li><strong>cc</strong>
<em>jhpalmieri</em> added
</li>
</ul>
TicketSimonKingFri, 25 Mar 2011 18:17:56 GMT
https://trac.sagemath.org/ticket/7797#comment:27
https://trac.sagemath.org/ticket/7797#comment:27
<p>
Anne Schilling reported a problem on sage-combinat-devel: The patch did apply, but "sage -br" did not work. I think I found the reason: The patch did not contain the empty <code>__init__.py</code> file in <code>sage/algebras/letterplace/</code>. Simply I forgot to add it.
</p>
<p>
I updated the patch, and now I hope it works. By the way, is the patchbot not working? I miss the coloured stamp on the ticket!
</p>
<p>
Apply trac7797-full_letterplace_wrapper.patch
</p>
TicketSimonKingSun, 27 Mar 2011 06:33:47 GMT
https://trac.sagemath.org/ticket/7797#comment:28
https://trac.sagemath.org/ticket/7797#comment:28
<p>
Currently, the Letterplace Gröbner bases can only be computed if the ring of coefficients is a field. I don't know whether this condition can be lifted and whether the Singular team is working on it.
</p>
<p>
That restriction <em>was</em> mentioned in the doc, but not very clearly, and the error message was obscure (namely, it came from the failing call to a Singular system function). There is now additional documentation of that restriction, and the error message is nicer.
</p>
<p>
Apply trac7797-full_letterplace_wrapper.patch
</p>
TicketnthierySun, 27 Mar 2011 07:39:00 GMTcc changed
https://trac.sagemath.org/ticket/7797#comment:29
https://trac.sagemath.org/ticket/7797#comment:29
<ul>
<li><strong>cc</strong>
<em>sage-combinat</em> added
</li>
</ul>
TicketnthierySun, 27 Mar 2011 07:55:52 GMT
https://trac.sagemath.org/ticket/7797#comment:30
https://trac.sagemath.org/ticket/7797#comment:30
<p>
Version rebased on top of <a class="closed ticket" href="https://trac.sagemath.org/ticket/10961" title="enhancement: Add Lie bracket operation in Rings() (closed: fixed)">#10961</a> available from:
</p>
<p>
<a class="ext-link" href="http://combinat.sagemath.org/patches/file/tip/trac7797-full_letterplace_wrapper.patch"><span class="icon"></span>http://combinat.sagemath.org/patches/file/tip/trac7797-full_letterplace_wrapper.patch</a>
</p>
TicketSimonKingSun, 27 Mar 2011 07:59:41 GMT
https://trac.sagemath.org/ticket/7797#comment:31
https://trac.sagemath.org/ticket/7797#comment:31
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:30" title="Comment 30">nthiery</a>:
</p>
<blockquote class="citation">
<p>
Version rebased on top of <a class="closed ticket" href="https://trac.sagemath.org/ticket/10961" title="enhancement: Add Lie bracket operation in Rings() (closed: fixed)">#10961</a> available from:
</p>
<p>
<a class="ext-link" href="http://combinat.sagemath.org/patches/file/tip/trac7797-full_letterplace_wrapper.patch"><span class="icon"></span>http://combinat.sagemath.org/patches/file/tip/trac7797-full_letterplace_wrapper.patch</a>
</p>
</blockquote>
<p>
Thank you!
</p>
<p>
What is the procedure? Shall I replace my patch with the rebased one and state the dependency (to the patchbot), or shall the rebased version remain on the combinat patch server?
</p>
<p>
Best regards,
Simon
</p>
TicketaschillingSun, 27 Mar 2011 08:10:27 GMT
https://trac.sagemath.org/ticket/7797#comment:32
https://trac.sagemath.org/ticket/7797#comment:32
<p>
This patch provides an interface to Singular, which gives a faster implementation of free algebras and adds new features such as for example quotients of free algebras (for terms of homogeneous degree). I have tested the quotient algebra features extensively and they seem to work great!
</p>
<p>
I do not feel qualified to do a technical review, but I am happy to give a positive review for the new features added.
</p>
<p>
Anne
</p>
TicketaschillingSun, 27 Mar 2011 08:12:55 GMT
https://trac.sagemath.org/ticket/7797#comment:33
https://trac.sagemath.org/ticket/7797#comment:33
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:31" title="Comment 31">SimonKing</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:30" title="Comment 30">nthiery</a>:
</p>
<blockquote class="citation">
<p>
Version rebased on top of <a class="closed ticket" href="https://trac.sagemath.org/ticket/10961" title="enhancement: Add Lie bracket operation in Rings() (closed: fixed)">#10961</a> available from:
</p>
<p>
<a class="ext-link" href="http://combinat.sagemath.org/patches/file/tip/trac7797-full_letterplace_wrapper.patch"><span class="icon"></span>http://combinat.sagemath.org/patches/file/tip/trac7797-full_letterplace_wrapper.patch</a>
</p>
</blockquote>
<p>
Thank you!
</p>
<p>
What is the procedure? Shall I replace my patch with the rebased one and state the dependency (to the patchbot), or shall the rebased version remain on the combinat patch server?
</p>
<p>
Best regards,
Simon
</p>
</blockquote>
<p>
Since <a class="closed ticket" href="https://trac.sagemath.org/ticket/10961" title="enhancement: Add Lie bracket operation in Rings() (closed: fixed)">#10961</a> hopefully gets merged soon, you should probably upload the rebased version on trac and add `Dependencies: <a class="closed ticket" href="https://trac.sagemath.org/ticket/10961" title="enhancement: Add Lie bracket operation in Rings() (closed: fixed)">#10961</a>' to the description. Then patchbot should in principle know!
</p>
TicketSimonKingSun, 27 Mar 2011 08:28:03 GMTdescription changed
https://trac.sagemath.org/ticket/7797#comment:34
https://trac.sagemath.org/ticket/7797#comment:34
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=34">diff</a>)
</li>
</ul>
<p>
For the patchbot:
</p>
<p>
Apply trac7797-full_letterplace_wrapper.patch
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/10961" title="enhancement: Add Lie bracket operation in Rings() (closed: fixed)">#10961</a>
</p>
TicketSimonKingSun, 27 Mar 2011 08:34:03 GMT
https://trac.sagemath.org/ticket/7797#comment:35
https://trac.sagemath.org/ticket/7797#comment:35
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:32" title="Comment 32">aschilling</a>:
</p>
<blockquote class="citation">
<p>
This patch provides an interface to Singular, which gives a faster implementation of free algebras and adds new features such as for example quotients of free algebras (for terms of homogeneous degree). I have tested the quotient algebra features extensively and they seem to work great!
</p>
</blockquote>
<p>
Good! I'll give that feedback to the Singular team as well.
</p>
<blockquote class="citation">
<p>
I do not feel qualified to do a technical review, but I am happy to give a positive review for the new features added.
</p>
</blockquote>
<p>
Thank you! There is at least one point that should probably be raised on sage-algebra: Is it acceptable that (with my patch) the <code>FreeAlgebra</code> constructor returns a polynomial ring when asked for a free algebra with only one generator?
</p>
<p>
Mathematically it is correct, but I wonder if that is acceptable in a CAS.
</p>
<p>
Simon
</p>
TicketSimonKingSun, 27 Mar 2011 09:32:21 GMTdescription changed
https://trac.sagemath.org/ticket/7797#comment:36
https://trac.sagemath.org/ticket/7797#comment:36
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=36">diff</a>)
</li>
</ul>
<p>
The new patch differs from the old one only in the comments.
</p>
<p>
Again for the patchbot:
</p>
<p>
Apply trac7797-full_letterplace_wrapper.patch
</p>
<p>
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/10961" title="enhancement: Add Lie bracket operation in Rings() (closed: fixed)">#10961</a>
</p>
TicketSimonKingSun, 27 Mar 2011 13:47:59 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac7797-full_letterplace_wrapper.patch</em>
</li>
</ul>
<p>
A full wrapper for Singular's letterplace functionality, plus non-commutative ideals and ring quotients; rebased on top of 10961
</p>
TicketSimonKingSun, 27 Mar 2011 13:53:16 GMT
https://trac.sagemath.org/ticket/7797#comment:37
https://trac.sagemath.org/ticket/7797#comment:37
<p>
I added an <code>__iter__</code> method for <code>FreeAlgebraElement_letterplace</code>, returning the list of pairs "exponent tuple, coefficient", and a method of <code>FreeAlgebra_letterplace</code> that returns an element, such that <code>F(dict(p))==p</code> for any element p of F. That has been requested by Nicolas.
</p>
<p>
For the patchbot:
</p>
<p>
Apply trac7797-full_letterplace_wrapper.patch
</p>
<p>
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/10961" title="enhancement: Add Lie bracket operation in Rings() (closed: fixed)">#10961</a>
</p>
TicketSimonKingSun, 27 Mar 2011 14:04:55 GMT
https://trac.sagemath.org/ticket/7797#comment:38
https://trac.sagemath.org/ticket/7797#comment:38
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:37" title="Comment 37">SimonKing</a>:
</p>
<blockquote class="citation">
<p>
...such that <code>F(dict(p))==p</code> for any element p of F.
</p>
</blockquote>
<p>
Sorry, I meant to write <code>p == F._from_dict_(dict(p))</code>.
</p>
TicketSimonKingMon, 28 Mar 2011 07:46:03 GMTstatus changed; reviewer set
https://trac.sagemath.org/ticket/7797#comment:39
https://trac.sagemath.org/ticket/7797#comment:39
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
<li><strong>reviewer</strong>
set to <em>split the ticket</em>
</li>
</ul>
<p>
It was suggested to split this ticket, and also it was suggested that the <code>FreeAlgebra</code> constructor always returns a free algebra, not a polynomial ring.
</p>
TicketSimonKingMon, 28 Mar 2011 14:01:45 GMTdescription changed; work_issues set; reviewer deleted
https://trac.sagemath.org/ticket/7797#comment:40
https://trac.sagemath.org/ticket/7797#comment:40
<ul>
<li><strong>reviewer</strong>
<em>split the ticket</em> deleted
</li>
<li><strong>work_issues</strong>
set to <em>Unigenerated free algebra vs. univariate polynomial ring</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=40">diff</a>)
</li>
</ul>
<p>
I managed to split my patch. The part concerning "basic implementation of ideals in non-commutative rings" is now at <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a>. The new patch is based on top of that.
</p>
<p>
<strong><span class="underline">TODO</span></strong>
</p>
<p>
Let the <code>FreeAlgebra</code> constructor always return a free algebra, not a polynomial ring.
</p>
<p>
<strong><span class="underline">New Feature</span></strong>
</p>
<p>
In addition to what was described in previous comments, my letterplace wrapper can compute <em>complete</em> twosided Gröbnerbases by an adaptive algorithm. The idea is simple: If the Gröbner basis is known out to degree <code>2*d-1</code>, but the highest degree of its generators is <code>d</code>, then the Gröbner basis is complete.
</p>
<p>
Example:
</p>
<pre class="wiki">sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace')
sage: I = F*[x*y-y*x,x*z-z*x,y*z-z*y,x^2*y-z^3,x*y^2+z*x^2]*F
sage: I.groebner_basis(Infinity)
Twosided Ideal (z*z*z*y*y + z*z*z*z*x, z*x*x*x + z*z*z*y, y*z - z*y, y*y*x + z*x*x, y*x*x - z*z*z, x*z - z*x, x*y - y*x) of Free Associative Unital Algebra on 3 generators ('x', 'y', 'z') over Rational Field
</pre><p>
Since the commutators are contained in the ideal, we can verify that result with a commutative Gröbner basis, as follows:
</p>
<pre class="wiki">sage: P.<c,b,a> = PolynomialRing(QQ,order='neglex')
sage: J = P*[a^2*b-c^3,a*b^2+c*a^2]
sage: J.groebner_basis()
[b*a^2 - c^3, b^2*a + c*a^2, c*a^3 + c^3*b, c^3*b^2 + c^4*a]
</pre><p>
So, that's a good consistency test.
</p>
<p>
Apply trac7797-full_letterplace_wrapper_rel11068.patch
</p>
<p>
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a>
</p>
TicketSimonKingFri, 01 Apr 2011 06:57:20 GMTwork_issues changed
https://trac.sagemath.org/ticket/7797#comment:41
https://trac.sagemath.org/ticket/7797#comment:41
<ul>
<li><strong>work_issues</strong>
changed from <em>Unigenerated free algebra vs. univariate polynomial ring</em> to <em>Unigenerated free algebra vs. univariate polynomial ring; refactoring of nc-ideals</em>
</li>
</ul>
<p>
I don't know why, but even though mercurial claims that it tracks <code>sage/algebras/letterplace/__init__.py</code>, it kept forgetting to include it into the patch. So, I decided to fill <code>__init__.py</code> with some comment. Now it should work.
</p>
<p>
Of course, you may play with the patch, but it still needs work. First of all, there is the issue that the free algebra constructor should never return a polynomial ring (in the univariate case). And then, my plan is to refactor things, such that there will also be dependencies with <a class="closed ticket" href="https://trac.sagemath.org/ticket/9138" title="defect: Categories for all rings (closed: fixed)">#9138</a> and <a class="closed ticket" href="https://trac.sagemath.org/ticket/9944" title="defect: categories for polynomial rings (closed: fixed)">#9944</a>.
</p>
<p>
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a>
</p>
<p>
Apply trac7797-full_letterplace_wrapper_rel11068.patch
</p>
TicketSimonKingWed, 27 Apr 2011 10:42:11 GMTstatus changed; work_issues deleted
https://trac.sagemath.org/ticket/7797#comment:42
https://trac.sagemath.org/ticket/7797#comment:42
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
<li><strong>work_issues</strong>
<em>Unigenerated free algebra vs. univariate polynomial ring; refactoring of nc-ideals</em> deleted
</li>
</ul>
<p>
I updated the patch.
</p>
<p>
Apply trac7797-full_letterplace_wrapper_rel11068.patch
</p>
<p>
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a>
</p>
<p>
Actually I am not sure about all dependencies. <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a> should be enough on top of sage-4.7.alpha5. However, here is a full account of the patches that I had applied to sage-4.7.alpha5 before creating the patch here: <a class="closed ticket" href="https://trac.sagemath.org/ticket/10296" title="enhancement: Singular interface wasting time by waiting for the prompt too often (closed: fixed)">#10296</a>, <a class="closed ticket" href="https://trac.sagemath.org/ticket/9944" title="defect: categories for polynomial rings (closed: fixed)">#9944</a>, <a class="closed ticket" href="https://trac.sagemath.org/ticket/9138" title="defect: Categories for all rings (closed: fixed)">#9138</a>, <a class="closed ticket" href="https://trac.sagemath.org/ticket/9976" title="enhancement: Decorated functions/methods have generic signature in documentation (closed: fixed)">#9976</a>, <a class="closed ticket" href="https://trac.sagemath.org/ticket/11115" title="enhancement: Rewrite cached_method in Cython (closed: fixed)">#11115</a>, <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a>.
</p>
<p>
In particular, I think the refactoring of rings, quotient rings and non-commutative ideals is successfully solved in <a class="closed ticket" href="https://trac.sagemath.org/ticket/9138" title="defect: Categories for all rings (closed: fixed)">#9138</a> and <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a>. Concerning unigenerated free algebras, it seems better to stay in the world of free algebras, rather than returning a polynomial ring. So, we have
</p>
<pre class="wiki">sage: F.<x> = FreeAlgebra(QQ)
sage: F
Free Algebra on 1 generators (x,) over Rational Field
sage: F.is_commutative()
True
sage: F.<x> = FreeAlgebra(QQ, implementation='letterplace')
sage: F
Free Associative Unital Algebra on 1 generators (x,) over Rational Field
sage: F.is_commutative()
True
</pre><p>
In principle, it could be reviewed now. But the patch chain in front of it is rather large, and not everything has a positive review, yet.
</p>
<p>
My next plan: Allow positive integer degree weights on the generators, extending the scope of the letterplace wrapper from homogeneous to weighted homogeneous elements, and allow degree-wise computation of weighted homogeneous Gröbner bases. Note that this goes beyond what is currently implemented in Singular, but it should work using a little hack (slack variables).
</p>
TicketSimonKingWed, 27 Apr 2011 12:21:13 GMT
https://trac.sagemath.org/ticket/7797#comment:43
https://trac.sagemath.org/ticket/7797#comment:43
<p>
Sorry, I needed to update the patch due to some outdated doc tests that I forgot to correct.
</p>
<p>
Apply trac7797-full_letterplace_wrapper_rel11068.patch
</p>
<p>
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a>
</p>
TicketSimonKingThu, 28 Apr 2011 11:34:52 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:44
https://trac.sagemath.org/ticket/7797#comment:44
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
I just found that the documentation (at least with <a class="closed ticket" href="https://trac.sagemath.org/ticket/9976" title="enhancement: Decorated functions/methods have generic signature in documentation (closed: fixed)">#9976</a> applied) is not good. Some stuff is included that certainly does not belong there.
</p>
TicketSimonKingThu, 28 Apr 2011 12:52:06 GMTstatus, description changed
https://trac.sagemath.org/ticket/7797#comment:45
https://trac.sagemath.org/ticket/7797#comment:45
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=45">diff</a>)
</li>
</ul>
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:44" title="Comment 44">SimonKing</a>:
</p>
<blockquote class="citation">
<p>
I just found that the documentation (at least with <a class="closed ticket" href="https://trac.sagemath.org/ticket/9976" title="enhancement: Decorated functions/methods have generic signature in documentation (closed: fixed)">#9976</a> applied) is not good. Some stuff is included that certainly does not belong there.
</p>
</blockquote>
<p>
Actually, on second thought, it belongs there: I am talking about the two singular_function instances included in the module. The main problem was that singular_function includes the documentation provided by Singular without taking care of formatting -- resulting in numerous errors (e.g., back ticks are misinterpreted as the beginning of Latex expressions, the indentation is handled differently, and so on).
</p>
<p>
In <a class="closed ticket" href="https://trac.sagemath.org/ticket/11268" title="defect: singular_function should turn the Singular documentation into a block ... (closed: fixed)">#11268</a>, I suggest to take care if it by turning the Singular documentation into a verbose code block. With that change, the documentation looks a lot better. I therefore make it a new dependency.
</p>
<p>
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a> <a class="closed ticket" href="https://trac.sagemath.org/ticket/11268" title="defect: singular_function should turn the Singular documentation into a block ... (closed: fixed)">#11268</a>
</p>
TicketSimonKingThu, 05 May 2011 18:55:19 GMTdependencies set
https://trac.sagemath.org/ticket/7797#comment:46
https://trac.sagemath.org/ticket/7797#comment:46
<ul>
<li><strong>dependencies</strong>
set to <em>#11068, #11268</em>
</li>
</ul>
TicketSimonKingThu, 26 May 2011 09:12:05 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac7797-letterplace_degree_weights.patch</em>
</li>
</ul>
<p>
Positive integral degree weights for letterplace. <a class="missing wiki">UniqueFactory?</a> for free algebras.
</p>
TicketSimonKingThu, 26 May 2011 09:31:57 GMTkeywords, description changed
https://trac.sagemath.org/ticket/7797#comment:47
https://trac.sagemath.org/ticket/7797#comment:47
<ul>
<li><strong>keywords</strong>
<em>free</em> <em>algebra</em> <em>letterplace</em> added
</li>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=47">diff</a>)
</li>
</ul>
<p>
Meanwhile I implemented two other features:
</p>
<p>
<strong>Uniqueness of parents</strong>
</p>
<p>
We had
</p>
<pre class="wiki">sage: F.<x,y,z> = FreeAlgebra(QQ, 3)
sage: loads(dumps(F)) is F
False
</pre><p>
I rewrote the <code>FreeAlgebra</code> constructor using <code>UniqueFactory</code>, so that the answer above becomes <code>True</code>.
</p>
<p>
<strong>Degree weights</strong>
</p>
<p>
The letterplace implementation in Singular is restricted to homogeneous ideals, and each generator can only have degree 1. With a little hack, I introduced positive integral degree weights for generators, so that we can now do:
</p>
<pre class="wiki">sage: F.<x,y,z> = FreeAlgebra(QQ, implementation='letterplace', degrees=[1,2,3])
sage: I = F*[x*y+z-y*x,x*y*z-x^6+y^3]*F
sage: I.groebner_basis(Infinity)
Twosided Ideal (x*z*z - y*x*x*z - y*x*y*y + y*x*z*x + y*y*y*x + z*x*z + z*y*y - z*z*x, x*y - y*x + z, x*x*x*x*z*y*y + x*x*x*z*y*y*x - x*x*x*z*y*z - x*x*z*y*x*z + x*x*z*y*y*x*x + x*x*z*y*y*y - x*x*z*y*z*x - x*z*y*x*x*z - x*z*y*x*z*x + x*z*y*y*x*x*x + 2*x*z*y*y*y*x - 2*x*z*y*y*z - x*z*y*z*x*x - x*z*y*z*y + y*x*z*x*x*x*x*x - 4*y*x*z*x*x*z - 4*y*x*z*x*z*x + 4*y*x*z*y*x*x*x + 3*y*x*z*y*y*x - 4*y*x*z*y*z + y*y*x*x*x*x*z + y*y*x*x*x*z*x - 3*y*y*x*x*z*x*x - y*y*x*x*z*y + 5*y*y*x*z*x*x*x + 4*y*y*x*z*y*x - 4*y*y*y*x*x*z + 4*y*y*y*x*z*x + 3*y*y*y*y*z + 4*y*y*y*z*x*x + 6*y*y*y*z*y + y*y*z*x*x*x*x + y*y*z*x*z + 7*y*y*z*y*x*x + 7*y*y*z*y*y - 7*y*y*z*z*x - y*z*x*x*x*z - y*z*x*x*z*x + 3*y*z*x*z*x*x + y*z*x*z*y + y*z*y*x*x*x*x - 3*y*z*y*x*z + 7*y*z*y*y*x*x + 3*y*z*y*y*y - 3*y*z*y*z*x - 5*y*z*z*x*x*x - 4*y*z*z*y*x + 4*y*z*z*z - z*y*x*x*x*z - z*y*x*x*z*x - z*y*x*z*x*x - z*y*x*z*y + z*y*y*x*x*x*x - 3*z*y*y*x*z + 3*z*y*y*y*x*x + z*y*y*y*y - 3*z*y*y*z*x - z*y*z*x*x*x - 2*z*y*z*y*x + 2*z*y*z*z - z*z*x*x*x*x*x + 4*z*z*x*x*z + 4*z*z*x*z*x - 4*z*z*y*x*x*x - 3*z*z*y*y*x + 4*z*z*y*z + 4*z*z*z*x*x + 2*z*z*z*y, x*x*x*x*x*z + x*x*x*x*z*x + x*x*x*z*x*x + x*x*z*x*x*x + x*z*x*x*x*x + y*x*z*y - y*y*x*z + y*z*z + z*x*x*x*x*x - z*z*y, x*x*x*x*x*x - y*x*z - y*y*y + z*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field
</pre><p>
This and the possibility to compute a complete Gröbner basis (provided a finite complete Gröbner basis exists) go beyond what is currently in Singular.
</p>
<p>
The underlying idea of the degree weights is: Introduce a homogenizing variable. By default, it is called <code>x</code>, but a different name is chosen if there is a name conflict. Here, it is renamed to <code>x_</code>. And then, we represent a generator <code>z</code> of degree <code>d</code> internally as <code>z*x_^(d-1)</code> (of course with non-commutative multiplication).
</p>
<p>
Hence, the underlying truncated letterplace ring becomes a bit bigger, and in the bigger ring all generators are of degree one. Of course, the additional variable is omitted in the string representation. We have for example
</p>
<pre class="wiki">sage: z
z
sage: z.degree()
3
sage: z.letterplace_polynomial()
z*x__1*x__2
</pre><p>
As much as I know, with that approach, Gröbner bases are correctly computed: If in all polynomials each occurrence of <code>z</code> is followed by <code>x_^(d-1)</code> then all S-polynomials and reductions (computed in the ring with additional generator <code>x_</code> and with all generators in degree 1) will have the same property.
</p>
<p>
I know this is a hack, but I guess it may be useful. It certainly will be usefull for my current project, because I <em>need</em> degree weights.
</p>
<p>
Apply trac7797-full_letterplace_wrapper_rel11068.patch trac7797-letterplace_degree_weights.patch
</p>
<p>
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a>, <a class="closed ticket" href="https://trac.sagemath.org/ticket/11268" title="defect: singular_function should turn the Singular documentation into a block ... (closed: fixed)">#11268</a>
</p>
TicketSimonKingThu, 26 May 2011 10:07:47 GMTdescription changed
https://trac.sagemath.org/ticket/7797#comment:48
https://trac.sagemath.org/ticket/7797#comment:48
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=48">diff</a>)
</li>
</ul>
<p>
I noticed that I forgot one detail: Latex!
</p>
<p>
With the latest patch, we also get
</p>
<pre class="wiki">sage: K.<z> = GF(25)
sage: F.<a,b,c> = FreeAlgebra(K, implementation='letterplace', degrees=[1,2,3])
sage: -(a*b*(z+1)-c)^2
(2*z + 1)*a*b*a*b + (z + 1)*a*b*c + (z + 1)*c*a*b - c*c
sage: latex(-(a*b*(z+1)-c)^2)
\left(2 z + 1\right) a b a b + \left(z + 1\right) a b c + \left(z + 1\right) c a b - c c
</pre><p>
Apply trac7797-full_letterplace_wrapper_rel11068.patch trac7797-letterplace_degree_weights.patch trac7797-latex_letterplace.patch
</p>
<p>
Depends on <a class="closed ticket" href="https://trac.sagemath.org/ticket/11068" title="enhancement: Basic implementation of one- and twosided ideals of non-commutative ... (closed: fixed)">#11068</a>, <a class="closed ticket" href="https://trac.sagemath.org/ticket/11268" title="defect: singular_function should turn the Singular documentation into a block ... (closed: fixed)">#11268</a>
</p>
TicketSimonKingThu, 26 May 2011 10:09:14 GMT
https://trac.sagemath.org/ticket/7797#comment:49
https://trac.sagemath.org/ticket/7797#comment:49
<p>
... or also
</p>
<pre class="wiki">sage: F.<bla,alpha,z> = FreeAlgebra(QQ, implementation='letterplace', degrees=[1,2,3])
sage: latex(-3*alpha*bla-z)
-3 \alpha \mbox{bla} - z
</pre>
TicketSimonKingThu, 26 May 2011 10:49:00 GMT
https://trac.sagemath.org/ticket/7797#comment:50
https://trac.sagemath.org/ticket/7797#comment:50
<p>
Odd. The documentation for letterplace used to build fine. But now, it does not build <em>at all</em>! The output are three empty html pages (empty except for the title and the navigation) - the doc strings do not appear.
</p>
<p>
Any idea where that might come from?
</p>
TicketSimonKingThu, 26 May 2011 13:04:59 GMTmilestone changed
https://trac.sagemath.org/ticket/7797#comment:51
https://trac.sagemath.org/ticket/7797#comment:51
<ul>
<li><strong>milestone</strong>
changed from <em>sage-4.7.1</em> to <em>sage-4.7</em>
</li>
</ul>
<p>
I don't know where it came from. But after deleting doc/output/html/en/reference and doc/output/doctrees/, building the documentation finally succeeded.
</p>
<p>
So, problem vanished.
</p>
TicketSimonKingFri, 27 May 2011 06:39:50 GMTmilestone changed
https://trac.sagemath.org/ticket/7797#comment:52
https://trac.sagemath.org/ticket/7797#comment:52
<ul>
<li><strong>milestone</strong>
changed from <em>sage-4.7</em> to <em>sage-4.7.1</em>
</li>
</ul>
<p>
Apparently I had changed the milestone by accident...
</p>
TicketSimonKingWed, 27 Jul 2011 15:43:52 GMTdescription changed
https://trac.sagemath.org/ticket/7797#comment:53
https://trac.sagemath.org/ticket/7797#comment:53
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=53">diff</a>)
</li>
</ul>
<p>
In my application, I also need conversion from graded sub-algebras. Hence, I implemented it in the new patch.
</p>
<p>
To be precise: If we have free graded algebras A and B in letterplace implementation, then there is a coercion from A to B if and only if there is a coercion from the base ring of A to the base ring of B, and the set of generator names of A is a subset of the generator names of B, and the degrees of equally named generators of A and B are equal.
</p>
<p>
The coercion is always name and degree preserving.
</p>
<p>
Example:
</p>
<pre class="wiki">sage: F.<t,y,z> = FreeAlgebra(ZZ, implementation='letterplace', degrees=[4,2,3])
sage: G = FreeAlgebra(GF(5), implementation='letterplace', names=['x','y','z','t'], degrees=[1,2,3,4])
sage: t*G.0 # indirect doctest
t*x
sage: (t*G.0 + G.1*G.2)*y
y*z*y + t*x*y
</pre><p>
Apply trac7797-full_letterplace_wrapper_rel11068.patch trac7797-letterplace_degree_weights.patch trac7797-latex_letterplace.patch trac7797-letterplace_coercion.patch
</p>
TicketSimonKingMon, 01 Aug 2011 16:37:37 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac7797-full_letterplace_wrapper_rel11068.patch</em>
</li>
</ul>
<p>
A full wrapper for Singular's letterplace functionality, plus complete Groebner bases; based on top of 11068
</p>
TicketSimonKingMon, 01 Aug 2011 16:45:29 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac7797-latex_letterplace.patch</em>
</li>
</ul>
<p>
Implement latex for letterplace polynomials and letterplace algebras
</p>
TicketSimonKingMon, 01 Aug 2011 16:47:10 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac7797-letterplace_coercion.patch</em>
</li>
</ul>
<p>
Implementing coercion for letterplace algebras
</p>
TicketSimonKingMon, 01 Aug 2011 16:48:22 GMT
https://trac.sagemath.org/ticket/7797#comment:54
https://trac.sagemath.org/ticket/7797#comment:54
<p>
I had to rebase three of the four patches. Still needing review...
</p>
<p>
Apply trac7797-full_letterplace_wrapper_rel11068.patch trac7797-letterplace_degree_weights.patch trac7797-latex_letterplace.patch trac7797-letterplace_coercion.patch
</p>
TicketfbisseyMon, 01 Aug 2011 21:54:05 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:55
https://trac.sagemath.org/ticket/7797#comment:55
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
In <a class="attachment" href="https://trac.sagemath.org/attachment/ticket/7797/trac7797-full_letterplace_wrapper_rel11068.patch" title="Attachment 'trac7797-full_letterplace_wrapper_rel11068.patch' in Ticket #7797">trac7797-full_letterplace_wrapper_rel11068.patch</a><a class="trac-rawlink" href="https://trac.sagemath.org/raw-attachment/ticket/7797/trac7797-full_letterplace_wrapper_rel11068.patch" title="Download"></a> please do not use SAGE_ROOT + local/include in module_list.py use SAGE_INC instead. I spent sometime cleaning all that up for 4.7.1 and would like to see it stay clean for a little while longer.
</p>
TicketSimonKingMon, 01 Aug 2011 23:35:36 GMT
https://trac.sagemath.org/ticket/7797#comment:56
https://trac.sagemath.org/ticket/7797#comment:56
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:55" title="Comment 55">fbissey</a>:
</p>
<blockquote class="citation">
<p>
In <a class="attachment" href="https://trac.sagemath.org/attachment/ticket/7797/trac7797-full_letterplace_wrapper_rel11068.patch" title="Attachment 'trac7797-full_letterplace_wrapper_rel11068.patch' in Ticket #7797">trac7797-full_letterplace_wrapper_rel11068.patch</a><a class="trac-rawlink" href="https://trac.sagemath.org/raw-attachment/ticket/7797/trac7797-full_letterplace_wrapper_rel11068.patch" title="Download"></a> please do not use SAGE_ROOT + local/include in module_list.py use SAGE_INC instead.
</p>
</blockquote>
<p>
I didn't know that SAGE_INC exists. It is certainly a good idea to use such variables whenever possible.
</p>
TicketSimonKingMon, 01 Aug 2011 23:58:51 GMTstatus, description changed
https://trac.sagemath.org/ticket/7797#comment:57
https://trac.sagemath.org/ticket/7797#comment:57
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=57">diff</a>)
</li>
</ul>
<p>
I'm now using SAGE_INC, and I used the occasion to create a combined patch.
Apply trac7797-full_letterplace_wrapper_combined.patch
</p>
TicketSimonKingMon, 15 Aug 2011 09:34:26 GMT
https://trac.sagemath.org/ticket/7797#comment:58
https://trac.sagemath.org/ticket/7797#comment:58
<p>
I had to rebase my patch: Some trivial changes in the doc tests were needed, since block orders are now displayed differently.
</p>
<p>
Apply trac7797-full_letterplace_wrapper_combined.patch
</p>
TicketAlexanderDreyerMon, 26 Sep 2011 20:50:15 GMTreviewer set; owner deleted
https://trac.sagemath.org/ticket/7797#comment:59
https://trac.sagemath.org/ticket/7797#comment:59
<ul>
<li><strong>owner</strong>
changed from <em>burcin</em> to <em>(none)</em>
</li>
<li><strong>reviewer</strong>
set to <em>Alexander Dreyer</em>
</li>
</ul>
<p>
sage-4.7.2alpha3-prerelease with the following patches applies:
</p>
<pre class="wiki">trac11815_format_must_preserve_embedding.patch
trac11115-cached_cython.patch
trac11115_cached_function_pickling.patch
trac11068_nc_ideals_and_quotients.patch
trac11068_quotient_ring_without_names.patch
trac11068_lifting_map.patch
trac7797-full_letterplace_wrapper_combined.patch
</pre><p>
compiles/installs and runs <code>sage -testall</code> successfully on a SuSE Enterprise 11.1.
This is close to a positive review, but I'll check out another platform before and have a look at the patch.
</p>
TicketAlexanderDreyerMon, 26 Sep 2011 20:51:30 GMTowner set
https://trac.sagemath.org/ticket/7797#comment:60
https://trac.sagemath.org/ticket/7797#comment:60
<ul>
<li><strong>owner</strong>
changed from <em>(none)</em> to <em>burcin</em>
</li>
</ul>
TicketAlexanderDreyerTue, 27 Sep 2011 20:23:18 GMTcc changed
https://trac.sagemath.org/ticket/7797#comment:61
https://trac.sagemath.org/ticket/7797#comment:61
<ul>
<li><strong>cc</strong>
<em>OleksandrMotsak</em> added
</li>
</ul>
<p>
Also compiles/installs and runs <code>sage -testall</code> successfully on Mac OSX ppc (32bit). So I can give a positive review for the technical part. Somebody needs to look for the Maths.
</p>
TicketSimonKingWed, 26 Oct 2011 18:59:04 GMTdependencies changed
https://trac.sagemath.org/ticket/7797#comment:62
https://trac.sagemath.org/ticket/7797#comment:62
<ul>
<li><strong>dependencies</strong>
changed from <em>#11068, #11268</em> to <em>#4539, #11268</em>
</li>
</ul>
<p>
I think it makes sense to use <a class="closed ticket" href="https://trac.sagemath.org/ticket/4539" title="enhancement: plural wrapper (closed: fixed)">#4539</a> (which already has a positive review, but is pending because of <a class="closed ticket" href="https://trac.sagemath.org/ticket/9138" title="defect: Categories for all rings (closed: fixed)">#9138</a>) as a dependency. I have updated the patch accordingly. The doc tests pass (at least on my machine).
</p>
TicketSimonKingWed, 26 Oct 2011 18:59:42 GMT
https://trac.sagemath.org/ticket/7797#comment:63
https://trac.sagemath.org/ticket/7797#comment:63
<p>
I forgot to notify the patch bot:
</p>
<p>
Apply trac7797-full_letterplace_wrapper_combined.patch
</p>
TicketdavidloefflerThu, 29 Mar 2012 11:55:25 GMTstatus, dependencies changed
https://trac.sagemath.org/ticket/7797#comment:64
https://trac.sagemath.org/ticket/7797#comment:64
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
<li><strong>dependencies</strong>
changed from <em>#4539, #11268</em> to <em>#4539, #11268, #12461</em>
</li>
</ul>
<p>
The patch fails to apply to 5.0.beta11 -- see patchbot logs. I suspect <a class="closed ticket" href="https://trac.sagemath.org/ticket/12461" title="enhancement: Replace some deprecated python functions in sage/algebras (closed: fixed)">#12461</a> is the cause.
</p>
TicketSimonKingFri, 30 Mar 2012 09:40:12 GMTstatus, description changed
https://trac.sagemath.org/ticket/7797#comment:65
https://trac.sagemath.org/ticket/7797#comment:65
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=65">diff</a>)
</li>
</ul>
<p>
Yes, <a class="closed ticket" href="https://trac.sagemath.org/ticket/12641" title="defect: magma_free interface is broken (closed: duplicate)">#12641</a> was to blame. The reason was that apparently <a class="closed ticket" href="https://trac.sagemath.org/ticket/12641" title="defect: magma_free interface is broken (closed: duplicate)">#12641</a> did remove four blank spaces. So, the change is trivial.
</p>
<p>
By the way: At the recent annual meeting of the German Science Foundation Priority Programme on computer algebra, I was talking to Viktor Levandovskii, who is responsible for Letterplace in Singular. He confirmed that my hacks for implementing degree weights and for computing complete Gröbner bases are correct.
</p>
<p>
Apply trac7797-full_letterplace_wrapper_combined.patch
</p>
TicketSimonKingSun, 15 Apr 2012 11:24:01 GMTstatus, dependencies changed; work_issues set
https://trac.sagemath.org/ticket/7797#comment:66
https://trac.sagemath.org/ticket/7797#comment:66
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
<li><strong>dependencies</strong>
changed from <em>#4539, #11268, #12461</em> to <em>#4539, #11268, #12461, #12749</em>
</li>
<li><strong>work_issues</strong>
set to <em>rebase rel #12749</em>
</li>
</ul>
<p>
It needs to be rebased wrt. <a class="closed ticket" href="https://trac.sagemath.org/ticket/12749" title="enhancement: Raise algebras/free_algebra.py coverage to 100% (closed: fixed)">#12749</a>: This ticket adds doctests, but one hunk for sage/algebras/free_algebra.py adds some doctest as well...
</p>
TicketSimonKingSun, 15 Apr 2012 11:30:41 GMTstatus, description changed; work_issues deleted
https://trac.sagemath.org/ticket/7797#comment:67
https://trac.sagemath.org/ticket/7797#comment:67
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
<li><strong>work_issues</strong>
<em>rebase rel #12749</em> deleted
</li>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=67">diff</a>)
</li>
</ul>
<p>
Done. And please please find someone for a review!
</p>
<p>
Apply trac7797-full_letterplace_wrapper_combined.patch
</p>
TicketSimonKingMon, 13 Aug 2012 13:17:01 GMT
https://trac.sagemath.org/ticket/7797#comment:68
https://trac.sagemath.org/ticket/7797#comment:68
<p>
It is now 4 months ago that I last asked if someone could review the patch, so that we would have Gröbner bases of two-sided homogeneous ideals in free associative algebras. Which other CAS has those? So: BUMP!
</p>
TicketSimonKingTue, 14 Aug 2012 12:39:34 GMTdependencies changed
https://trac.sagemath.org/ticket/7797#comment:69
https://trac.sagemath.org/ticket/7797#comment:69
<ul>
<li><strong>dependencies</strong>
changed from <em>#4539, #11268, #12461, #12749</em> to <em>#4539, #11268, #12461, #12749, #12988</em>
</li>
</ul>
<p>
I had to modify one doctest, due to a new test in the category of rings - see <a class="closed ticket" href="https://trac.sagemath.org/ticket/12988" title="enhancement: characteristic() should be an integer (closed: fixed)">#12988</a>.
</p>
<p>
Apply trac7797-full_letterplace_wrapper_combined.patch
</p>
TicketAlexanderDreyerTue, 14 Aug 2012 22:38:46 GMT
https://trac.sagemath.org/ticket/7797#comment:70
https://trac.sagemath.org/ticket/7797#comment:70
<p>
The patch looks good to me, just use the <code>:trac:`7791`</code> statement to refer to this ticket here. Provided, that the tests succeeds (I'm currently building a recent sage), I'd say, that we are close to positive.
</p>
TicketSimonKingWed, 15 Aug 2012 06:18:23 GMTstatus changed; work_issues set
https://trac.sagemath.org/ticket/7797#comment:71
https://trac.sagemath.org/ticket/7797#comment:71
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
<li><strong>work_issues</strong>
set to <em>trailing whitespace, use :trac:</em>
</li>
</ul>
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:70" title="Comment 70">AlexanderDreyer</a>:
</p>
<blockquote class="citation">
<p>
The patch looks good to me, just use the <code>:trac:`7791`</code> statement to refer to this ticket here. Provided, that the tests succeeds (I'm currently building a recent sage), I'd say, that we are close to positive.
</p>
</blockquote>
<p>
Yep, I think I wrote the patch before the <code>:trac:</code> directive has been introduced. The patchbot complains about trailing white space - so, I'll take care of that as well.
</p>
TicketSimonKingWed, 15 Aug 2012 06:56:29 GMTstatus changed; work_issues deleted
https://trac.sagemath.org/ticket/7797#comment:72
https://trac.sagemath.org/ticket/7797#comment:72
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
<li><strong>work_issues</strong>
<em>trailing whitespace, use :trac:</em> deleted
</li>
</ul>
<p>
Now it should be fine, regarding whitespace and regarding <code>:trac:</code> directive.
</p>
<p>
Apply trac7797-full_letterplace_wrapper_combined.patch
</p>
TicketAlexanderDreyerWed, 15 Aug 2012 07:13:43 GMT
https://trac.sagemath.org/ticket/7797#comment:73
https://trac.sagemath.org/ticket/7797#comment:73
<p>
The patch applies nicely to sage-5.3 beta1 and the rebuild of the sage library was successful. So let' s wait for <code>make ptestlong</code> to finish.
</p>
TicketAlexanderDreyerWed, 15 Aug 2012 11:30:38 GMTstatus, upstream changed
https://trac.sagemath.org/ticket/7797#comment:74
https://trac.sagemath.org/ticket/7797#comment:74
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
<li><strong>upstream</strong>
changed from <em>N/A</em> to <em>None of the above - read trac for reasoning.</em>
</li>
</ul>
<p>
Ok, <code>ptestlong</code> succeeded, so we ave a positive review!
</p>
TicketjdemeyerThu, 23 Aug 2012 12:46:23 GMTstatus changed; resolution, merged set
https://trac.sagemath.org/ticket/7797#comment:75
https://trac.sagemath.org/ticket/7797#comment:75
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>merged</strong>
set to <em>sage-5.3.rc0</em>
</li>
</ul>
TicketjdemeyerFri, 24 Aug 2012 20:24:40 GMTstatus changed; resolution, merged deleted
https://trac.sagemath.org/ticket/7797#comment:76
https://trac.sagemath.org/ticket/7797#comment:76
<ul>
<li><strong>status</strong>
changed from <em>closed</em> to <em>new</em>
</li>
<li><strong>resolution</strong>
<em>fixed</em> deleted
</li>
<li><strong>merged</strong>
<em>sage-5.3.rc0</em> deleted
</li>
</ul>
<p>
This leads to lots of failures on Solaris SPARC:
</p>
<pre class="wiki">
sage -t --long -force_lib devel/sage/sage/algebras/free_algebra.py # 3 doctests failed
sage -t --long -force_lib devel/sage/sage/algebras/letterplace/free_algebra_element_letterplace.pyx # 13 doctests failed
sage -t --long -force_lib devel/sage/sage/algebras/letterplace/free_algebra_letterplace.pyx # 6 doctests failed
sage -t --long -force_lib devel/sage/sage/algebras/letterplace/letterplace_ideal.pyx # 14 doctests failed
sage -t --long -force_lib devel/sage/sage/rings/quotient_ring.py # 11 doctests failed
sage -t --long -force_lib devel/sage/sage/rings/quotient_ring_element.py # 1 doctests failed
</pre><p>
See <a class="ext-link" href="http://build.sagemath.org/sage/builders/Skynet%20mark%20%28SunOS%205.10-32%29/builds/207/steps/shell_7/logs/stdio"><span class="icon"></span>http://build.sagemath.org/sage/builders/Skynet%20mark%20%28SunOS%205.10-32%29/builds/207/steps/shell_7/logs/stdio</a>.
</p>
TicketjdemeyerFri, 24 Aug 2012 20:24:53 GMTstatus, milestone changed
https://trac.sagemath.org/ticket/7797#comment:77
https://trac.sagemath.org/ticket/7797#comment:77
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>milestone</strong>
changed from <em>sage-5.3</em> to <em>sage-5.4</em>
</li>
</ul>
TicketjdemeyerFri, 24 Aug 2012 20:25:00 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:78
https://trac.sagemath.org/ticket/7797#comment:78
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
TicketSimonKingFri, 24 Aug 2012 22:41:03 GMT
https://trac.sagemath.org/ticket/7797#comment:79
https://trac.sagemath.org/ticket/7797#comment:79
<p>
I see that most (or all?) the errors reported in the log file occur while calling a singular_function. Is it perhaps the case that singular_function is generally problematic on Solaris SPARC?
</p>
<p>
Does Letterplace works on Solaris SPARC in Singular? I think I was told that Singular's system function could be a problem -- but Letterplace relies on it, both in Singular and here.
</p>
<p>
I.e., is the problem on the side of Singular, or of the wrapper?
</p>
TicketjdemeyerMon, 27 Aug 2012 11:21:30 GMTdependencies changed
https://trac.sagemath.org/ticket/7797#comment:80
https://trac.sagemath.org/ticket/7797#comment:80
<ul>
<li><strong>dependencies</strong>
changed from <em>#4539, #11268, #12461, #12749, #12988</em> to <em>#4539, #11268, #12461, #12749, #12988, #13237</em>
</li>
</ul>
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:79" title="Comment 79">SimonKing</a>:
</p>
<blockquote class="citation">
<p>
I.e., is the problem on the side of Singular, or of the wrapper?
</p>
</blockquote>
<p>
How can I check? What commands should I run in Singular to check?
</p>
<p>
Also, I added <a class="closed ticket" href="https://trac.sagemath.org/ticket/13237" title="enhancement: Upgrade Singular (closed: fixed)">#13237</a> (Upgrade to Singular-3-1-5) as dependency just in case it matters. My tests on Solaris SPARC were done with the new Singular from <a class="closed ticket" href="https://trac.sagemath.org/ticket/13237" title="enhancement: Upgrade Singular (closed: fixed)">#13237</a>.
</p>
TicketSimonKingTue, 28 Aug 2012 16:18:23 GMT
https://trac.sagemath.org/ticket/7797#comment:81
https://trac.sagemath.org/ticket/7797#comment:81
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:80" title="Comment 80">jdemeyer</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:79" title="Comment 79">SimonKing</a>:
</p>
<blockquote class="citation">
<p>
I.e., is the problem on the side of Singular, or of the wrapper?
</p>
</blockquote>
<p>
How can I check? What commands should I run in Singular to check?
</p>
<p>
Also, I added <a class="closed ticket" href="https://trac.sagemath.org/ticket/13237" title="enhancement: Upgrade Singular (closed: fixed)">#13237</a> (Upgrade to Singular-3-1-5) as dependency just in case it matters. My tests on Solaris SPARC were done with the new Singular from <a class="closed ticket" href="https://trac.sagemath.org/ticket/13237" title="enhancement: Upgrade Singular (closed: fixed)">#13237</a>.
</p>
</blockquote>
<p>
Hans Schönemann has tested it. He used Singular-3-1-5, or in more detail:
</p>
<pre class="wiki">Singular for SunOS-5 version 3-1-5 (3150) Aug 27 2012 19:23:52
with
factory(@(#) factoryVersion = 3.1.5),libfac(3.1.5,July 2012),
GMP(4.2),NTL(5.5.2),64bit,static readline,Plural,DBM,
dynamic modules,dynamic p_Procs,OM_CHECK=0,OM_TRACK=0,random=1346170574
CC= gcc -m64 -mptr64 -mcpu=ultrasparc3 -O2 -w -fomit-frame-pointer -pipe -DNDEBUG -DOM_NDEBUG -DSunOS_5 -DHAVE_CONFIG_H,
CXX= g++ -m64 -mptr64 -mcpu=ultrasparc3 -O2 -w -fomit-frame-pointer -I.. -I/users/cip/alggeom/hannes/galois64 -pipe -DNDEBUG -DOM_NDEBUG -DSunOS_5 -DHAVE_CONFIG_H (3.3.2)
</pre><p>
The example worked fine, which indicates that it is a problem with my wrapper. If you want to test it for yourself:
</p>
<pre class="wiki">LIB "freegb.lib";
ring r = 0,(x,y,z),dp;
int d =4; // degree bound
def R = makeLetterplaceRing(d);
setring R;
ideal I = x(1)*y(2) + y(1)*z(2), x(1)*x(2) + x(1)*y(2) - y(1)*x(2) - y(1)*y(2);
option(redSB); option(redTail);
ideal J = letplaceGBasis(I);
J;
</pre><p>
The expected result is
</p>
<pre class="wiki">==> J[1]=x(1)*y(2)+y(1)*z(2)
==> J[2]=x(1)*x(2)-y(1)*x(2)-y(1)*y(2)-y(1)*z(2)
==> J[3]=y(1)*y(2)*y(3)-y(1)*y(2)*z(3)+y(1)*z(2)*y(3)-y(1)*z(2)*z(3)
==> J[4]=y(1)*y(2)*x(3)+y(1)*y(2)*z(3)+y(1)*z(2)*x(3)+y(1)*z(2)*z(3)
==> J[5]=y(1)*z(2)*y(3)*y(4)-y(1)*z(2)*y(3)*z(4)+y(1)*z(2)*z(3)*y(4)-y(1)*z(2\
)*z(3)*z(4)
==> J[6]=y(1)*z(2)*y(3)*x(4)+y(1)*z(2)*y(3)*z(4)+y(1)*z(2)*z(3)*x(4)+y(1)*z(2\
)*z(3)*z(4)
==> J[7]=y(1)*y(2)*z(3)*y(4)-y(1)*y(2)*z(3)*z(4)+y(1)*z(2)*z(3)*y(4)-y(1)*z(2\
)*z(3)*z(4)
==> J[8]=y(1)*y(2)*z(3)*x(4)+y(1)*y(2)*z(3)*z(4)+y(1)*z(2)*z(3)*x(4)+y(1)*z(2\
)*z(3)*z(4)
</pre><p>
I will see whether <code>letplaceGBasis</code> does anything new - perhaps I can learn from it?
</p>
TicketSimonKingTue, 28 Aug 2012 16:26:01 GMT
https://trac.sagemath.org/ticket/7797#comment:82
https://trac.sagemath.org/ticket/7797#comment:82
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:81" title="Comment 81">SimonKing</a>:
</p>
<blockquote class="citation">
<p>
I will see whether <code>letplaceGBasis</code> does anything new - perhaps I can learn from it?
</p>
</blockquote>
<p>
No, the essential part is the same. Namely:
</p>
<pre class="wiki"> ideal J = system("freegb",I,uptodeg,lV);
</pre><p>
If I am not mistaken, it is the analogue of this command that fails in my code.
</p>
<p>
The question that I'd like to be answered is: Are calls to Singular's "system" function possible in Sage on Solaris SPARC? Could you please test the following in Sage on Solaris SPARC?
</p>
<pre class="wiki">sage: from sage.libs.singular.function import singular_function
sage: sing_system = singular_function("system")
sage: R.<x,y> = QQ[]
sage: sing_system("uname", ring=R)
'x86_64-Linux' # ok, the answer will be different on Solaris SPARC...
</pre>
TicketjdemeyerTue, 28 Aug 2012 17:11:25 GMT
https://trac.sagemath.org/ticket/7797#comment:83
https://trac.sagemath.org/ticket/7797#comment:83
<p>
Solaris SPARC, Sage 5.2 (i.e. Singular-3-1-3-3):
</p>
<pre class="wiki">----------------------------------------------------------------------
| Sage Version 5.2, Release Date: 2012-07-25 |
| Type "notebook()" for the browser-based notebook interface. |
| Type "help()" for help. |
----------------------------------------------------------------------
sage: sage.libs.singular.function.singular_function("system")("uname", ring=PolynomialRing(QQ,2,'x'))
// ** s_internalDelete: cannot delete type sqrfree(493)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/home/jdemeyer/mark/sage-5.2/<ipython console> in <module>()
/home/jdemeyer/mark/sage-5.2/local/lib/python2.7/site-packages/sage/libs/singular/function.so in sage.libs.singular.function.SingularFunction.__call__ (sage/libs/singular/function.cpp:11875)()
/home/jdemeyer/mark/sage-5.2/local/lib/python2.7/site-packages/sage/libs/singular/function.so in sage.libs.singular.function.call_function (sage/libs/singular/function.cpp:13425)()
RuntimeError: Error in Singular function call 'system':
system(`sqrfree`) failed
</pre>
TicketSimonKingTue, 28 Aug 2012 17:52:11 GMT
https://trac.sagemath.org/ticket/7797#comment:84
https://trac.sagemath.org/ticket/7797#comment:84
<p>
Thank you, Jeroen!
</p>
<p>
So, the bug is not in my wrapper, but in singular_function. And that error looks rather strange. I'll ask Hans, tomorrow.
</p>
<p>
Martin, do you have an idea where that error might come from?
</p>
TicketSimonKingWed, 29 Aug 2012 08:48:03 GMT
https://trac.sagemath.org/ticket/7797#comment:85
https://trac.sagemath.org/ticket/7797#comment:85
<p>
Here is the code for <code>system("uname")</code> (to be found in Singular/extra.cc):
</p>
<div class="wiki-code"><div class="code"><pre><span class="cm">/*==================== uname ==================================*/</span>
<span class="k">if</span><span class="p">(</span>strcmp<span class="p">(</span>sys_cmd<span class="p">,</span><span class="s">"uname"</span><span class="p">)</span><span class="o">==</span><span class="mi">0</span><span class="p">)</span>
<span class="p">{</span>
res<span class="o">-></span>rtyp<span class="o">=</span>STRING_CMD<span class="p">;</span>
res<span class="o">-></span>data <span class="o">=</span> omStrDup<span class="p">(</span>S_UNAME<span class="p">);</span>
<span class="k">return</span> FALSE<span class="p">;</span>
<span class="p">}</span>
</pre></div></div><p>
About <code>// ** s_internalDelete: cannot delete type sqrfree(493)</code>: According to Hans, 493 is the token for the command <code>sqrfree</code>, which is <em>not</em> a type but a command. Therefore deleting an object with 493's type is impossible. He doesn't understand how that happens here.
</p>
<p>
<code>res->data</code> is a C string, and <code>STRING_CMD</code> is the token 495, which stands for the type of a string (<code>char *</code>). Could Solares SPARC mistake 495 for 493??
</p>
TicketAlexanderDreyerWed, 29 Aug 2012 09:00:04 GMT
https://trac.sagemath.org/ticket/7797#comment:86
https://trac.sagemath.org/ticket/7797#comment:86
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:85" title="Comment 85">SimonKing</a>:
</p>
<blockquote class="citation">
<p>
<code>res->data</code> is a C string, and <code>STRING_CMD</code> is the token 495, which stands for the type of a string (<code>char *</code>). Could Solares SPARC mistake 495 for 493??
</p>
</blockquote>
<p>
There probably an outdated Singular/tok.h around. Tokens like INTMOD_CMD were added recently, so this would explain the shift in the enum.
</p>
TicketjdemeyerThu, 30 Aug 2012 20:06:14 GMTowner changed
https://trac.sagemath.org/ticket/7797#comment:87
https://trac.sagemath.org/ticket/7797#comment:87
<ul>
<li><strong>owner</strong>
changed from <em>burcin</em> to <em>jdemeyer</em>
</li>
</ul>
<p>
Okay, with a build from scratch:
</p>
<pre class="wiki">sage: sage.libs.singular.function.singular_function("system")("uname", ring=PolynomialRing(QQ,2,'x'))
'SunOS-5'
</pre><p>
So I probably messed up something last time (e.g. forget <code>sage -b</code>).
</p>
TicketjdemeyerThu, 30 Aug 2012 20:35:39 GMT
https://trac.sagemath.org/ticket/7797#comment:88
https://trac.sagemath.org/ticket/7797#comment:88
<p>
Strange. I applied the patch of this ticket again and get only one doctest failure now in <code>sage/algebras</code>:
</p>
<pre class="wiki">sage -t "devel/sage/sage/algebras/letterplace/free_algebra_letterplace.pyx"
**********************************************************************
File "/home/jdemeyer/mark/sage-5.4.beta0/devel/sage/sage/algebras/letterplace/free_algebra_letterplace.pyx", line 684:
sage: G = F._reductor_(I.gens(),3); G
Expected:
Ideal (x*y_1 + y*z_1, x_1*y_2 + y_1*z_2, x*x_1 + x*y_1 - y*x_1 - y*y_1, x_1*x_2 + x_1*y_2 - y_1*x_2 - y_1*y_2) of Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2, x_3, y_3, z_3 over Rational Field
Got:
Ideal (x*y_1 + y*z_1, x_1*y_2 + y_1*z_2, x*x_1 + x*y_1 - y*x_1 - y*y_1, x_1*x_2 + x_1*y_2 - y_1*x_2 - y_1*y_2) of Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2 over Rational Field
**********************************************************************
</pre><p>
This calls for some further investigation...
</p>
TicketSimonKingThu, 30 Aug 2012 20:45:26 GMT
https://trac.sagemath.org/ticket/7797#comment:89
https://trac.sagemath.org/ticket/7797#comment:89
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:88" title="Comment 88">jdemeyer</a>:
</p>
<blockquote class="citation">
<pre class="wiki">sage -t "devel/sage/sage/algebras/letterplace/free_algebra_letterplace.pyx"
**********************************************************************
File "/home/jdemeyer/mark/sage-5.4.beta0/devel/sage/sage/algebras/letterplace/free_algebra_letterplace.pyx", line 684:
sage: G = F._reductor_(I.gens(),3); G
Expected:
Ideal (x*y_1 + y*z_1, x_1*y_2 + y_1*z_2, x*x_1 + x*y_1 - y*x_1 - y*y_1, x_1*x_2 + x_1*y_2 - y_1*x_2 - y_1*y_2) of Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2, x_3, y_3, z_3 over Rational Field
Got:
Ideal (x*y_1 + y*z_1, x_1*y_2 + y_1*z_2, x*x_1 + x*y_1 - y*x_1 - y*y_1, x_1*x_2 + x_1*y_2 - y_1*x_2 - y_1*y_2) of Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2 over Rational Field
**********************************************************************
</pre><p>
This calls for some further investigation...
</p>
</blockquote>
<p>
That test is about an internally used method (note the underscores), and the output depends on a polynomial ring that is used to simulate computations in free associative algebras out to a certain degree. As you can see, the ideal we expect and the ideal we got are alike - only the polynomial rings differ.
</p>
<p>
The point is that the underlying polynomial ring can change during computations, and the free associative algebras are unique parents. Hence, if tests are executed in different order then it may very well be that the polynomial ring used behind the scenes is different. Only the final result (i.e., interpreted in the free associative algebra) is unique.
</p>
<p>
I suggest to modify that test (and perhaps others as well) as follows:
</p>
<pre class="wiki">> sage: G = F._reductor_(I.gens(),3); G
> Expected:
> Ideal (x*y_1 + y*z_1, x_1*y_2 + y_1*z_2, x*x_1 + x*y_1 - y*x_1 - y*y_1, x_1*x_2 + x_1*y_2 - y_1*x_2 - y_1*y_2) of Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2... over Rational Field
</pre><p>
The variables before the <code>...</code> are guaranteed to occur, and we don't know (and don't care) whether more variables appear behind the scenes.
</p>
<p>
Would you accept that solution?
</p>
TicketAlexanderDreyerThu, 30 Aug 2012 23:27:20 GMT
https://trac.sagemath.org/ticket/7797#comment:90
https://trac.sagemath.org/ticket/7797#comment:90
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:89" title="Comment 89">SimonKing</a>:
</p>
<blockquote class="citation">
<p>
I suggest to modify that test (and perhaps others as well) as follows:
</p>
<pre class="wiki">> sage: G = F._reductor_(I.gens(),3); G
> Expected:
> Ideal (x*y_1 + y*z_1, x_1*y_2 + y_1*z_2, x*x_1 + x*y_1 - y*x_1 - y*y_1, x_1*x_2 + x_1*y_2 - y_1*x_2 - y_1*y_2) of Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2... over Rational Field
</pre><p>
The variables before the <code>...</code> are guaranteed to occur, and we don't know (and don't care) whether more variables appear behind the scenes.
</p>
<p>
Would you accept that solution?
</p>
</blockquote>
<p>
Sounds reasonable to me. So I'd reestablished the positive review, if Jeroen likes is, too.
</p>
TicketjdemeyerFri, 31 Aug 2012 14:33:49 GMT
https://trac.sagemath.org/ticket/7797#comment:91
https://trac.sagemath.org/ticket/7797#comment:91
<p>
Good for me.
</p>
TicketSimonKingFri, 31 Aug 2012 14:45:09 GMT
https://trac.sagemath.org/ticket/7797#comment:92
https://trac.sagemath.org/ticket/7797#comment:92
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:91" title="Comment 91">jdemeyer</a>:
</p>
<blockquote class="citation">
<p>
Good for me.
</p>
</blockquote>
<p>
OK, then I'll prepare a patch. Probably not before Sunday, though...
</p>
TicketSimonKingSun, 02 Sep 2012 07:03:45 GMT
https://trac.sagemath.org/ticket/7797#comment:93
https://trac.sagemath.org/ticket/7797#comment:93
<p>
I have updated the patch, using an ellipse (...) in the failing test.
</p>
<p>
Apply trac7797-full_letterplace_wrapper_combined.patch
</p>
TicketSimonKingSun, 02 Sep 2012 07:04:39 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:94
https://trac.sagemath.org/ticket/7797#comment:94
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
TicketAlexanderDreyerFri, 07 Sep 2012 19:44:36 GMT
https://trac.sagemath.org/ticket/7797#comment:95
https://trac.sagemath.org/ticket/7797#comment:95
<p>
Hi, I can positively review for Linux. I don't get Sage 5.* compiled on Solaris. Are there any precompiled recent binaries around, maybe at *.washington.edu?
</p>
TicketjhpalmieriFri, 07 Sep 2012 20:21:22 GMT
https://trac.sagemath.org/ticket/7797#comment:96
https://trac.sagemath.org/ticket/7797#comment:96
<p>
Passes tests for me (I just tested the modified files, not the whole Sage library) on Mac OS X 10.7 and OpenSolaris. I'm working on Solaris, but the only Solaris machines I have access to are really slow.
</p>
<p>
By the way, can you explain the role of the new line 821 in <code>sage/structure/parent.pyx</code>?
</p>
TicketSimonKingFri, 07 Sep 2012 20:34:52 GMT
https://trac.sagemath.org/ticket/7797#comment:97
https://trac.sagemath.org/ticket/7797#comment:97
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:96" title="Comment 96">jhpalmieri</a>:
</p>
<blockquote class="citation">
<p>
By the way, can you explain the role of the new line 821 in <code>sage/structure/parent.pyx</code>?
</p>
</blockquote>
<p>
I guess the plan was to add a doc test, then I changed my mind and deleted the doctest incompletely. I guess that line can be removed (by a reviewer patch?).
</p>
TicketjhpalmieriFri, 07 Sep 2012 21:24:58 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac_7797-ref.patch</em>
</li>
</ul>
TicketjhpalmieriFri, 07 Sep 2012 21:25:26 GMTdescription changed
https://trac.sagemath.org/ticket/7797#comment:98
https://trac.sagemath.org/ticket/7797#comment:98
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/7797?action=diff&version=98">diff</a>)
</li>
</ul>
TicketjhpalmieriWed, 24 Oct 2012 15:01:33 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:99
https://trac.sagemath.org/ticket/7797#comment:99
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
</ul>
<p>
Tests pass on skynet machine mark.
</p>
TicketjdemeyerMon, 29 Oct 2012 21:29:18 GMTmilestone changed
https://trac.sagemath.org/ticket/7797#comment:100
https://trac.sagemath.org/ticket/7797#comment:100
<ul>
<li><strong>milestone</strong>
changed from <em>sage-5.4</em> to <em>sage-5.5</em>
</li>
</ul>
TicketjdemeyerTue, 30 Oct 2012 15:52:24 GMT
https://trac.sagemath.org/ticket/7797#comment:101
https://trac.sagemath.org/ticket/7797#comment:101
<p>
I'm getting (in a trial sage-5.5.beta1, so it includes many other tickets)
</p>
<pre class="wiki">sage -t -force_lib devel/sage/sage/algebras/letterplace/free_algebra_letterplace.pyx
**********************************************************************
File "/release/merger/sage-5.5.beta1/devel/sage-main/sage/algebras/letterplace/free_algebra_letterplace.pyx", line 684:
sage: G = F._reductor_(I.gens(),3); G
Expected:
Ideal (x*y_1 + y*z_1, x_1*y_2 + y_1*z_2, x*x_1 + x*y_1 - y*x_1 - y*y_1, x_1*x_2 + x_1*y_2 - y_1*x_2 - y_1*y_2) of Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2, x_3, y_3, z_3... over Rational Field
Got:
Ideal (x*y_1 + y*z_1, x_1*y_2 + y_1*z_2, x*x_1 + x*y_1 - y*x_1 - y*y_1, x_1*x_2 + x_1*y_2 - y_1*x_2 - y_1*y_2) of Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2 over Rational Field
**********************************************************************
</pre>
TicketjdemeyerTue, 30 Oct 2012 15:57:17 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:102
https://trac.sagemath.org/ticket/7797#comment:102
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>needs_work</em>
</li>
</ul>
TicketSimonKingTue, 30 Oct 2012 16:00:41 GMT
https://trac.sagemath.org/ticket/7797#comment:103
https://trac.sagemath.org/ticket/7797#comment:103
<p>
I think we have already discussed that the order of doctests may influence the size of the polynomial ring used to represent the letterplace elements.
</p>
<p>
So, the fix should be to have <code>Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2... over Rational Field</code>. I'll do so (hopefully) soonish.
</p>
TicketjdemeyerTue, 30 Oct 2012 16:31:32 GMT
https://trac.sagemath.org/ticket/7797#comment:104
https://trac.sagemath.org/ticket/7797#comment:104
<p>
Doctest error confirmed with (unreleased but essentially ready) sage-5.5.beta0, but not with sage-5.4.rc2.
</p>
TicketSimonKingFri, 09 Nov 2012 10:16:51 GMTattachment set
https://trac.sagemath.org/ticket/7797
https://trac.sagemath.org/ticket/7797
<ul>
<li><strong>attachment</strong>
set to <em>trac7797-full_letterplace_wrapper_combined.patch</em>
</li>
</ul>
<p>
A full wrapper for Singular's letterplace functionality, plus positive integral degree weights, plus complete Groebner bases of weighted homogeneous two-sided ideals, plus coercion. Rel <a class="closed ticket" href="https://trac.sagemath.org/ticket/12988" title="enhancement: characteristic() should be an integer (closed: fixed)">#12988</a>
</p>
TicketSimonKingFri, 09 Nov 2012 10:20:36 GMTstatus changed
https://trac.sagemath.org/ticket/7797#comment:105
https://trac.sagemath.org/ticket/7797#comment:105
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>positive_review</em>
</li>
</ul>
<p>
I am sorry that I took so long to fix it.
</p>
<p>
I have changed the "big" patch. The diff of the two patch versions is:
</p>
<div class="wiki-code"><div xmlns="http://www.w3.org/1999/xhtml" class="diff">
<ul class="entries">
<li class="entry">
<h2>
<a>trac7797-full_letterplace_wrapper_combined.patch</a>
</h2>
<table class="trac-diff inline" summary="Differences" cellspacing="0">
<colgroup><col class="lineno" /><col class="lineno" /><col class="content" /></colgroup>
<thead>
<tr>
<th title="File trac7797-full_letterplace_wrapper_combined.patch 2012-11-09 11:15:19.355793326 +0100">
</th>
<th title="File trac7797-full_letterplace_wrapper_combined.patch 2012-09-02 09:00:20.000000000 +0200">
</th>
<td><em></em> </td>
</tr>
</thead>
<tbody class="unmod">
<tr>
<th>2176</th><th>2176</th><td class="l"><span>+ sage: p.reduce(I)</span></td>
</tr><tr>
<th>2177</th><th>2177</th><td class="l"><span>+ y*y*y - y*y*z + y*z*y - y*z*z</span></td>
</tr><tr>
<th>2178</th><th>2178</th><td class="l"><span>+ sage: G = F._reductor_(I.gens(),3); G</span></td>
</tr>
</tbody><tbody class="mod">
<tr class="first">
<th>2179</th><th> </th><td class="l"><span>+ Ideal (x*y_1 + y*z_1, x_1*y_2 + y_1*z_2, x*x_1 + x*y_1 - y*x_1 - y*y_1, x_1*x_2 + x_1*y_2 - y_1*x_2 - y_1*y_2) of Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2<del></del>... over Rational Field</span></td>
</tr>
<tr class="last">
<th> </th><th>2179</th><td class="r"><span>+ Ideal (x*y_1 + y*z_1, x_1*y_2 + y_1*z_2, x*x_1 + x*y_1 - y*x_1 - y*y_1, x_1*x_2 + x_1*y_2 - y_1*x_2 - y_1*y_2) of Multivariate Polynomial Ring in x, y, z, x_1, y_1, z_1, x_2, y_2, z_2<ins>, x_3, y_3, z_3</ins>... over Rational Field</span></td>
</tr>
</tbody><tbody class="unmod">
<tr>
<th>2180</th><th>2180</th><td class="l"><span>+</span></td>
</tr><tr>
<th>2181</th><th>2181</th><td class="l"><span>+ We do not use the usual reduction method for polynomials in</span></td>
</tr><tr>
<th>2182</th><th>2182</th><td class="l"><span>+ Sage, since it does the reductions in a different order</span></td>
</tr>
</tbody>
</table>
</li>
</ul>
</div></div><p>
I hope it is ok to restore the positive review, since I assume doctests will be run anyway before releasing.
</p>
<p>
Apply trac7797-full_letterplace_wrapper_combined.patch trac_7797-ref.patch
</p>
TicketAlexanderDreyerFri, 09 Nov 2012 11:49:57 GMT
https://trac.sagemath.org/ticket/7797#comment:106
https://trac.sagemath.org/ticket/7797#comment:106
<p>
Just realized, that I'm the reviewer: I'm fine with reestablishing to positive review.
</p>
TicketjdemeyerFri, 16 Nov 2012 21:25:01 GMTstatus changed; resolution, merged set
https://trac.sagemath.org/ticket/7797#comment:107
https://trac.sagemath.org/ticket/7797#comment:107
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
<li><strong>merged</strong>
set to <em>sage-5.5.beta2</em>
</li>
</ul>
TicketkcrismanWed, 05 Dec 2012 19:37:59 GMT
https://trac.sagemath.org/ticket/7797#comment:108
https://trac.sagemath.org/ticket/7797#comment:108
<p>
See <a class="closed ticket" href="https://trac.sagemath.org/ticket/13802" title="defect: Extra includes needed for letterplace for Cygwin on XP (closed: fixed)">#13802</a> for a problem this causes on Cygwin, though it looks like the fix is easy. I'd appreciate knowing whether it's okay to add <code>libraries=singular_libs</code> or whether that would cause problems; I think I <em>have</em> to add <code>SAGE_INC + 'factory'</code>.
</p>
TicketAlexanderDreyerWed, 05 Dec 2012 21:51:21 GMT
https://trac.sagemath.org/ticket/7797#comment:109
https://trac.sagemath.org/ticket/7797#comment:109
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:108" title="Comment 108">kcrisman</a>:
</p>
<blockquote class="citation">
<p>
See <a class="closed ticket" href="https://trac.sagemath.org/ticket/13802" title="defect: Extra includes needed for letterplace for Cygwin on XP (closed: fixed)">#13802</a> for a problem this causes on Cygwin, though it looks like the fix is easy. I'd appreciate knowing whether it's okay to add <code>libraries=singular_libs</code> or whether that would cause problems; I think I <em>have</em> to add <code>SAGE_INC + 'factory'</code>.
</p>
</blockquote>
<p>
Indeed, looking at the other singular-based modules it makes sense. I don't expect problems doing so.
</p>
TicketkcrismanWed, 05 Dec 2012 22:08:26 GMT
https://trac.sagemath.org/ticket/7797#comment:110
https://trac.sagemath.org/ticket/7797#comment:110
<blockquote class="citation">
<blockquote class="citation">
<p>
See <a class="closed ticket" href="https://trac.sagemath.org/ticket/13802" title="defect: Extra includes needed for letterplace for Cygwin on XP (closed: fixed)">#13802</a> for a problem this causes on Cygwin, though it looks like the fix is easy. I'd appreciate knowing whether it's okay to add <code>libraries=singular_libs</code> or whether that would cause problems; I think I <em>have</em> to add <code>SAGE_INC + 'factory'</code>.
</p>
</blockquote>
<p>
Indeed, looking at the other singular-based modules it makes sense. I don't expect problems doing so.
</p>
</blockquote>
<p>
Great, can you give some feedback on the patch at <a class="closed ticket" href="https://trac.sagemath.org/ticket/13802" title="defect: Extra includes needed for letterplace for Cygwin on XP (closed: fixed)">#13802</a> then? Thanks!
</p>
TicketAlexanderDreyerThu, 06 Dec 2012 08:38:18 GMT
https://trac.sagemath.org/ticket/7797#comment:111
https://trac.sagemath.org/ticket/7797#comment:111
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/7797#comment:110" title="Comment 110">kcrisman</a>:
</p>
<blockquote class="citation">
<p>
Great, can you give some feedback on the patch at <a class="closed ticket" href="https://trac.sagemath.org/ticket/13802" title="defect: Extra includes needed for letterplace for Cygwin on XP (closed: fixed)">#13802</a> then? Thanks!
</p>
</blockquote>
<p>
Very well, I was able to positively review that patch.
</p>
TicketkcrismanThu, 06 Dec 2012 15:15:02 GMT
https://trac.sagemath.org/ticket/7797#comment:112
https://trac.sagemath.org/ticket/7797#comment:112
<blockquote class="citation">
<blockquote class="citation">
<p>
Great, can you give some feedback on the patch at <a class="closed ticket" href="https://trac.sagemath.org/ticket/13802" title="defect: Extra includes needed for letterplace for Cygwin on XP (closed: fixed)">#13802</a> then? Thanks!
</p>
</blockquote>
<p>
Very well, I was able to positively review that patch.
</p>
</blockquote>
<p>
Very helpful, thank you.
</p>
Ticket