LAPACK
3.9.0
LAPACK: Linear Algebra PACKage
lapacke_dgbtrf_work.c
Go to the documentation of this file.
1
/*****************************************************************************
2
Copyright (c) 2014, Intel Corp.
3
All rights reserved.
4
5
Redistribution and use in source and binary forms, with or without
6
modification, are permitted provided that the following conditions are met:
7
8
* Redistributions of source code must retain the above copyright notice,
9
this list of conditions and the following disclaimer.
10
* 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
* Neither the name of Intel Corporation nor the names of its contributors
14
may be used to endorse or promote products derived from this software
15
without specific prior written permission.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27
THE POSSIBILITY OF SUCH DAMAGE.
28
*****************************************************************************
29
* Contents: Native middle-level C interface to LAPACK function dgbtrf
30
* Author: Intel Corporation
31
* Generated November 2015
32
*****************************************************************************/
33
34
#include "
lapacke_utils.h
"
35
36
lapack_int
LAPACKE_dgbtrf_work
(
int
matrix_layout,
lapack_int
m,
lapack_int
n,
37
lapack_int
kl,
lapack_int
ku,
double
* ab,
38
lapack_int
ldab,
lapack_int
* ipiv )
39
{
40
lapack_int
info = 0;
41
if
( matrix_layout ==
LAPACK_COL_MAJOR
) {
42
/* Call LAPACK function and adjust info */
43
LAPACK_dgbtrf
( &m, &n, &kl, &ku, ab, &ldab, ipiv, &info );
44
if
( info < 0 ) {
45
info = info - 1;
46
}
47
}
else
if
( matrix_layout ==
LAPACK_ROW_MAJOR
) {
48
lapack_int
ldab_t =
MAX
(1,2*kl+ku+1);
49
double
* ab_t = NULL;
50
/* Check leading dimension(s) */
51
if
( ldab < n ) {
52
info = -7;
53
LAPACKE_xerbla
(
"LAPACKE_dgbtrf_work"
, info );
54
return
info;
55
}
56
/* Allocate memory for temporary array(s) */
57
ab_t = (
double
*)
LAPACKE_malloc
(
sizeof
(
double
) * ldab_t *
MAX
(1,n) );
58
if
( ab_t == NULL ) {
59
info =
LAPACK_TRANSPOSE_MEMORY_ERROR
;
60
goto
exit_level_0;
61
}
62
/* Transpose input matrices */
63
LAPACKE_dgb_trans
( matrix_layout, m, n, kl, kl+ku, ab, ldab, ab_t,
64
ldab_t );
65
/* Call LAPACK function and adjust info */
66
LAPACK_dgbtrf
( &m, &n, &kl, &ku, ab_t, &ldab_t, ipiv, &info );
67
if
( info < 0 ) {
68
info = info - 1;
69
}
70
/* Transpose output matrices */
71
LAPACKE_dgb_trans
(
LAPACK_COL_MAJOR
, m, n, kl, kl+ku, ab_t, ldab_t, ab,
72
ldab );
73
/* Release memory and exit */
74
LAPACKE_free
( ab_t );
75
exit_level_0:
76
if
( info ==
LAPACK_TRANSPOSE_MEMORY_ERROR
) {
77
LAPACKE_xerbla
(
"LAPACKE_dgbtrf_work"
, info );
78
}
79
}
else
{
80
info = -1;
81
LAPACKE_xerbla
(
"LAPACKE_dgbtrf_work"
, info );
82
}
83
return
info;
84
}
LAPACKE_free
#define LAPACKE_free(p)
Definition:
lapacke.h:47
lapack_int
#define lapack_int
Definition:
lapack.h:21
lapacke_utils.h
LAPACKE_dgb_trans
void LAPACKE_dgb_trans(int matrix_layout, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const double *in, lapack_int ldin, double *out, lapack_int ldout)
Definition:
lapacke_dgb_trans.c:39
LAPACKE_xerbla
void LAPACKE_xerbla(const char *name, lapack_int info)
Definition:
lapacke_xerbla.c:36
MAX
#define MAX(x, y)
Definition:
lapacke_utils.h:47
LAPACK_TRANSPOSE_MEMORY_ERROR
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition:
lapacke.h:57
LAPACKE_dgbtrf_work
lapack_int LAPACKE_dgbtrf_work(int matrix_layout, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, double *ab, lapack_int ldab, lapack_int *ipiv)
Definition:
lapacke_dgbtrf_work.c:35
LAPACKE_malloc
#define LAPACKE_malloc(size)
Definition:
lapacke.h:44
LAPACK_dgbtrf
void LAPACK_dgbtrf(lapack_int const *m, lapack_int const *n, lapack_int const *kl, lapack_int const *ku, double *AB, lapack_int const *ldab, lapack_int *ipiv, lapack_int *info)
LAPACK_ROW_MAJOR
#define LAPACK_ROW_MAJOR
Definition:
lapacke.h:53
LAPACK_COL_MAJOR
#define LAPACK_COL_MAJOR
Definition:
lapacke.h:54
LAPACKE
src
lapacke_dgbtrf_work.c
Generated on Wed May 5 2021 15:10:34 for LAPACK by
1.8.16