iating a new Vector instance is cheaper?
Now I can add more unit tests.
Cheers,
-Basilisk96
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
print traces, I can
see it's called every time an array is modified in any way i.e.,
reshaped, transposed, etc., and also during operations like u+v, u-v,
A*u. But it's not called during the call to numpy.cross. Why?
Cheers,
-Basilisk96
___
Nu
ses the first condition: isinstance(other,(N.ndarray)) is true;
and so the return value becomes a matrix.
Bummer.
Do I also need to override a few overloaded methods like __mul__,
__rmul__, etc. to make this work?
Cheers,
-Basilisk96
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
things like:
>>> from vector import Vector
>>> u = Vector('1 2 3')
>>> v = Vector('3 2 1')
>>> w = u.cross(v)
>>> print w
(-4.0, +8.0, -4.0)
>>> alpha = u.angle(w)
>>> print alph
)
ret.Format = FMT_VECTOR_DEFAULT
return ret
def __str__(self):
fmt = getattr(self, "Format", FMT_VECTOR_DEFAULT)
fmt = ', '.join([fmt]*3)
return ''.join(["(", fmt, ")"]) % (self.X, self.Y, self
-0.5, 0.5],
[-0.5, -0.5, 0.5, 0.5]])
Any suggestions on how to improve my code?
Is this a Unicode issue, numpy issue, or both?
The input string can come from an ASCII file or a GUI text control. In
the case of a GUI, the control returns a Unicode string, so for now I
am casting it to str(), but it seems like a hack..
BTW, the reason that I am using the astype() method of numpy.matrix is
that I get a "ValueError: setting an array element with a sequence"
when trying to use
return numpy.mat(data, numpy.float64)
in the above function.
Thank you,
-Basilisk96
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion