[SciPy-dev] _cs_matrix._matvec()
Robert Cimrman
cimrman3 at ntc.zcu.cz
Mon Sep 10 04:07:17 EDT 2007
hi again,
looking at _cs_matrix class in sparse.py, I noticed
def _matvec(self, other, fn):
if isdense(other):
# This check is too harsh -- it prevents a column vector from
# being created on-the-fly like dense matrix objects can.
#if len(other) != self.shape[1]:
# raise ValueError, "dimension mismatch"
oth = numpy.ravel(other)
y = fn(self.shape[0], self.shape[1], \
self.indptr, self.indices, self.data, oth)
if isinstance(other, matrix):
y = asmatrix(y)
if other.ndim == 2 and other.shape[1] == 1:
# If 'other' was an (nx1) column vector, transpose the
result
# to obtain an (mx1) column vector.
y = y.T
return y
I do not see a reason for the commenting out of the lines
#if len(other) != self.shape[1]:
# raise ValueError, "dimension mismatch"
as the function silently passes with wrong input.
Could anybody explain this? I would uncomment the lines, but maybe there
is a reason...
r.
More information about the SciPy-Dev
mailing list