help-octave
[Top][All Lists]
Advanced

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

Re: Optimising the Keen-Minsky Model


From: c.
Subject: Re: Optimising the Keen-Minsky Model
Date: Sun, 27 May 2012 18:28:05 +0200

On 25 May 2012, at 21:18, richard wrote:

> Hi c. 
> please find attached the Keen-Minsky Model ver02 written in
> Octave. I trust you will find that the earlier cut down 
> code simplifies the task of optimising the program without 
> the complication of the full model 
> 
> HTH
> 
> Richard A Lough

Richard,

Here is a modified version of your code, I could get a ~ x2 speed up by 
refactoring and partial vectorization
plus a further ~ x2 speedup by running in parallel with parcellfun (I only have 
2 cores, if you have more that could be better for you).

>> clear all, close all, tic, KeenMinsky02_refactored, toc
parcellfun: 10/10 jobs done
parcellfun: 10/10 jobs done
Firms Loan:   0.9504
Bank Vault: 331644.3730
Firms Deposit: -11.2287
Bank Capital:   0.1791
Workers Deposit:   0.0000
wage :   0.0000
Capital = : 4236.8343
Alpha = :   4.4807
Beta =:   7.3866
change of Price Level (inflation):   0.0000
Employment ratio :   0.1422
Elapsed time is 39 seconds.

>> clear all, close all, tic, KeenMinsky02, toc
Firms Loan:   0.9504
Bank Vault: 331644.3730
Firms Deposit: -11.2287
Bank Capital:   0.1791
Workers Deposit:   0.0000
wage :   0.0000
Capital = : 4236.8343
Alpha = :   4.4807
Beta =:   7.3866
change of Price Level (inflation):   0.0000
Employment ratio :   0.1422
Elapsed time is 163.1 seconds.

Anyway it looks like you are solving an ODE system, maybe you should look at 
LSODE 

HTH,
c.


P.S. I noticed the 12th row of X is filled but never used ... maybe that is a 
bug?


Attachment: KeenMinsky02_refactored.m
Description: Binary data

Attachment: increment.m
Description: Binary data

Attachment: postprocess.m
Description: Binary data


reply via email to

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