LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
lapack_int LAPACKE_sorbdb_work ( int  matrix_layout,
char  trans,
char  signs,
lapack_int  m,
lapack_int  p,
lapack_int  q,
float *  x11,
lapack_int  ldx11,
float *  x12,
lapack_int  ldx12,
float *  x21,
lapack_int  ldx21,
float *  x22,
lapack_int  ldx22,
float *  theta,
float *  phi,
float *  taup1,
float *  taup2,
float *  tauq1,
float *  tauq2,
float *  work,
lapack_int  lwork 
)

Definition at line 36 of file lapacke_sorbdb_work.c.

44 {
45  lapack_int info = 0;
46  if( matrix_layout == LAPACK_COL_MAJOR ) {
47  /* Call LAPACK function and adjust info */
48  LAPACK_sorbdb( &trans, &signs, &m, &p, &q, x11, &ldx11, x12, &ldx12,
49  x21, &ldx21, x22, &ldx22, theta, phi, taup1, taup2,
50  tauq1, tauq2, work, &lwork, &info );
51  if( info < 0 ) {
52  info = info - 1;
53  }
54  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
55  lapack_int nrows_x11 = ( LAPACKE_lsame( trans, 'n' ) ? p : q);
56  lapack_int nrows_x12 = ( LAPACKE_lsame( trans, 'n' ) ? p : m-q);
57  lapack_int nrows_x21 = ( LAPACKE_lsame( trans, 'n' ) ? m-p : q);
58  lapack_int nrows_x22 = ( LAPACKE_lsame( trans, 'n' ) ? m-p : m-q);
59  lapack_int ldx11_t = MAX(1,nrows_x11);
60  lapack_int ldx12_t = MAX(1,nrows_x12);
61  lapack_int ldx21_t = MAX(1,nrows_x21);
62  lapack_int ldx22_t = MAX(1,nrows_x22);
63  float* x11_t = NULL;
64  float* x12_t = NULL;
65  float* x21_t = NULL;
66  float* x22_t = NULL;
67  /* Check leading dimension(s) */
68  if( ldx11 < q ) {
69  info = -8;
70  LAPACKE_xerbla( "LAPACKE_sorbdb_work", info );
71  return info;
72  }
73  if( ldx12 < m-q ) {
74  info = -10;
75  LAPACKE_xerbla( "LAPACKE_sorbdb_work", info );
76  return info;
77  }
78  if( ldx21 < q ) {
79  info = -12;
80  LAPACKE_xerbla( "LAPACKE_sorbdb_work", info );
81  return info;
82  }
83  if( ldx22 < m-q ) {
84  info = -14;
85  LAPACKE_xerbla( "LAPACKE_sorbdb_work", info );
86  return info;
87  }
88  /* Query optimal working array(s) size if requested */
89  if( lwork == -1 ) {
90  LAPACK_sorbdb( &trans, &signs, &m, &p, &q, x11, &ldx11_t, x12,
91  &ldx12_t, x21, &ldx21_t, x22, &ldx22_t, theta, phi,
92  taup1, taup2, tauq1, tauq2, work, &lwork, &info );
93  return (info < 0) ? (info - 1) : info;
94  }
95  /* Allocate memory for temporary array(s) */
96  x11_t = (float*)LAPACKE_malloc( sizeof(float) * ldx11_t * MAX(1,q) );
97  if( x11_t == NULL ) {
99  goto exit_level_0;
100  }
101  x12_t = (float*)LAPACKE_malloc( sizeof(float) * ldx12_t * MAX(1,m-q) );
102  if( x12_t == NULL ) {
104  goto exit_level_1;
105  }
106  x21_t = (float*)LAPACKE_malloc( sizeof(float) * ldx21_t * MAX(1,q) );
107  if( x21_t == NULL ) {
109  goto exit_level_2;
110  }
111  x22_t = (float*)LAPACKE_malloc( sizeof(float) * ldx22_t * MAX(1,m-q) );
112  if( x22_t == NULL ) {
114  goto exit_level_3;
115  }
116  /* Transpose input matrices */
117  LAPACKE_sge_trans( matrix_layout, nrows_x11, q, x11, ldx11, x11_t,
118  ldx11_t );
119  LAPACKE_sge_trans( matrix_layout, nrows_x12, m-q, x12, ldx12, x12_t,
120  ldx12_t );
121  LAPACKE_sge_trans( matrix_layout, nrows_x21, q, x21, ldx21, x21_t,
122  ldx21_t );
123  LAPACKE_sge_trans( matrix_layout, nrows_x22, m-q, x22, ldx22, x22_t,
124  ldx22_t );
125  /* Call LAPACK function and adjust info */
126  LAPACK_sorbdb( &trans, &signs, &m, &p, &q, x11_t, &ldx11_t, x12_t,
127  &ldx12_t, x21_t, &ldx21_t, x22_t, &ldx22_t, theta, phi,
128  taup1, taup2, tauq1, tauq2, work, &lwork, &info );
129  if( info < 0 ) {
130  info = info - 1;
131  }
132  /* Transpose output matrices */
133  LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrows_x11, q, x11_t, ldx11_t, x11,
134  ldx11 );
135  LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrows_x12, m-q, x12_t, ldx12_t,
136  x12, ldx12 );
137  LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrows_x21, q, x21_t, ldx21_t, x21,
138  ldx21 );
139  LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrows_x22, m-q, x22_t, ldx22_t,
140  x22, ldx22 );
141  /* Release memory and exit */
142  LAPACKE_free( x22_t );
143 exit_level_3:
144  LAPACKE_free( x21_t );
145 exit_level_2:
146  LAPACKE_free( x12_t );
147 exit_level_1:
148  LAPACKE_free( x11_t );
149 exit_level_0:
150  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
151  LAPACKE_xerbla( "LAPACKE_sorbdb_work", info );
152  }
153  } else {
154  info = -1;
155  LAPACKE_xerbla( "LAPACKE_sorbdb_work", info );
156  }
157  return info;
158 }
#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_sorbdb(char *trans, char *signs, lapack_int *m, lapack_int *p, lapack_int *q, float *x11, lapack_int *ldx11, float *x12, lapack_int *ldx12, float *x21, lapack_int *ldx21, float *x22, lapack_int *ldx22, float *theta, float *phi, float *taup1, float *taup2, float *tauq1, float *tauq2, float *work, lapack_int *lwork, 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: