2
* Automatically Tuned Linear Algebra Software v3.2
3
* (C) Copyright 1999 R. Clint Whaley
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions, and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. The name of the University of Tennessee, the ATLAS group,
14
* or the names of its contributers may not be used to endorse
15
* or promote products derived from this software without specific
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE
22
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
* POSSIBILITY OF SUCH DAMAGE.
33
#include "atlas_misc.h"
34
#include "atlas_lapack.h"
37
int clapack_cgesv(const enum CBLAS_ORDER Order, const int N, const int NRHS,
38
void *A, const int lda, int *ipiv,
39
void *B, const int ldb)
41
* clapack_cgesv computes the solution to a system of linear equations
43
* where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
44
* The LU factorization used to factor A is dependent on the Order parameter,
45
* as detailed in the leading comments of clapack_cgetrf.
46
* The factored form of A is then used solve the system of equations A * X = B.
47
* A is overwritten with the appropriate LU factorization, and B, which
48
* contains B on input, is overwritten with the solution X on output.
53
if (Order != CblasRowMajor && Order != CblasColMajor)
54
cblas_xerbla(1, "clapack_cgesv",
55
"Order must be %d or %d, but is set to %d.\n",
56
CblasRowMajor, CblasColMajor, Order);
58
cblas_xerbla(2, "clapack_cgesv",
59
"N cannot be less than zero 0,; is set to %d.\n", N);
61
cblas_xerbla(3, "clapack_cgesv",
62
"NRHS cannot be less than zero 0,; is set to %d.\n", NRHS);
63
if (lda < N || lda < 1)
64
cblas_xerbla(5, "clapack_cgesv",
65
"lda must be >= MAX(N,1): lda=%d N=%d\n", lda, N);
66
if (ldb < N || ldb < 1)
67
cblas_xerbla(8, "clapack_cgesv",
68
"ldb must be >= MAX(N,1): ldb=%d N=%d\n", ldb, N);
70
ierr = ATL_cgetrf(Order, N, N, A, lda, ipiv);
72
ATL_cgetrs(Order, CblasNoTrans, N, NRHS, A, lda, ipiv, B, ldb);