LAPACK  3.10.1 LAPACK: Linear Algebra PACKage

## ◆ LAPACKE_stp_trans()

 void LAPACKE_stp_trans ( int matrix_layout, char uplo, char diag, lapack_int n, const float * in, float * out )

Definition at line 39 of file lapacke_stp_trans.c.

42 {
43  lapack_int i, j, st;
44  lapack_logical colmaj, upper, unit;
45
46  if( in == NULL || out == NULL ) return ;
47
48  colmaj = ( matrix_layout == LAPACK_COL_MAJOR );
49  upper = LAPACKE_lsame( uplo, 'u' );
50  unit = LAPACKE_lsame( diag, 'u' );
51
52  if( ( !colmaj && ( matrix_layout != LAPACK_ROW_MAJOR ) ) ||
53  ( !upper && !LAPACKE_lsame( uplo, 'l' ) ) ||
54  ( !unit && !LAPACKE_lsame( diag, 'n' ) ) ) {
55  /* Just exit if any of input parameters are wrong */
56  return;
57  }
58  if( unit ) {
59  /* If unit, then don't touch diagonal, start from 1st column or row */
60  st = 1;
61  } else {
62  /* If non-unit, then check diagonal also, starting from [0,0] */
63  st = 0;
64  }
65
66  /* Perform conversion:
67  * Since col_major upper and row_major lower are equal,
68  * and col_major lower and row_major upper are equals too -
69  * using one code for equal cases. XOR( colmaj, upper )
70  */
71  if( !( colmaj || upper ) || ( colmaj && upper ) ) {
72  for( j = st; j < n; j++ ) {
73  for( i = 0; i < j+1-st; i++ ) {
74  out[ j-i + (i*(2*n-i+1))/2 ] = in[ ((j+1)*j)/2 + i ];
75  }
76  }
77  } else {
78  for( j = 0; j < n-st; j++ ) {
79  for( i = j+st; i < n; i++ ) {
80  out[ j + ((i+1)*i)/2 ] = in[ (j*(2*n-j+1))/2 + i-j ];
81  }
82  }
83  }
84 }
#define lapack_int
Definition: lapack.h:83
#define lapack_logical
Definition: lapack.h:87
#define LAPACK_COL_MAJOR
Definition: lapacke.h:53
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
Here is the call graph for this function:
Here is the caller graph for this function: