From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,80532c203ced41ef X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!x13g2000vbe.googlegroups.com!not-for-mail From: Gautier write-only Newsgroups: comp.lang.ada Subject: Re: Ann: Mathpaqs, release Feb. 2011 Date: Mon, 21 Feb 2011 18:34:38 -0800 (PST) Organization: http://groups.google.com Message-ID: <838f49da-9a83-49d1-b42e-64b45f9b2917@x13g2000vbe.googlegroups.com> References: NNTP-Posting-Host: 81.62.226.111 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1298342078 32630 127.0.0.1 (22 Feb 2011 02:34:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 22 Feb 2011 02:34:38 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x13g2000vbe.googlegroups.com; posting-host=81.62.226.111; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:18499 Date: 2011-02-21T18:34:38-08:00 List-Id: On 22 f=E9v, 00:59, "Nasser M. Abbasi" 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 =A0ConjGrad.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=3D_NIZmYd8oUw The mesh is 220x220 points, which is still probably a "toy" size for finite element problems. But you have then 220*220=3D48,400 dimensions and then 48400*48400=3D2,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