提交 3b831aab authored 作者: James Bergstra's avatar James Bergstra

added a little tweak to make csc_dot faster

上级 b29c6fbd
...@@ -942,9 +942,18 @@ class StructuredDotCSC(gof.Op): ...@@ -942,9 +942,18 @@ class StructuredDotCSC(gof.Op):
{PyErr_SetString(PyExc_NotImplementedError, "illegal row index in a"); %(fail)s;} {PyErr_SetString(PyExc_NotImplementedError, "illegal row index in a"); %(fail)s;}
// loop over final dimension (cols of dense matrix) and perform dot product // loop over final dimension (cols of dense matrix) and perform dot product
for(npy_int32 n = 0; n < N; ++n) if ((Szn == 1) && (Sbn == 1)) {
for(npy_int32 n = 0; n < N; ++n)
{
zm[n] += Amk * bk[n];
}
}
else
{ {
zm[n*Szn] += Amk * bk[n*Sbn]; for(npy_int32 n = 0; n < N; ++n)
{
zm[n*Szn] += Amk * bk[n*Sbn];
}
} }
} }
} }
...@@ -954,7 +963,7 @@ class StructuredDotCSC(gof.Op): ...@@ -954,7 +963,7 @@ class StructuredDotCSC(gof.Op):
return rval return rval
def c_code_cache_version(self): def c_code_cache_version(self):
return (1,) return (2,)
sd_csc = StructuredDotCSC() sd_csc = StructuredDotCSC()
class StructuredDotCSR(gof.Op): class StructuredDotCSR(gof.Op):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论