For those cases where you cannot vectorize the operation, numpy is usually
does not help much.
Try using Cython. You will be able to compile the part of the code and the
loop will be much faster (can be more than 100 times faster).
http://docs.cython.org/
-Joon
On Sun, 24 Jul 2011 18:10:14
Hi,After numpy upgrade, I started to get "Warning: invalid value encountered in true_divide," when I run a code which did now show any warning previously.What does it mean and where should I look to fix this? It does not stop my debugger so I could not identify where the message was from.Thank you,
Oops .. I guess isnan() inside the weave code just works fine. Should have tried this first. By the way, is there any speed lost doing this? Should I convert all NaN values into a integer and use it inside the weave inline c code?-Joon On Fri, 14 Jan 2011 14:03:16 -0600, Joon Ro wrote:
Hi,I was
x27;], type_converters = converters.blitz, force = 0, verbose = 1)with test(0) = nan returns err = nan correctly, but I don't know how to check the nan value inside the c inline c code. Is there any way I can get similar functionality as isnan?Thank you,Joon--
Thanks, Nathaniel. Your reply was very helpful.
-Joon
On Mon, 08 Nov 2010 15:47:22 -0600, Nathaniel Smith wrote:
> On Mon, Nov 8, 2010 at 12:00 PM, Joon wrote:
>> Another question is, is it better to do cho_solve(cho_factor(A), b) than
>> solve(A, b)?
>
> If A is symmet
On Mon, 08 Nov 2010 13:23:46 -0600, Pauli Virtanen wrote:
> Mon, 08 Nov 2010 13:17:11 -0600, Joon wrote:
>> I was wondering when it is better to store cholesky factor and use it to
>> solve Ax = b, instead of storing the inverse of A. (A is a symmetric,
>> positive-definit
On Mon, 08 Nov 2010 13:23:46 -0600, Pauli Virtanen wrote:> Mon, 08 Nov 2010 13:17:11 -0600, Joon wrote:>> I was wondering when it is better to store cholesky factor and use it to>> solve Ax = b, instead of storing the inverse of A. (A is a symmetric,>> positive-definite
Hi,I was wondering when it is better to store cholesky factor and use it to solve Ax = b, instead of storing the inverse of A. (A is a symmetric, positive-definite matrix.)Even in the repeated case, if I have the inverse of A (invA) stored, then I can solve Ax = b_i, i = 1, ... , n, by x = dot(i
Hi,I was wondering when it is better to store cholesky factor and use it to solve Ax = b, instead of storing the inverse of A. (A is a symmetric, positive-definite matrix.)Even in the repeated case, if I have the inverse of A (invA) stored, then I can solve Ax = b_i, i = 1, ... , n, by x = dot(i
think it uses Intel MKL) so that could have affected the calculation. I will use dot whenever possible from now on. :)-JoonOn Mon, 01 Nov 2010 21:27:07 -0500, David wrote:> On 11/02/2010 08:30 AM, Joon wrote:>> Hi,>>>> I just found that using dot instead of sum in numpy give
Hi,I just found that using dot instead of sum in numpy gives me better results in terms of precision loss. For example, I optimized a function with scipy.optimize.fmin_bfgs. For the return value for the function, I tried the following two things:sum(Xb) - sum(denominator)and dot(ones(Xb.
> But even if indices = array, one still needs to do something like:
> for index in indices: histogram[index] += 1
>
> Which is slow in python and fast in C.
>
> I'm guessing that there's no utility function in numpy that does a
> loop like this? If so, that would be handy, but if now, I think
12 matches
Mail list logo