LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_zggbal_work()

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 35 of file lapacke_zggbal_work.c.

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