From: Simon Wright <simon@pushface.org>
Subject: Re: A thicker binding for Lapack
Date: Thu, 27 Dec 2012 20:37:40 +0000
Date: 2012-12-27T20:37:40+00:00 [thread overview]
Message-ID: <lyehibxmcr.fsf@pushface.org> (raw)
In-Reply-To: 9242b176-7050-46f8-a65d-6091aa4b2de8@googlegroups.com
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.
prev parent reply other threads:[~2012-12-27 20:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-27 18:48 A thicker binding for Lapack jpwoodruff
2012-12-27 19:18 ` Shark8
2012-12-29 18:36 ` jpwoodruff
2012-12-29 19:59 ` Simon Wright
2012-12-30 18:05 ` jpwoodruff
2012-12-30 19:41 ` Simon Wright
2013-01-01 0:24 ` jpwoodruff
2012-12-27 20:37 ` Simon Wright [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox