LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_dlange_work()

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

Definition at line 36 of file lapacke_dlange_work.c.

39 {
40  lapack_int info = 0;
41  double res = 0.;
42  char norm_lapack;
43  if( matrix_layout == LAPACK_COL_MAJOR ) {
44  /* Call LAPACK function */
45  res = LAPACK_dlange( &norm, &m, &n, a, &lda, work );
46  } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
47  double* work_lapack = NULL;
48  /* Check leading dimension(s) */
49  if( lda < n ) {
50  info = -6;
51  LAPACKE_xerbla( "LAPACKE_dlange_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  /* Allocate memory for work array(s) */
62  if( LAPACKE_lsame( norm_lapack, 'i' ) ) {
63  work_lapack = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,n) );
64  if( work_lapack == NULL ) {
66  goto exit_level_0;
67  }
68  }
69  /* Call LAPACK function */
70  res = LAPACK_dlange( &norm_lapack, &n, &m, a, &lda, work_lapack );
71  /* Release memory and exit */
72  if( work_lapack ) {
73  LAPACKE_free( work_lapack );
74  }
75 exit_level_0:
76  if( info == LAPACK_WORK_MEMORY_ERROR ) {
77  LAPACKE_xerbla( "LAPACKE_dlange_work", info );
78  }
79  } else {
80  info = -1;
81  LAPACKE_xerbla( "LAPACKE_dlange_work", info );
82  }
83  return res;
84 }
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:119
#define LAPACK_WORK_MEMORY_ERROR
Definition: lapacke.h:122
#define LAPACKE_free(p)
Definition: lapacke.h:113
#define MAX(x, y)
Definition: lapacke_utils.h:47
#define LAPACKE_malloc(size)
Definition: lapacke.h:110
double LAPACK_dlange(char *norm, lapack_int *m, lapack_int *n, const double *a, lapack_int *lda, double *work)
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
Here is the call graph for this function:
Here is the caller graph for this function: