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

Definition at line 36 of file lapacke_sggbal_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_sggbal( &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  float* a_t = NULL;
54  float* b_t = NULL;
55  /* Check leading dimension(s) */
56  if( lda < n ) {
57  info = -5;
58  LAPACKE_xerbla( "LAPACKE_sggbal_work", info );
59  return info;
60  }
61  if( ldb < n ) {
62  info = -7;
63  LAPACKE_xerbla( "LAPACKE_sggbal_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 = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
70  if( a_t == NULL ) {
72  goto exit_level_0;
73  }
74  }
75  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
76  LAPACKE_lsame( job, 'b' ) ) {
77  b_t = (float*)LAPACKE_malloc( sizeof(float) * ldb_t * MAX(1,n) );
78  if( b_t == NULL ) {
80  goto exit_level_1;
81  }
82  }
83  /* Transpose input matrices */
84  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
85  LAPACKE_lsame( job, 'b' ) ) {
86  LAPACKE_sge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
87  }
88  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
89  LAPACKE_lsame( job, 'b' ) ) {
90  LAPACKE_sge_trans( matrix_layout, n, n, b, ldb, b_t, ldb_t );
91  }
92  /* Call LAPACK function and adjust info */
93  LAPACK_sggbal( &job, &n, a_t, &lda_t, b_t, &ldb_t, ilo, ihi, lscale,
94  rscale, work, &info );
95  if( info < 0 ) {
96  info = info - 1;
97  }
98  /* Transpose output matrices */
99  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
100  LAPACKE_lsame( job, 'b' ) ) {
101  LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
102  }
103  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
104  LAPACKE_lsame( job, 'b' ) ) {
105  LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, b_t, ldb_t, b, ldb );
106  }
107  /* Release memory and exit */
108  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
109  LAPACKE_lsame( job, 'b' ) ) {
110  LAPACKE_free( b_t );
111  }
112 exit_level_1:
113  if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
114  LAPACKE_lsame( job, 'b' ) ) {
115  LAPACKE_free( a_t );
116  }
117 exit_level_0:
118  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
119  LAPACKE_xerbla( "LAPACKE_sggbal_work", info );
120  }
121  } else {
122  info = -1;
123  LAPACKE_xerbla( "LAPACKE_sggbal_work", info );
124  }
125  return info;
126 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
void LAPACKE_sge_trans(int matrix_layout, lapack_int m, lapack_int n, const float *in, lapack_int ldin, float *out, lapack_int ldout)
#define MAX(x, y)
Definition: lapacke_utils.h:47
void LAPACK_sggbal(char *job, lapack_int *n, float *a, lapack_int *lda, float *b, lapack_int *ldb, lapack_int *ilo, lapack_int *ihi, float *lscale, float *rscale, float *work, lapack_int *info)
#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)
#define lapack_int
Definition: lapacke.h:47
#define LAPACK_TRANSPOSE_MEMORY_ERROR
Definition: lapacke.h:123

Here is the call graph for this function:

Here is the caller graph for this function: