LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dlantr_work()

double LAPACKE_dlantr_work ( int  matrix_layout,
char  norm,
char  uplo,
char  diag,
lapack_int  m,
lapack_int  n,
const double *  a,
lapack_int  lda,
double *  work 
)

Definition at line 35 of file lapacke_dlantr_work.c.

38 {
39  lapack_int info = 0;
40  double res = 0.;
41  if( matrix_layout == LAPACK_COL_MAJOR ) {
42  /* Call LAPACK function */
43  res = LAPACK_dlantr( &norm, &uplo, &diag, &m, &n, a, &lda, work );
44  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
45  double* work_lapack = NULL;
46  char norm_lapack;
47  char uplo_lapack;
48  /* Check leading dimension(s) */
49  if( lda < n ) {
50  info = -8;
51  LAPACKE_xerbla( "LAPACKE_dlantr_work", info );
52  return info;
53  }
54  if( LAPACKE_lsame( norm, '1' ) || LAPACKE_lsame( norm, 'o' ) ) {
55  norm_lapack = 'i';
56  } else if( LAPACKE_lsame( norm, 'i' ) ) {
57  norm_lapack = '1';
58  } else {
59  norm_lapack = norm;
60  }
61  if( LAPACKE_lsame( uplo, 'u' ) ) {
62  uplo_lapack = 'l';
63  } else {
64  uplo_lapack = 'u';
65  }
66  /* Allocate memory for work array(s) */
67  if( LAPACKE_lsame( norm_lapack, 'i' ) ) {
68  work_lapack = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,n) );
69  if( work_lapack == NULL ) {
71  goto exit_level_0;
72  }
73  }
74  /* Call LAPACK function */
75  res = LAPACK_dlantr( &norm_lapack, &uplo_lapack, &diag, &n, &m, a, &lda, work_lapack );
76  /* Release memory and exit */
77  if( work_lapack ) {
78  LAPACKE_free( work_lapack );
79  }
80 exit_level_0:
81  if( info == LAPACK_WORK_MEMORY_ERROR ) {
82  LAPACKE_xerbla( "LAPACKE_dlantr_work", info );
83  }
84  } else {
85  info = -1;
86  LAPACKE_xerbla( "LAPACKE_dlantr_work", info );
87  }
88  return res;
89 }
#define LAPACK_dlantr(...)
Definition: lapack.h:10249
#define lapack_int
Definition: lapack.h:83
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:55
#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
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
void LAPACKE_xerbla(const char *name, lapack_int info)
#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: