LAPACK
3.9.0
LAPACK: Linear Algebra PACKage
lapacke_ztf_trans.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 C interface to LAPACK utility function
30
* Author: Intel Corporation
31
* Created in February, 2010
32
*****************************************************************************/
33
34
#include "
lapacke_utils.h
"
35
36
/* Converts input RFP matrix from row-major(C) to column-major(Fortran)
37
* layout or vice versa.
38
* This functions does copy diagonal for both unit and non-unit cases.
39
*/
40
41
void
LAPACKE_ztf_trans
(
int
matrix_layout,
char
transr,
char
uplo,
char
diag,
42
lapack_int
n,
const
lapack_complex_double
*in,
43
lapack_complex_double
*out )
44
{
45
lapack_int
row, col;
46
lapack_logical
rowmaj, ntr, lower, unit;
47
48
if
( in == NULL || out == NULL ) return ;
49
50
rowmaj = (matrix_layout ==
LAPACK_ROW_MAJOR
);
51
ntr =
LAPACKE_lsame
( transr,
'n'
);
52
lower =
LAPACKE_lsame
( uplo,
'l'
);
53
unit =
LAPACKE_lsame
( diag,
'u'
);
54
55
if
( ( !rowmaj && ( matrix_layout !=
LAPACK_COL_MAJOR
) ) ||
56
( !ntr && !
LAPACKE_lsame
( transr,
't'
) &&
57
!
LAPACKE_lsame
( transr,
'c'
) ) ||
58
( !lower && !
LAPACKE_lsame
( uplo,
'u'
) ) ||
59
( !unit && !
LAPACKE_lsame
( diag,
'n'
) ) ) {
60
/* Just exit if input parameters are wrong */
61
return
;
62
}
63
64
/* Determine parameters of array representing RFP */
65
if
( ntr ) {
66
if
( n%2 == 0 ) {
67
row = n + 1;
68
col = n / 2;
69
}
else
{
70
row = n;
71
col = (n + 1) / 2;
72
}
73
}
else
{
74
if
( n%2 == 0 ) {
75
row = n / 2;
76
col = n + 1;
77
}
else
{
78
row = (n + 1) / 2;
79
col = n;
80
}
81
}
82
83
/* Perform conversion: */
84
if
( rowmaj ) {
85
LAPACKE_zge_trans
(
LAPACK_ROW_MAJOR
, row, col, in, col, out, row );
86
}
else
{
87
LAPACKE_zge_trans
(
LAPACK_COL_MAJOR
, row, col, in, row, out, col );
88
}
89
}
LAPACKE_ztf_trans
void LAPACKE_ztf_trans(int matrix_layout, char transr, char uplo, char diag, lapack_int n, const lapack_complex_double *in, lapack_complex_double *out)
Definition:
lapacke_ztf_trans.c:40
lapack_int
#define lapack_int
Definition:
lapack.h:21
lapacke_utils.h
lapack_logical
#define lapack_logical
Definition:
lapack.h:25
lapack_complex_double
#define lapack_complex_double
Definition:
lapack.h:70
LAPACKE_lsame
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition:
lapacke_lsame.c:35
LAPACK_ROW_MAJOR
#define LAPACK_ROW_MAJOR
Definition:
lapacke.h:53
LAPACK_COL_MAJOR
#define LAPACK_COL_MAJOR
Definition:
lapacke.h:54
LAPACKE_zge_trans
void LAPACKE_zge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_double *in, lapack_int ldin, lapack_complex_double *out, lapack_int ldout)
Definition:
lapacke_zge_trans.c:39
LAPACKE
utils
lapacke_ztf_trans.c
Generated on Wed May 5 2021 15:10:37 for LAPACK by
1.8.16