algorithms icon indicating copy to clipboard operation
algorithms copied to clipboard

[Smith normal form] wrong calculation

Open MartinThoma opened this issue 12 years ago • 3 comments

Enter the 2x2 matrix

[[3, 13], [16, 34]]

Your script will give B = [[1, 0], [0,4]] S = {{0,1},{1,-3}} A = {{3,13},{16,34}} T = {{0,1},{1,-3}}

But B != SAT!

See http://www.wolframalpha.com/input/?i=%7B%7B0%2C1%7D%2C%7B1%2C-3%7D%7D*%7B%7B3%2C13%7D%2C%7B16%2C34%7D%7D*%7B%7B0%2C1%7D%2C%7B1%2C-3%7D%7D

MartinThoma avatar Sep 02 '13 08:09 MartinThoma

Another testcase (from "2009 Zahlentheorie Klausur.pdf", Aufgabe 3):

[[-5,5,-50],[-10,5,45],[10,-5,-30]]

should give (for matrix B)

[[5,0,0],[0,5,0],[0,0,15]]

By the way, you can create random testcases like this:

  1. Get a correct implementation for calculating determinants
  2. fill matrix A with random integer entries
  3. calculate det(A)
  4. check if product elementary divisors = det(A)

MartinThoma avatar Sep 02 '13 09:09 MartinThoma

Added this testcase. @MartinThoma do you want to write a fix?

schickling avatar Sep 02 '13 09:09 schickling

Not at the moment. (I still have a lot of exams which I didn't try)

MartinThoma avatar Sep 02 '13 10:09 MartinThoma