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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,26e047a7a0709881,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.196.232 with SMTP id ip8mr17342297pbc.6.1341706126450; Sat, 07 Jul 2012 17:08:46 -0700 (PDT) Path: l9ni11132pbj.0!nntp.google.com!news1.google.com!goblin3!goblin.stu.neva.ru!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: How to initialize a matrix of one column only? Date: Sat, 07 Jul 2012 19:08:41 -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-07T19:08:41-05:00 List-Id: So trivial, yet Ada is giving me hard time with this because I am a newbie. I am trying to call SGESV in Lapack http://www.netlib.org/lapack/single/sgesv.f One of the arguments must be a matrix (the 'B' argument there). I want to pass it a one column matrix. (i.e. I can't use a Vector, it must be a matrix, since this is what the Ada Lapack binding requires). But I can't get the syntax to simply initialize the required matrix to be a one column matrix. I keep getting the error nested array aggregate expected I am sure this is trivial, but after tried all the combinations I can think of, and googling around, I give up. It works with the B matrix is (1..N,1..N) but not when I write it as (1..N,1..1) to make it one column matrix. Here is the code, I write ---------------------- with Interfaces.Fortran; use Interfaces.Fortran; with lbase; .... N: Fortran_Integer := 3; B: labase.Fortran_Real_Matrix ( 1..N, 1..1 ); BEGIN B := ((9.0) , -- here is the problem (2.0) , (-2.0)); .... -------------------------------------------- where the labase package simply introduces a type for Fortran_Real_Matrix as follows ---------------------------- type Fortran_Real_Matrix is array (Fortran_Integer range <>, Fortran_Integer range <>) of Real; pragma Convention (Fortran, Fortran_Real_Matrix); -------------------- >gnatmake -I../ada lap42.adb gcc -c -I../ada lap42.adb lap42.adb:35:16: nested array aggregate expected lap42.adb:35:16: if single-component aggregate is intended, write e.g. (1 => ...) gnatmake: "lap42.adb" compilation error > I tried B:=(1=>9.0,2=>2.03=>-2.0); and B := ((9.0 ,2.0 , 3)); but non working. What is the correct syntax to use? thanks, --Nasser