comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier write-only <gautier_niouzes@hotmail.com>
Subject: Re: Ann: Mathpaqs, release Feb. 2011
Date: Mon, 21 Feb 2011 18:34:38 -0800 (PST)
Date: 2011-02-21T18:34:38-08:00	[thread overview]
Message-ID: <838f49da-9a83-49d1-b42e-64b45f9b2917@x13g2000vbe.googlegroups.com> (raw)
In-Reply-To: ijuu8r$frj$1@speranza.aioe.org

On 22 fév, 00:59, "Nasser M. Abbasi" <n...@12000.org> wrote:

> I do not use Ada now, but I was looking at your ConjGrad solver,
> and was just wondering, why new Matrix and Vectors are
> defined in that package, since with Ada now, there exist
> such types now?
>
> For example, in  ConjGrad.ads it says
>
> type Vector is array(Index range <>) of Real
>
> type Any_matrix (<>) is private;

These types are *not* defined in the package (since they appear before
the keyword "package" :-) ). They are imported as generic parameters.
So you can use whatever vector and matrix types, including Ada 2005's
Real_Vector and Real_Matrix.

So I guess the next question would be: why not using Real_Vector and
Real_Matrix by default ? My answer would be:
- you can use the package also with an Ada 95 compiler, even one which
doesn't yet has been extended with the new 2005 math packages
- more important: you can use non-trivial matrix types, like band
matrices or sparse matrices.

Consider the example here:
  http://www.youtube.com/watch?v=_NIZmYd8oUw
The mesh is 220x220 points, which is still probably a "toy" size for
finite element problems. But you have then 220*220=48,400 dimensions
and then 48400*48400=2,342,560,000 cells in a matrix like Real_Matrix,
which makes around 16 GB in storage with double precision! Even if you
have enough RAM on your computer, the solver might run very slowly
because of poor CPU cache-ing (and perhaps also because of the 2
billion multiplications and additions for each iteration!).
A sparse matrix storage takes a few MB instead.

Regards
Gautier



  reply	other threads:[~2011-02-22  2:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-21 18:43 Ann: Mathpaqs, release Feb. 2011 Gautier write-only
2011-02-21 23:59 ` Nasser M. Abbasi
2011-02-22  2:34   ` Gautier write-only [this message]
2011-02-22  9:56     ` Nasser M. Abbasi
2011-02-22 10:27       ` Dmitry A. Kazakov
2011-02-22 10:40         ` Nasser M. Abbasi
2011-02-22 11:33           ` Dmitry A. Kazakov
2011-02-22 20:45             ` Nasser M. Abbasi
2011-02-22 21:03               ` Dmitry A. Kazakov
2011-02-23 14:38               ` Simon Wright
2011-02-24  9:51                 ` comp.lang.php
2011-02-25 21:09                   ` Simon Wright
2011-02-26  0:21                     ` Nasser M. Abbasi
2011-02-26  7:53                       ` Simon Wright
2011-02-26 18:38                       ` Gautier write-only
2011-02-26 20:59                         ` Simon Wright
2011-02-22 17:35           ` Simon Wright
2011-02-22 17:21       ` Gautier write-only
replies disabled

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