[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: super slow loop

From: Kire Pudsje
Subject: Re: super slow loop
Date: Wed, 26 Apr 2017 21:12:26 +0200

On Wed, Apr 26, 2017 at 4:35 PM, smateria <address@hidden> wrote:

Hi everyone,
I have been trying to use a function to calculate standardized precipitation
index (SPI) that works fine in Matlab, but seems having huge problems in
Octave. In fact, after two integrations, the loop starts proceeding
incredibly slowly. I have vectorized my matrices as much as I could but the
problem persists. Here is the code:

With gamfit in the inner loop, you can vectorize what you want, but it will not help.
I hope it is not just the second isfinite check that is killing you, and trying to fit on infinite data.
The stored data variable is different from the pre-allocated data.
Try to supply a complete working example that demonstrates the problem.

pkg load statistics optim
obsmean=rand(204, 350);
pre_mod = rand(74, 204, 350);

Finally try using the profiler (profile on/off/clear, profshow & profexplore)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]