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

Definition at line 36 of file lapacke_ztfsm_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_ztfsm( &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_double* b_t = NULL;
53  lapack_complex_double* a_t = NULL;
54  /* Check leading dimension(s) */
55  if( ldb < n ) {
56  info = -12;
57  LAPACKE_xerbla( "LAPACKE_ztfsm_work", info );
58  return info;
59  }
60  /* Allocate memory for temporary array(s) */
61  b_t = (lapack_complex_double*)
62  LAPACKE_malloc( sizeof(lapack_complex_double) * ldb_t * MAX(1,n) );
63  if( b_t == NULL ) {
65  goto exit_level_0;
66  }
67  if( IS_Z_NONZERO(alpha) ) {
68  a_t = (lapack_complex_double*)
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_Z_NONZERO(alpha) ) {
78  LAPACKE_zge_trans( matrix_layout, m, n, b, ldb, b_t, ldb_t );
79  }
80  if( IS_Z_NONZERO(alpha) ) {
81  LAPACKE_ztf_trans( matrix_layout, transr, uplo, diag, n, a, a_t );
82  }
83  /* Call LAPACK function and adjust info */
84  LAPACK_ztfsm( &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_zge_trans( LAPACK_COL_MAJOR, m, n, b_t, ldb_t, b, ldb );
89  /* Release memory and exit */
90  if( IS_Z_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_ztfsm_work", info );
98  }
99  } else {
100  info = -1;
101  LAPACKE_xerbla( "LAPACKE_ztfsm_work", info );
102  }
103  return info;
104 }
void LAPACK_ztfsm(char *transr, char *side, char *uplo, char *trans, char *diag, lapack_int *m, lapack_int *n, lapack_complex_double *alpha, const lapack_complex_double *a, lapack_complex_double *b, lapack_int *ldb)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define lapack_complex_double
Definition: lapacke.h:90
#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
#define IS_Z_NONZERO(x)
Definition: lapacke_utils.h:63
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)
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)

Here is the call graph for this function:

Here is the caller graph for this function: