[Numpy-discussion] Random Numbers

Karthikesh Raju karthik at james.hut.fi
Wed Jun 2 08:42:14 CDT 2004


Hi Perry and All,

Thankx a lot for your reply. i actually forgot to mention it, but
a = rand(100000) > 0.5
b = rand(100000) > 0.5
sum(float(a,b))

results in a TypeError: Only rank-0 numarray can be cast to floats.

With warm regards
karthik


-----------------------------------------------------------------------
Karthikesh Raju,		    email: karthik at james.hut.fi
Researcher,			    http://www.cis.hut.fi/karthik
Helsinki University of Technology,  Tel: +358-9-451 5389
Laboratory of Comp. & Info. Sc.,    Fax: +358-9-451 3277
Department of Computer Sc.,
P.O Box 5400, FIN 02015 HUT,
Espoo, FINLAND
-----------------------------------------------------------------------

On Wed, 2 Jun 2004, Perry Greenfield wrote:

> Karthikesh Raju wrote:
> >
> > n_Errors = sum(not_equal(Tx_Bit_Stream,Rx_Bit_Stream))
> >
> > Now i have noted that n_Errors is negative? How can that be so?
> >
> > n_Errors should be the number of places where Tx_Bit_Stream differs from
> > Rx_Bit_Stream? How can the sum be negative?
> >
> >
> I'm guessing you are seeing overflow problems with the boolean
> representation which is the result of logical comparisons
> (which uses only 8 bit values) try:
>
> sum(float(not_equal...
>
> to eliminate that problem.
>
> Perry
>
>




More information about the Numpy-discussion mailing list