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 y^{i*x}j, 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)

**Note:**See TracTickets for help on using tickets.

Bug was

ALWAYSpresent due to the following premature optimization innc_uu_Mult_ww_vertfromgring.cc:since

nc_mm_Mult_p/nc_p_Mult_mmcan change the non-commutative-ring-wide cacheMT.