comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Does Ada need elemental functions to make it suitable for scientific work?
Date: Tue, 10 Jul 2012 13:59:53 +0200
Date: 2012-07-10T13:59:55+02:00	[thread overview]
Message-ID: <4ffc193b$0$6584$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <jtfpdr$2lt$1@speranza.aioe.org>

On 10.07.12 01:27, Nasser M. Abbasi wrote:
> In Fortran, I can just write V**2, where V is a vector. In Ada,
> I can't do that. Since ** is not defined on this array type
> and this number type.

As Gautier pointed out, a general purpose language must be better
than convenient for some. What the convenient operations might offer
to a small niche of science is not good enough, even when one
personally considers them important.

You mentioned operations on vectors. Mine would include
operations like

- manipulate only values of a vector at certain indices,
  or produce a result from some components only,
  fold style, or something even more involved.

Such as: Make all negative values 0.0.

It is possible to do this using array operations and has been ever
since APL (late 1960s), and R, and others, by composing functions.
But APL programmers and others have explained that there is
only a slight chance that composed operations will be efficient
since many results will be computed needlessly, wasting real time
and real memory. If efficiency is a concern, one might have to
dismiss such designs of inefficient computations. This is s first
trade-off.

For the above computation, then, I might need some kind of loop,
be it expressed as a simple loop, or as a clever, if intricate,
tail recursive function. This is easily done using languages
Ada, or Fortran, or C++, language that, incidentally, are used
to write advanced mathematician's (or physicist's) calculators
like Octave. The languages enable methods of controlling the
operational aspects of an algorithm that vector operators will
by definition take out of the hands of programmers.

When writing Ada, I will expect to be able to look at the
constituent parts of a computation. For example, my program might
need to decide whether or not a computation can continue, at least
for parts of the vector, when one component has an unusable
intermediate result. For example,

   Sum (V);  --  V = Vector'(1.2, 3.4, broken, ..., 11.12);

If programmers should be able to attach their code between the
steps that operators perform (be they in parallel or in sequence),
then I imagine a library based "operator" could at least be made
very flexible. Still, compilers could select more optimal
alternatives where possible.



  parent reply	other threads:[~2012-07-10 11:59 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-09 23:27 Does Ada need elemental functions to make it suitable for scientific work? Nasser M. Abbasi
     [not found] ` <d78nv7dhf88bqv7hrd9eft231a4h2scs10@invalid.netcom.com>
2012-07-10  4:22   ` Nasser M. Abbasi
2012-07-10 14:26     ` Marco
2012-07-10  4:24 ` gautier_niouzes
2012-07-10  5:22   ` Ada novice
2012-07-10  7:27     ` Dmitry A. Kazakov
2012-07-10  8:06     ` gautier_niouzes
     [not found]     ` <637de084-0e71-4077-a1c5-fc4200cad3cf@googlegroups.com>
2012-07-10  8:39       ` Nasser M. Abbasi
2012-07-10  8:58         ` Ada novice
2012-07-10  9:07         ` Dmitry A. Kazakov
2012-07-10  9:21           ` Nasser M. Abbasi
2012-07-10  9:26             ` Nasser M. Abbasi
2012-07-10  9:50             ` Dmitry A. Kazakov
2012-07-20  1:56             ` Randy Brukardt
2012-07-20 21:49               ` Adam Beneschan
2012-07-12  0:31           ` robin.vowels
2012-07-12  7:12             ` Dmitry A. Kazakov
2012-07-29 13:39               ` Robin Vowels
2012-07-29 14:22                 ` Dmitry A. Kazakov
2012-07-29 20:54                   ` glen herrmannsfeldt
     [not found]                     ` <apib1897s56dkultqmfl3emvk1os3tfdak@invalid.netcom.com>
2012-07-30  4:15                       ` glen herrmannsfeldt
     [not found]                         ` <nfhd181tv9u87mcqfb7rgd8lm48ihr9f4r@invalid.netcom.com>
2012-07-31  8:53                           ` MATRIX MULTIPLICATION Robin Vowels
2012-07-31  9:05                             ` Robin Vowels
2012-07-30  0:49                   ` Does Ada need elemental functions to make it suitable for scientific work? Robin Vowels
2012-07-12  0:22         ` robin.vowels
2012-07-20  1:51         ` Randy Brukardt
2012-07-29 13:53           ` Robin Vowels
2012-07-29 15:51             ` J-P. Rosen
2012-07-29 16:07               ` Dmitry A. Kazakov
2012-07-29 20:30                 ` Simon Wright
2012-07-29 20:59                   ` glen herrmannsfeldt
2012-07-29 21:44                   ` J-P. Rosen
2012-07-29 22:54                     ` Simon Wright
2012-07-30  0:53               ` Robin Vowels
2012-07-30  2:20               ` Shmuel Metz
2012-07-10 12:46       ` Brian Drummond
2012-07-10 11:06 ` Simon Wright
2012-07-10 11:59 ` Georg Bauhaus [this message]
2012-07-10 12:20 ` Brian Drummond
2012-07-10 19:52 ` Ada novice
2012-07-11  8:41   ` gautier_niouzes
2012-07-11  9:42     ` Ken Thomas
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox