Cast problems .... doo dah, doo dah

Sept. 25, 2002
1:24 p.m.
The following code produces an error --------------------------------------- a=array(([1,2,3,4,5],[10,9,8,7,6])).astype(Float32) cond=array(([0,0,0,0,0],[1,1,1,1,1]) b=array(([0,0,0,0,0],[0,0,0,0,0])) choose(cond,(a,b)) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: Array can not be safely cast to required type ------------------------------ I suppose I might need to cast b to Float32. But, I have a function which is passed a and b as args. Ideally, I would like a function which casts a and b to the highest compatible type since "choose" doesnt do it. How can I do this simply? Mathew -- M47h3w `/34735
8183
Age (days ago)
8183
Last active (days ago)
0 comments
1 participants
participants (1)
-
Mathew Yeates