Bugs Göttingen2011

From Macaulay2
Jump to: navigation, search

// applied to List

If L = {2,4,8} then L/2 returns a list of rationals {1,2,4} but L//2 doesn't work -- it should be the same as apply(L, i-> i//2)

Okay, we've added this to the trunk, and also for i%2. Also works for ring elements. -- Dan

Bugs with ker

Bug 1

Macaulay2, version 1.4.0.1
with packages: ConwayPolynomials, Elimination, IntegralClosure, LLLBases,
               PrimaryDecomposition, ReesAlgebra, TangentCone

i1 : B = QQ[] --B = QQ also gets an error, though less spectacular

o1 = B

o1 : PolynomialRing

i2 : A = QQ[x]

o2 = A

o2 : PolynomialRing

i3 : f = map(B,A,matrix({{0_B}}))

o3 = map(B,A,{0})

o3 : RingMap B <--- A

i4 : g = map(B^1,A^1,f,matrix({{1_B}}))

o4 = | 1 |

             1       1
o4 : Matrix B  <--- A

i5 : ker g
-- SIGSEGV
-- stack trace, pid 4785:
level 0 -- return addr: 0x08065e95 -- frame: 0xb61a4df8
level 1 -- return addr: 0xb7fe1400 -- frame: 0xb61a4e18
... (continues to level 39)

Fixed, new behavior:


ii16 : B = QQ[]

oo16 = B

oo16 : PolynomialRing

ii17 : A = QQ[x]

oo17 = A

oo17 : PolynomialRing

ii18 : f = map(B,A,matrix({{0_B}}))

oo18 = map(B,A,{0})

oo18 : RingMap B <--- A

ii19 : g = map(B^1,A^1,f,matrix({{1_B}}))

oo19 = | 1 |

               1       1
oo19 : Matrix B  <--- A

ii20 : ker g

oo20 = image | x |

                               1
oo20 : A-module, submodule of A

Bug 2

B = QQ[]
S = B[]
A = B[y]/ideal(y^3)
f = map(S,A,matrix({{0_S}}))
g = map(S^1,A^1,f,matrix({{1_S}}))
ker g

Output: 0, which is not the kernel of this map!:

i6 : ker g
o6 = image 0
o6 : A-module, submodule of A^1

Fixed, new answer:

ii14 : ker g

oo14 = image | y |

                               1
oo14 : A-module, submodule of A

clean on MutableMatrix

i12 : A = new MutableMatrix from matrix{{1_RR}}

o12 = | 1 |

o12 : MutableMatrix

i13 : clean(0.1,A)
stdio:13:1:(3): error: unknown engine error

Inverting complex matrices (sometimes freezes!)

i1 : R = CC; inverse map(R^1,R^1,(i,j)->random R)      
-- warning: experimental computation over inexact field begun
--          results not reliable (one warning given per session)

o2 = | .819187-.5071i |

                1          1
o2 : Matrix CC    <--- CC
              53         53

i3 : R = CC; inverse map(R^2,R^2,(i,j)->random R) -- freezes! 

GB computation is not thread-safe

If two threads try to compute a GB of the same ideal at the same time, then M2 crashes. A demo is to be found in bugs.m2 in the parallel directory.

Bugs in Polyhedra

Note: If one uses the certified version 1.0.5 these bugs won't appear, since they are produced by method added in version 1.1.

minkowskiSum

i1 : loadPackage "Polyhedra"

o1 = Polyhedra

o1 : Package

i2 : p = convexHull transpose matrix {{1,0,0,0,0}};

i3 : p1 = convexHull transpose matrix {{0,0,0,0,0},{0,-1,0,0,0}};

i4 : p2 = convexHull transpose matrix {{0,0,0,0,0},{0,0,-1,0,0}};

i5 : p3 = convexHull transpose matrix {{0,0,0,0,0},{0,0,0,-1,0}};

i6 : p4 = convexHull transpose matrix {{0,0,0,0,0},{0,0,0,0,-1}};

i7 : p = minkowskiSum(p,p1);

i8 : numColumns vertices p

o8 = 2

i9 : p = minkowskiSum(p,p2);

i10 : numColumns vertices p

o10 = 4

i11 : p = minkowskiSum(p,p3);

i12 : numColumns vertices p

o12 = 2

i13 : p = minkowskiSum(p,p4);

i14 : numColumns vertices p

o14 = 0

Since all the involved polytopes are bounded, the number of vertices of the appearing minkowski sums can never decrease. This is a bug. At the end of newMinkSum(...) the method fMReplacement(...) is called. One can check that when the decreasing of the number of vertices starts fMReplacement(...) gets called with wrong input. It seems like the part of newMinkSum(...) determining the halfspaces bounding the minkowski sum is giving wrong results. _FIXED_

Additionally some other fixes have to be done, the uniqueColumns(...) method defined at the beginning of newMinkSum(...) has to be replaced by the following code to make the dimensions agree even if all the columns are zero:

uniqueColumns := M -> (
	  if M!=0 then matrix{(unique apply(numColumns M, i -> M_{i}))} else map(ZZ^(numRows M),ZZ^0,0)
	  );

and in the lines after determining HS one has to replace the two lines starting with R:= with the following lines:

R := promote(rays P | rays Q,QQ) | map(target promote(V,QQ),QQ^1,0);
V = (map(QQ^1,source promote(V,QQ),(i,j)->1) || promote(V,QQ)) | (map(QQ^1,source R,0) || R);

since V is a ZZ-matrix.

mixedVolume

i1 : loadPackage "Polyhedra";

i2 : P = hypercube 3;

i3 : mixedVolume {P,P,P}
stdio:3:1:(3): error: matrix concat: row sizes are not equal

toField, isField

The documentation could accentuate that the ring is just considered to be a field, even when its not. And that afterwards the command isField gives true even when the ring is not a field. Names are a bit misleading.

"==" does not work for Set

error: no method for binary operator == applied to objects:

cancelTask

i1 : t1=createTask(()->(sleep 2; 1))

o1 = <<task, created>>

o1 : Thread

i2 : schedule t1; cancelTask t1

i4 : sleep 3

o4 = 0

i5 : isReady t1

o5 = false

i6 : taskResult t1     
stdio:5:1:(3): error: thread not done yet

Join option for tensor and multigraded rings

Currently the Join => false option for tensoring two multigraded rings does not work, even if the rings have the same degreeLength.

addStartTask

Probably this is not a bug, but I thought that addStartTask should be some kind of "or" dependency. If two tasks t1,t2 are linked to a third one t3 by addStartTask then t3 is scheduled as soon as one of the tasks, t1 say, finishes. However, when t2 finishes there is an error message:

i1 : allowableThreads=3

o1 = 3

i2 : -- some simple tasks
     t0=createTask( ()->(sleep 1))

o2 = <<task, created>>

o2 : Thread

i3 : t1=createTask( ()->(sleep 1))

o3 = <<task, created>>

o3 : Thread

i4 : t2=createTask( ()->(sleep 5))

o4 = <<task, created>>

o4 : Thread

i5 : t3=createTask( ()->(sleep 2))

o5 = <<task, created>>

o5 : Thread

i6 : addStartTask(t0,t1); -- schedule t1 as soon as t0 has finished

i7 : addStartTask(t0,t2); -- schedule t2 as soon as t0 has finished

i8 : addStartTask(t1,t3); -- schedule t3 as soon as t1 has finished

i9 : addStartTask(t2,t3); -- schedule t3 as soon as t2 has finished

i10 : -- schedule the first task and check all other tasks:
      schedule t0; scan(7,i->(print (i,apply({t0,t1,t2,t3}, t-> isReady(t))); sleep 1));
(0, {false, false, false, false})
(1, {false, false, false, false})
(2, {true, true, false, false})
(3, {true, true, false, false})
(4, {true, true, false, true})
(5, {true, true, false, true})
{*dummy position*} error: expected a function
(6, {true, true, true, true})

Return to the Main Göttingen2011 page