Permalink
Browse files

Don't choose contig specialization for broadcasting operations known …

…at compile time
  • Loading branch information...
1 parent c4e72cf commit e86e5aabd62c2eee346a3f004e719c92e828546a @markflorisson committed Jun 17, 2012
Showing with 8 additions and 6 deletions.
  1. +3 −1 Cython/Compiler/Vector.py
  2. +1 −1 Cython/minivect
  3. +4 −4 tests/run/elementwise.pyx
@@ -309,7 +309,9 @@ def analyse_types(self, env):
self.is_temp = True
def generate_result_code(self, code):
- code.putln("%s = 0;" % self.result())
+ broadcasting = miniutils.any(op.type.ndim != self.max_ndim
+ for op in self.operands)
+ code.putln("%s = %d;" % (self.result(), broadcasting))
if self.init_shape:
for i in range(self.dst_slice.type.ndim):
@@ -216,8 +216,8 @@ def test_broadcasting(fused_dtype_t[:] m1, fused_dtype_t[:, :] m2):
testcase(test_broadcasting)
-#def test_broadcasting_c_contig(fused_dtype_t[::1] m1, fused_dtype_t[:, ::1] m2):
-# m2[...] = m2 + m1
-# return np.asarray(m2)
+def test_broadcasting_c_contig(fused_dtype_t[::1] m1, fused_dtype_t[:, ::1] m2):
+ m2[...] = m2 + m1
+ return np.asarray(m2)
-#testcase_like(test_broadcasting)(test_broadcasting_c_contig)
+testcase_like(test_broadcasting)(test_broadcasting_c_contig)

0 comments on commit e86e5aa

Please sign in to comment.