LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_stprfs_work()

lapack_int LAPACKE_stprfs_work ( int  matrix_layout,
char  uplo,
char  trans,
char  diag,
lapack_int  n,
lapack_int  nrhs,
const float *  ap,
const float *  b,
lapack_int  ldb,
const float *  x,
lapack_int  ldx,
float *  ferr,
float *  berr,
float *  work,
lapack_int iwork 
)

Definition at line 36 of file lapacke_stprfs_work.c.

41 {
42  lapack_int info = 0;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function and adjust info */
45  LAPACK_stprfs( &uplo, &trans, &diag, &n, &nrhs, ap, b, &ldb, x, &ldx,
46  ferr, berr, work, iwork, &info );
47  if( info < 0 ) {
48  info = info - 1;
49  }
50  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
51  lapack_int ldb_t = MAX(1,n);
52  lapack_int ldx_t = MAX(1,n);
53  float* b_t = NULL;
54  float* x_t = NULL;
55  float* ap_t = NULL;
56  /* Check leading dimension(s) */
57  if( ldb < nrhs ) {
58  info = -9;
59  LAPACKE_xerbla( "LAPACKE_stprfs_work", info );
60  return info;
61  }
62  if( ldx < nrhs ) {
63  info = -11;
64  LAPACKE_xerbla( "LAPACKE_stprfs_work", info );
65  return info;
66  }
67  /* Allocate memory for temporary array(s) */
68  b_t = (float*)LAPACKE_malloc( sizeof(float) * ldb_t * MAX(1,nrhs) );
69  if( b_t == NULL ) {
71  goto exit_level_0;
72  }
73  x_t = (float*)LAPACKE_malloc( sizeof(float) * ldx_t * MAX(1,nrhs) );
74  if( x_t == NULL ) {
76  goto exit_level_1;
77  }
78  ap_t = (float*)
79  LAPACKE_malloc( sizeof(float) * ( MAX(1,n) * MAX(2,n+1) ) / 2 );
80  if( ap_t == NULL ) {
82  goto exit_level_2;
83  }
84  /* Transpose input matrices */
85  LAPACKE_sge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
86  LAPACKE_sge_trans( matrix_layout, n, nrhs, x, ldx, x_t, ldx_t );
87  LAPACKE_stp_trans( matrix_layout, uplo, diag, n, ap, ap_t );
88  /* Call LAPACK function and adjust info */
89  LAPACK_stprfs( &uplo, &trans, &diag, &n, &nrhs, ap_t, b_t, &ldb_t, x_t,
90  &ldx_t, ferr, berr, work, iwork, &info );
91  if( info < 0 ) {
92  info = info - 1;
93  }
94  /* Release memory and exit */
95  LAPACKE_free( ap_t );
96 exit_level_2:
97  LAPACKE_free( x_t );
98 exit_level_1:
99  LAPACKE_free( b_t );
100 exit_level_0:
101  if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
102  LAPACKE_xerbla( "LAPACKE_stprfs_work", info );
103  }
104  } else {
105  info = -1;
106  LAPACKE_xerbla( "LAPACKE_stprfs_work", info );
107  }
108  return info;
109 }
void LAPACKE_stp_trans(int matrix_layout, char uplo, char diag, lapack_int n, const float *in, float *out)
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACKE_free(p)
Definition: lapacke.h:113
void LAPACK_stprfs(char *uplo, char *trans, char *diag, lapack_int *n, lapack_int *nrhs, const float *ap, const float *b, lapack_int *ldb, const float *x, lapack_int *ldx, float *ferr, float *berr, float *work, lapack_int *iwork, lapack_int *info)
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
#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
Here is the call graph for this function:
Here is the caller graph for this function: