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=2.0 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA, REPLYTO_WITHOUT_TO_CC,WEIRD_PORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c2861777d1e7d2b2,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.228.227 with SMTP id sl3mr279618pbc.5.1342053537363; Wed, 11 Jul 2012 17:38:57 -0700 (PDT) Path: l9ni11511pbj.0!nntp.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Lapack Ada binding matrices/vectors issue, how to best to resolve? Date: Wed, 11 Jul 2012 19:38:53 -0500 Organization: Aioe.org NNTP Server Message-ID: Reply-To: nma@12000.org NNTP-Posting-Host: KdJUrTuvv3Zv/s8pPxNluw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-07-11T19:38:53-05:00 List-Id: The Ada lapack binding defines its own Matrix types. However, it does not define operators (multiply, add, etc.. ) to work on these types similar to Ada's Real Vectors and Matrices in the Ada.Numerics.Real_Arrays package http://www.ada-auth.org/standards/12rm/html/RM-G-3-1.html What this means, is that one can't even multiply a number by the matrix if the Matrix is Fortran_Real_Matrix like one can with Real_Matrix. Here is a simple example --------------------------- with Interfaces.Fortran; use Interfaces.Fortran; with Ada.Numerics.Real_Arrays; use Ada.Numerics.Real_Arrays; with labase; use labase; -- LAPACK binding procedure foo3 is A1 : constant Fortran_Real_Matrix(1..2,1..2):= 12.0*((12.0, 6.0),(-12.0, 6.0)); -- ERROR A2 : constant Real_Matrix(1..2,1..2) := 12.0*((12.0, 6.0),(-12.0, 6.0)); -- OK begin null; end foo3; -------------------- >gnatmake -gnat2012 -I/lapada/ada foo2.adb -largs -lblas gcc -c -gnat2012 -I/lapada/ada foo2.adb foo2.adb:24:20: expected type "Fortran_Real_Matrix" defined at labase.ads:94 foo2.adb:24:20: found type "Interfaces.Fortran.Complex" gnatmake: "foo2.adb" compilation error > I tried to do conversion of the Fortran_Real_Matrix to Real_Matrix but the compiler does not like it as it is aggregate. So, this means this binding as it stands is too limited to use as is. What would be a good way to fix this whole issue? Make a pacakge similar to Numerics.Generic_Real_Arrays for the Fortran_Real_Matrix so that all the operators '*','+', etc.. are available now for this Matrix type? The Ada lapack package with's : with Ada.Numerics.Generic_Complex_Types; with Interfaces.Fortran; use Interfaces.Fortran; Then it defines many types, such as ---------------------- type Fortran_Integer_Matrix is array (Fortran_Integer range <>, Fortran_Integer range <>) of Fortran_Integer; pragma Convention (Fortran, Fortran_Integer_Matrix); etc.. ---------------------- But it does NOT define operators to work on these types like the Ada package Ada.Numerics.Real_Arrays does: ------------------------------- function "*" (Left : Real'Base; Right : Real_Matrix) return Real_Matrix; --------------------------- I was thinking of just copying all these functions as the above to the Lapack package and edit things and change all the Real_Matrix to Fortran_Real_Matrix etc.. but this seems like not the right way to do this. The main Lapack package is lapada/ada/labase.ads in the tar file ftp://ftp.cs.kuleuven.be/pub/Ada-Belgium/mirrors/gnu-ada/OLD/contrib/lapack-ada/ Any suggestion how to resolve this from experts will be great as I am a newbie in Ada. --Nasser