http://www.netlib.org/lapack/explore-html-3.4.2/d2/d22/clantr_8f.html

WORK is REAL array, dimension (MAX(1,LWORK)), LWORK >= M when NORM = 'I'; otherwise, WORK is not.

So in LAPACKE interfaces work array should be allocated only when norm == 'I':

- Code: Select all
`float LAPACKE_clantr( int matrix_layout, char norm, char uplo, char diag,`

}

#endif

/* Allocate memory for working array(s) */

- if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||

- LAPACKE_lsame( norm, 'O' ) ) {

+ if( LAPACKE_lsame( norm, 'i' ) ) {

work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,MAX(m,n)) );

if( work == NULL ) {

info = LAPACK_WORK_MEMORY_ERROR;

@@ -63,8 +62,7 @@ float LAPACKE_clantr( int matrix_layout, char norm, char uplo, char diag,

res = LAPACKE_clantr_work( matrix_layout, norm, uplo, diag, m, n, a, lda,

work );

/* Release memory and exit */

- if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||

- LAPACKE_lsame( norm, 'O' ) ) {

+ if( LAPACKE_lsame( norm, 'i' ) ) {

LAPACKE_free( work );

}

exit_level_0: