gm2
[Top][All Lists]
Advanced

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

Re: Dynamic mutidimensional arrays


From: Michael Riedl
Subject: Re: Dynamic mutidimensional arrays
Date: Wed, 5 Apr 2023 11:16:17 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

Andreas,

I implemented that way of coding in some of my procedures at the end of 1980'th, early 90'th (see my libray DynMat) when the PIP compilers only offered one dimension open arrays and a fully static approach did not allow bigger problems on the computers I had access to at that time (only exception was the CDC 205 at the University of Bochum data center at that time ... but it only had a Pascal compiler)

At least it has the benefit, if carefully implemented, that you can interface to e.g. Fortran without too much hassels. It works, it is "not that bad" but far away from being elegant and concise.

The ISO approach with mutidimensional open arrays is much simpler and can hide the fact the a object is dynamically allocated in the calling procedure or main program. I prefer to keep “simple things simple”.

By the way I just send a mail to get a copy of the SciLab code - will have a second look but at the moment that approach does not satisfy me in any way.

Michael


Am 05.04.23 um 10:46 schrieb Fischlin Andreas:
Have you actually looked at LgMatrices? There is no such run time penalty from calling a procedure such as value(M, i,j). You simply write e.g.

     val := A^[i]^[k] * B^[k]^[j];

ETH Zurich, Prof. em. Dr. Andreas Fischlin, IPCC Vice-Chair WGII, Systems Ecology, CHN E 24, Universitaetstrasse 16, CH-8092 Zurich, SWITZERLAND
Tel: +41 44 633-6090   Mobile: +41 79 595-4050   Mail: andreas.fischlin@env.ethz.ch
www.sysecol.ethz.ch/people/andreas.fischlin.html

On 5 Apr 2023, at 10:08, Michael Riedl <udo-michael.riedl@t-online.de> wrote:



Benjamin,

if you have to call a function to access a single array element such a constuct would be a complete disaster form a runtime prospectice. And I not even talk about the readbility of the resulting code and the ability to debug it ...

I have part of code with O^3 (e.g. a simple matrix multiplication) up to O^5 dependencies of the size of the problem. It is heavily under-estimated by most programmers how e.g. cache efficiency and similar issue due influence the run-time in numerical analysis. I therefore can only warn from a statement such as "CPU and RAM are no constrains any more". Our programms even need hours or even days on current hardware for medium sized problems.

And you are absolutely right - I do not want to code everything again and again - there are mature libraries developed over decades and you cannot win the completion if its about runtime for them.

Gruß

Michael


Am 05.04.23 um 09:41 schrieb Benjamin Kowarsch:

On Wed, 5 Apr 2023 at 16:39, Fischlin Andreas wrote:

val := value(A,i,k) * value(B,k,j);

I was under the impression Micheal wanted to avoid the function call. In particular because of the reference to interfacing to external library objects.

reply via email to

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