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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a40f6d312191b68e X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.96.231 with SMTP id dv7mr8372670wib.6.1356837414486; Sat, 29 Dec 2012 19:16:54 -0800 (PST) Path: i11ni337243wiw.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.131.MISMATCH!xlned.com!feeder3.xlned.com!news.astraweb.com!border6.a.newsrouter.astraweb.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!newsreader4.netcologne.de!news.netcologne.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: A thicker binding for Lapack Date: Thu, 27 Dec 2012 20:37:40 +0000 Organization: A noiseless patient Spider Message-ID: References: <9242b176-7050-46f8-a65d-6091aa4b2de8@googlegroups.com> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="78d2f773d15560df4dcd15bed77bebc3"; logging-data="2312"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BvzCHHLKg2cynJOyUpv+Wh5Gq+EiRalQ=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (darwin) Cancel-Lock: sha1:rwn2mZvOOq8S/cdfaeY2P/S2f+o= sha1:6BmyHjJp96GM5sksD2hiTA0WSuA= Content-Type: text/plain Date: 2012-12-27T20:37:40+00:00 List-Id: jpwoodruff@gmail.com writes: > My trials at maintaining parameter definitions that echo the Fortran > binding have led only to grief. The integer inputs N, NRHS, LDA, LDB > make precious little sense, considering the transposition of the > matrices that takes place inside the body of procedure sgesv. Completely agree with this. > After several drafts I'm thinking that a thick binding might look > like this: > > procedure SGESV > (A : in out Real_Arrays.Real_Matrix; > IPIV : out Integer_Vector; > B : in out Real_Arrays.Real_Matrix; > INFO : out Integer) ; [see extract from SGESV man page below] There may be some deep reason for making A in-out, but if you don't see a need to preserve the internal LU decomposition I'd make a copy internally, and also keep IPIV internal. Also, I'd make B 'in' and use a third 'out' parameter Result. And, perhaps INFO should be replaced by Constraint_Error? [from SGESV man page] PURPOSE SGESV computes the solution to a real system of linear equations A * X = B, where A is an N-by-N matrix and X and B are N-by-NRHS matrices. The LU decomposition with partial pivoting and row inter- changes is used to factor A as A = P * L * U, where P is a permutation matrix, L is unit lower triangular, and U is upper triangular. The factored form of A is then used to solve the system of equations A * X = B. ARGUMENTS [...] A (input/output) REAL array, dimension (LDA,N) On entry, the N-by-N coefficient matrix A. On exit, the fac- tors L and U from the factorization A = P*L*U; the unit diago- nal elements of L are not stored. [...] IPIV (output) INTEGER array, dimension (N) The pivot indices that define the permutation matrix P; row i of the matrix was interchanged with row IPIV(i). B (input/output) REAL array, dimension (LDB,NRHS) On entry, the N-by-NRHS matrix of right hand side matrix B. On exit, if INFO = 0, the N-by-NRHS solution matrix X. [...] INFO (output) INTEGER = 0: successful exit < 0: if INFO = -i, the i-th argument had an illegal value > 0: if INFO = i, U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, so the solution could not be computed.