LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_zggbal_work ( int  matrix_layout,
char  job,
lapack_int  n,
lapack_complex_double a,
lapack_int  lda,
lapack_complex_double b,
lapack_int  ldb,
lapack_int ilo,
lapack_int ihi,
double *  lscale,
double *  rscale,
double *  work 
)

Definition at line 36 of file lapacke_zggbal_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_zggbal( &job, &n, a, &lda, b, &ldb, ilo, ihi, lscale, rscale,
46  work, &info );
47  if( info < 0 ) {
48  info = info - 1;
49  }
50  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51  lapack_int lda_t = MAX(1,n);
52  lapack_int ldb_t = MAX(1,n);
53  lapack_complex_double* a_t = NULL;
54  lapack_complex_double* b_t = NULL;
55  /* Check leading dimension(s) */
56  if( lda < n ) {
57  info = -5;
58  LAPACKE_xerbla( "LAPACKE_zggbal_work", info );
59  return info;
60  }
61  if( ldb < n ) {
62  info = -7;
63  LAPACKE_xerbla( "LAPACKE_zggbal_work", info );
64  return info;
65  }
66  /* Allocate memory for temporary array(s) */
67  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
68  LAPACKE_lsame( job, 'b' ) ) {
69  a_t = (lapack_complex_double*)
71  lda_t * MAX(1,n) );
72  if( a_t == NULL ) {
74  goto exit_level_0;
75  }
76  }
77  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
78  LAPACKE_lsame( job, 'b' ) ) {
79  b_t = (lapack_complex_double*)
81  ldb_t * MAX(1,n) );
82  if( b_t == NULL ) {
84  goto exit_level_1;
85  }
86  }
87  /* Transpose input matrices */
88  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
89  LAPACKE_lsame( job, 'b' ) ) {
90  LAPACKE_zge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
91  }
92  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
93  LAPACKE_lsame( job, 'b' ) ) {
94  LAPACKE_zge_trans( matrix_layout, n, n, b, ldb, b_t, ldb_t );
95  }
96  /* Call LAPACK function and adjust info */
97  LAPACK_zggbal( &job, &n, a_t, &lda_t, b_t, &ldb_t, ilo, ihi, lscale,
98  rscale, work, &info );
99  if( info < 0 ) {
100  info = info - 1;
101  }
102  /* Transpose output matrices */
103  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
104  LAPACKE_lsame( job, 'b' ) ) {
105  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
106  }
107  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
108  LAPACKE_lsame( job, 'b' ) ) {
109  LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, b_t, ldb_t, b, ldb );
110  }
111  /* Release memory and exit */
112  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
113  LAPACKE_lsame( job, 'b' ) ) {
114  LAPACKE_free( b_t );
115  }
116 exit_level_1:
117  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
118  LAPACKE_lsame( job, 'b' ) ) {
119  LAPACKE_free( a_t );
120  }
121 exit_level_0:
122  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
123  LAPACKE_xerbla( "LAPACKE_zggbal_work", info );
124  }
125  } else {
126  info = -1;
127  LAPACKE_xerbla( "LAPACKE_zggbal_work", info );
128  }
129  return info;
130 }
#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
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:36
#define LAPACK_COL_MAJOR
Definition: lapacke.h:120
void LAPACKE_xerbla(const char *name, lapack_int info)
void LAPACK_zggbal(char *job, lapack_int *n, lapack_complex_double *a, lapack_int *lda, lapack_complex_double *b, lapack_int *ldb, lapack_int *ilo, lapack_int *ihi, double *lscale, double *rscale, double *work, lapack_int *info)
#define lapack_int
Definition: lapacke.h:47
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123
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)

Here is the call graph for this function:

Here is the caller graph for this function: