Opened 13 years ago

Closed 12 years ago

#233 closed bug (fixed)

Nasty bug in noncomm multiplication

Reported by: levandov Owned by: Oleksandr
Priority: major Milestone: 3-1-2 and higher
Component: singular-kernel Version: 3-1-1
Keywords: noncommutative; multiplication Cc:

Description

Dear colleagues,

Daniel Andres (my student at RWTH Aachen) has detected a nasty bug in the non-commutative multiplication.

The code is simple as follows:

ring r = 0,(x,y),dp; matrix D[2][2]; D[1,2] = y^2;
def R = nc_algebra(1,D); setring R; R;
y^5*x^5;

one gets

SIGSEGV, Segmentation fault.

0x0050e004 in gnc_uu_Mult_ww_vert (i=2, a=5, j=1, b=5, r=0x7fec1784)

at gring.cc:1029

1029 MATELEM(cMT,a,m) = nc_p_CopyPut(t,r);

I traced the problem back to the following:
after the execution of the line ( in gring.cc)

1028          t = gnc_p_Mult_mm(t,x,r);

the matrix cMT, which [i,j]-th entry carries the product yi*xj, will be corrupted. This happens for i=5 and j=4 and, funny enough, not before[[BR]]

gnc_p_Mult_mm invokes the new code by Alex Motsak, so I invite Alex to analyze what is going wrong there and why at some place the matrix cMT gets deleted...

I've tried this example with Singular versions back to 3-0-3, it is always there :-(((

With best regards, Viktor

Attachments (1)

gring.patch (2.1 KB) - added by Oleksandr 12 years ago.
my patch for fixing this bug

Download all attachments as: .zip

Change History (2)

comment:1 Changed 12 years ago by Oleksandr

Resolution: fixed
Status: newclosed

Bug was ALWAYS present due to the following premature optimization in nc_uu_Mult_ww_vert from gring.cc:

  matrix cMT=r->nc->MT[UPMATELEM(j,i,rN)];         /* cMT=current MT */

since nc_mm_Mult_p/nc_p_Mult_mm can change the non-commutative-ring-wide cache MT.

Last edited 12 years ago by Oleksandr (previous) (diff)

Changed 12 years ago by Oleksandr

Attachment: gring.patch added

my patch for fixing this bug

Note: See TracTickets for help on using tickets.