LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_ctfsm_work ( int  matrix_layout,
char  transr,
char  side,
char  uplo,
char  trans,
char  diag,
lapack_int  m,
lapack_int  n,
lapack_complex_float  alpha,
const lapack_complex_float a,
lapack_complex_float b,
lapack_int  ldb 
)

Definition at line 36 of file lapacke_ctfsm_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_ctfsm( &transr, &side, &uplo, &trans, &diag, &m, &n, &alpha, a,
46  b, &ldb );
47  if( info < 0 ) {
48  info = info - 1;
49  }
50  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51  lapack_int ldb_t = MAX(1,m);
52  lapack_complex_float* b_t = NULL;
53  lapack_complex_float* a_t = NULL;
54  /* Check leading dimension(s) */
55  if( ldb < n ) {
56  info = -12;
57  LAPACKE_xerbla( "LAPACKE_ctfsm_work", info );
58  return info;
59  }
60  /* Allocate memory for temporary array(s) */
61  b_t = (lapack_complex_float*)
62  LAPACKE_malloc( sizeof(lapack_complex_float) * ldb_t * MAX(1,n) );
63  if( b_t == NULL ) {
65  goto exit_level_0;
66  }
67  if( IS_C_NONZERO(alpha) ) {
68  a_t = (lapack_complex_float*)
70  ( MAX(1,n) * MAX(2,n+1) ) / 2 );
71  if( a_t == NULL ) {
73  goto exit_level_1;
74  }
75  }
76  /* Transpose input matrices */
77  if( IS_C_NONZERO(alpha) ) {
78  LAPACKE_cge_trans( matrix_layout, m, n, b, ldb, b_t, ldb_t );
79  }
80  if( IS_C_NONZERO(alpha) ) {
81  LAPACKE_ctf_trans( matrix_layout, transr, uplo, diag, n, a, a_t );
82  }
83  /* Call LAPACK function and adjust info */
84  LAPACK_ctfsm( &transr, &side, &uplo, &trans, &diag, &m, &n, &alpha, a_t,
85  b_t, &ldb_t );
86  info = 0; /* LAPACK call is ok! */
87  /* Transpose output matrices */
88  LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, b_t, ldb_t, b, ldb );
89  /* Release memory and exit */
90  if( IS_C_NONZERO(alpha) ) {
91  LAPACKE_free( a_t );
92  }
93 exit_level_1:
94  LAPACKE_free( b_t );
95 exit_level_0:
96  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
97  LAPACKE_xerbla( "LAPACKE_ctfsm_work", info );
98  }
99  } else {
100  info = -1;
101  LAPACKE_xerbla( "LAPACKE_ctfsm_work", info );
102  }
103  return info;
104 }
void LAPACKE_cge_trans(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_float *in, lapack_int ldin, lapack_complex_float *out, lapack_int ldout)
#define IS_C_NONZERO(x)
Definition: lapacke_utils.h:61
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define lapack_complex_float
Definition: lapacke.h:74
void LAPACK_ctfsm(char *transr, char *side, char *uplo, char *trans, char *diag, lapack_int *m, lapack_int *n, lapack_complex_float *alpha, const lapack_complex_float *a, lapack_complex_float *b, lapack_int *ldb)
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
#define lapack_int
Definition: lapacke.h:47
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123
void LAPACKE_ctf_trans(int matrix_layout, char transr, char uplo, char diag, lapack_int n, const lapack_complex_float *in, lapack_complex_float *out)

Here is the call graph for this function:

Here is the caller graph for this function: