BIDData / BIDMat

A CPU and GPU-accelerated matrix library for data mining
BSD 3-Clause "New" or "Revised" License
265 stars 73 forks source link

Possible bug in tileMult #41

Closed kjameslubin closed 9 years ago

kjameslubin commented 9 years ago

Notice that the first two multiplications match, but the last is off by a uniform factor of three. Could easily be my mistake or some peculiarity of my local configuration.

Trace:

scala> val c = GMat(bernrnd(0.3,6,6) : FMat)
c: BIDMat.GMat =
   0   0   0   1   1   0
   0   0   1   0   0   0
   0   1   0   1   1   1
   1   0   0   0   0   0
   0   1   1   1   0   0
  ..  ..  ..  ..  ..  ..

scala> val s = GSMat(sparse(bernrnd(0.3,6,6)) : SMat)
s: BIDMat.GSMat =
(   2,   0)   1
(   3,   0)   1
(   1,   1)   1
(   3,   1)   1
(   4,   1)   1
(   5,   1)   1
(   2,   2)   1
(   5,   2)   1
  ...  ...  ...

scala> c*s
res18: BIDMat.GMat =
   1   2   0   2   1   0
   1   0   1   1   1   0
   1   4   1   3   2   1
   0   0   0   0   1   0
   2   2   1   2   2   0
  ..  ..  ..  ..  ..  ..

scala> full(s)
res19: BIDMat.GMat =
   0   0   0   0   1   0
   0   1   0   0   0   0
   1   0   1   1   1   0
   1   1   0   1   1   0
   0   1   0   1   0   0
  ..  ..  ..  ..  ..  ..

scala> c*full(s)
res20: BIDMat.GMat =
   1   2   0   2   1   0
   1   0   1   1   1   0
   1   4   1   3   2   1
   0   0   0   0   1   0
   2   2   1   2   2   0
  ..  ..  ..  ..  ..  ..

scala> c.tileMult(c.nrows, s.ncols, s.ncols, 0,0,s,0,0,GMat(FMat.zeros(6,6)),0,0)
res21: BIDMat.GMat =
   3   6   0   6   3   0
   3   0   3   3   3   0
   3  12   3   9   6   3
   0   0   0   0   3   0
   6   6   3   6   6   0
  ..  ..  ..  ..  ..  ..
jcanny commented 9 years ago

Yes, there was a problem in the native GPU code. It should be fixed now. I'll leave this open, but please check and close it if its OK.

kjameslubin commented 9 years ago

Tested it, looks fixed to me