LAPACKE: fix xlascl family of functions

Apply fixes made by upstream in
5eca362f3a
This commit is contained in:
Vladimir Chalupecky 2016-11-23 14:43:14 +01:00
parent 161c927071
commit a95ac5faaf
8 changed files with 257 additions and 181 deletions

View File

@ -28,14 +28,14 @@
***************************************************************************** *****************************************************************************
* Contents: Native high-level C interface to LAPACK function slaswp * Contents: Native high-level C interface to LAPACK function slaswp
* Author: Intel Corporation * Author: Intel Corporation
* Generated November 2015 * Generated June 2016
*****************************************************************************/ *****************************************************************************/
#include "lapacke_utils.h" #include "lapacke_utils.h"
lapack_int LAPACKE_clascl( int matrix_layout, char type, lapack_int kl, lapack_int LAPACKE_clascl( int matrix_layout, char type, lapack_int kl,
lapack_int ku, float cfrom, float cto, lapack_int ku, float cfrom, float cto,
lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int m, lapack_int n, lapack_complex_float* a,
lapack_int lda ) lapack_int lda )
{ {
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
@ -46,50 +46,64 @@ lapack_int LAPACKE_clascl( int matrix_layout, char type, lapack_int kl,
/* Optionally check input matrices for NaNs */ /* Optionally check input matrices for NaNs */
switch (type) { switch (type) {
case 'G': case 'G':
if( LAPACKE_cge_nancheck( matrix_layout, lda, n, a, lda ) ) { if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
return -9; return -9;
} }
break; break;
case 'L': case 'L':
// TYPE = 'L' - lower triangular matrix. // TYPE = 'L' - lower triangle of general matrix
if( LAPACKE_ctr_nancheck( matrix_layout, 'L', 'N', n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_cgb_nancheck( matrix_layout, m, n, m-1, 0, a, lda+1 ) ) {
} return -9;
}
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_cgb_nancheck( LAPACK_COL_MAJOR, n, m, 0, m-1, a-m+1, lda+1 ) ) {
return -9;
}
break; break;
case 'U': case 'U':
// TYPE = 'U' - upper triangular matrix // TYPE = 'U' - upper triangle of general matrix
if( LAPACKE_ctr_nancheck( matrix_layout, 'U', 'N', n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_cgb_nancheck( matrix_layout, m, n, 0, n-1, a-n+1, lda+1 ) ) {
} return -9;
}
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_cgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 0, a, lda+1 ) ) {
return -9;
}
break; break;
case 'H': case 'H':
// TYPE = 'H' - upper Hessenberg matrix // TYPE = 'H' - part of upper Hessenberg matrix in general matrix
if( LAPACKE_chs_nancheck( matrix_layout, n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_cgb_nancheck( matrix_layout, m, n, 1, n-1, a-n+1, lda+1 ) ) {
} return -9;
break; }
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_cgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 1, a-1, lda+1 ) ) {
return -9;
}
case 'B': case 'B':
// TYPE = 'B' - A is a symmetric band matrix with lower bandwidth KL // TYPE = 'B' - lower part of symmetric band matrix (assume m==n)
// and upper bandwidth KU and with the only the lower if( LAPACKE_chb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) {
// half stored. return -9;
if( LAPACKE_chb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) { }
return -9; break;
} case 'Q':
break; // TYPE = 'Q' - upper part of symmetric band matrix (assume m==n)
case 'Q': if( LAPACKE_chb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) {
// TYPE = 'Q' - A is a symmetric band matrix with lower bandwidth KL return -9;
// and upper bandwidth KU and with the only the upper }
// half stored.
if( LAPACKE_chb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) {
return -9;
}
break; break;
case 'Z': case 'Z':
// TYPE = 'Z' - A is a band matrix with lower bandwidth KL and upper // TYPE = 'Z' - band matrix laid out for ?GBTRF
// bandwidth KU. See DGBTRF for storage details. if( matrix_layout == LAPACK_COL_MAJOR &&
if( LAPACKE_cgb_nancheck( matrix_layout, n, n, kl, kl+ku, a, lda ) ) { LAPACKE_cgb_nancheck( matrix_layout, m, n, kl, ku, a+kl, lda ) ) {
return -6; return -9;
} }
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_cgb_nancheck( matrix_layout, m, n, kl, ku, a+lda*kl, lda ) ) {
return -9;
}
break; break;
} }
#endif #endif

View File

@ -28,14 +28,14 @@
***************************************************************************** *****************************************************************************
* Contents: Native middle-level C interface to LAPACK function slaswp * Contents: Native middle-level C interface to LAPACK function slaswp
* Author: Intel Corporation * Author: Intel Corporation
* Generated November, 2011 * Generated June 2016
*****************************************************************************/ *****************************************************************************/
#include "lapacke_utils.h" #include "lapacke_utils.h"
lapack_int LAPACKE_clascl_work( int matrix_layout, char type, lapack_int kl, lapack_int LAPACKE_clascl_work( int matrix_layout, char type, lapack_int kl,
lapack_int ku, float cfrom, float cto, lapack_int ku, float cfrom, float cto,
lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int m, lapack_int n, lapack_complex_float* a,
lapack_int lda ) lapack_int lda )
{ {
lapack_int info = 0; lapack_int info = 0;
@ -46,7 +46,10 @@ lapack_int LAPACKE_clascl_work( int matrix_layout, char type, lapack_int kl,
info = info - 1; info = info - 1;
} }
} else if( matrix_layout == LAPACK_ROW_MAJOR ) { } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,lda); lapack_int nrows_a = LAPACKE_lsame(type, 'b') ? kl + 1 :
LAPACKE_lsame(type, 'q') ? ku + 1 :
LAPACKE_lsame(type, 'z') ? 2 * kl + ku + 1 : m;
lapack_int lda_t = MAX(1,nrows_a);
lapack_complex_float* a_t = NULL; lapack_complex_float* a_t = NULL;
/* Check leading dimension(s) */ /* Check leading dimension(s) */
if( lda < n ) { if( lda < n ) {
@ -62,12 +65,14 @@ lapack_int LAPACKE_clascl_work( int matrix_layout, char type, lapack_int kl,
goto exit_level_0; goto exit_level_0;
} }
/* Transpose input matrices */ /* Transpose input matrices */
LAPACKE_cge_trans( matrix_layout, lda, n, a, lda, a_t, lda_t ); LAPACKE_cge_trans( matrix_layout, nrows_a, n, a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */ /* Call LAPACK function and adjust info */
LAPACK_clascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a_t, &lda_t, &info); LAPACK_clascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a_t, &lda_t, &info);
info = 0; /* LAPACK call is ok! */ if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */ /* Transpose output matrices */
LAPACKE_cge_trans( LAPACK_COL_MAJOR, lda, n, a_t, lda_t, a, lda ); LAPACKE_cge_trans( LAPACK_COL_MAJOR, nrows_a, n, a_t, lda_t, a, lda );
/* Release memory and exit */ /* Release memory and exit */
LAPACKE_free( a_t ); LAPACKE_free( a_t );
exit_level_0: exit_level_0:

View File

@ -28,14 +28,14 @@
***************************************************************************** *****************************************************************************
* Contents: Native high-level C interface to LAPACK function dlaswp * Contents: Native high-level C interface to LAPACK function dlaswp
* Author: Intel Corporation * Author: Intel Corporation
* Generated November, 2011 * Generated June 2016
*****************************************************************************/ *****************************************************************************/
#include "lapacke_utils.h" #include "lapacke_utils.h"
lapack_int LAPACKE_dlascl( int matrix_layout, char type, lapack_int kl, lapack_int LAPACKE_dlascl( int matrix_layout, char type, lapack_int kl,
lapack_int ku, double cfrom, double cto, lapack_int ku, double cfrom, double cto,
lapack_int m, lapack_int n, double* a, lapack_int m, lapack_int n, double* a,
lapack_int lda ) lapack_int lda )
{ {
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
@ -46,50 +46,64 @@ lapack_int LAPACKE_dlascl( int matrix_layout, char type, lapack_int kl,
/* Optionally check input matrices for NaNs */ /* Optionally check input matrices for NaNs */
switch (type) { switch (type) {
case 'G': case 'G':
if( LAPACKE_dge_nancheck( matrix_layout, lda, n, a, lda ) ) { if( LAPACKE_dge_nancheck( matrix_layout, m, n, a, lda ) ) {
return -9; return -9;
} }
break; break;
case 'L': case 'L':
// TYPE = 'L' - lower triangular matrix. // TYPE = 'L' - lower triangle of general matrix
if( LAPACKE_dtr_nancheck( matrix_layout, 'L', 'N', n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_dgb_nancheck( matrix_layout, m, n, m-1, 0, a, lda+1 ) ) {
} return -9;
}
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_dgb_nancheck( LAPACK_COL_MAJOR, n, m, 0, m-1, a-m+1, lda+1 ) ) {
return -9;
}
break; break;
case 'U': case 'U':
// TYPE = 'U' - upper triangular matrix // TYPE = 'U' - upper triangle of general matrix
if( LAPACKE_dtr_nancheck( matrix_layout, 'U', 'N', n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_dgb_nancheck( matrix_layout, m, n, 0, n-1, a-n+1, lda+1 ) ) {
} return -9;
}
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_dgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 0, a, lda+1 ) ) {
return -9;
}
break; break;
case 'H': case 'H':
// TYPE = 'H' - upper Hessenberg matrix // TYPE = 'H' - part of upper Hessenberg matrix in general matrix
if( LAPACKE_dhs_nancheck( matrix_layout, n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_dgb_nancheck( matrix_layout, m, n, 1, n-1, a-n+1, lda+1 ) ) {
} return -9;
break; }
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_dgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 1, a-1, lda+1 ) ) {
return -9;
}
case 'B': case 'B':
// TYPE = 'B' - A is a symmetric band matrix with lower bandwidth KL // TYPE = 'B' - lower part of symmetric band matrix (assume m==n)
// and upper bandwidth KU and with the only the lower if( LAPACKE_dsb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) {
// half stored. return -9;
if( LAPACKE_dsb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) { }
return -9; break;
} case 'Q':
break; // TYPE = 'Q' - upper part of symmetric band matrix (assume m==n)
case 'Q': if( LAPACKE_dsb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) {
// TYPE = 'Q' - A is a symmetric band matrix with lower bandwidth KL return -9;
// and upper bandwidth KU and with the only the upper }
// half stored.
if( LAPACKE_dsb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) {
return -9;
}
break; break;
case 'Z': case 'Z':
// TYPE = 'Z' - A is a band matrix with lower bandwidth KL and upper // TYPE = 'Z' - band matrix laid out for ?GBTRF
// bandwidth KU. See DGBTRF for storage details. if( matrix_layout == LAPACK_COL_MAJOR &&
if( LAPACKE_dgb_nancheck( matrix_layout, n, n, kl, kl+ku, a, lda ) ) { LAPACKE_dgb_nancheck( matrix_layout, m, n, kl, ku, a+kl, lda ) ) {
return -6; return -9;
} }
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_dgb_nancheck( matrix_layout, m, n, kl, ku, a+lda*kl, lda ) ) {
return -9;
}
break; break;
} }
#endif #endif

View File

@ -28,14 +28,14 @@
***************************************************************************** *****************************************************************************
* Contents: Native middle-level C interface to LAPACK function dlaswp * Contents: Native middle-level C interface to LAPACK function dlaswp
* Author: Intel Corporation * Author: Intel Corporation
* Generated November, 2011 * Generated June 2016
*****************************************************************************/ *****************************************************************************/
#include "lapacke_utils.h" #include "lapacke_utils.h"
lapack_int LAPACKE_dlascl_work( int matrix_layout, char type, lapack_int kl, lapack_int LAPACKE_dlascl_work( int matrix_layout, char type, lapack_int kl,
lapack_int ku, double cfrom, double cto, lapack_int ku, double cfrom, double cto,
lapack_int m, lapack_int n, double* a, lapack_int m, lapack_int n, double* a,
lapack_int lda ) lapack_int lda )
{ {
lapack_int info = 0; lapack_int info = 0;
@ -46,7 +46,10 @@ lapack_int LAPACKE_dlascl_work( int matrix_layout, char type, lapack_int kl,
info = info - 1; info = info - 1;
} }
} else if( matrix_layout == LAPACK_ROW_MAJOR ) { } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,lda); lapack_int nrows_a = LAPACKE_lsame(type, 'b') ? kl + 1 :
LAPACKE_lsame(type, 'q') ? ku + 1 :
LAPACKE_lsame(type, 'z') ? 2 * kl + ku + 1 : m;
lapack_int lda_t = MAX(1,nrows_a);
double* a_t = NULL; double* a_t = NULL;
/* Check leading dimension(s) */ /* Check leading dimension(s) */
if( lda < n ) { if( lda < n ) {
@ -61,12 +64,14 @@ lapack_int LAPACKE_dlascl_work( int matrix_layout, char type, lapack_int kl,
goto exit_level_0; goto exit_level_0;
} }
/* Transpose input matrices */ /* Transpose input matrices */
LAPACKE_dge_trans( matrix_layout, lda, n, a, lda, a_t, lda_t ); LAPACKE_dge_trans( matrix_layout, nrows_a, n, a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */ /* Call LAPACK function and adjust info */
LAPACK_dlascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a_t, &lda_t, &info); LAPACK_dlascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a_t, &lda_t, &info);
info = 0; /* LAPACK call is ok! */ if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */ /* Transpose output matrices */
LAPACKE_dge_trans( LAPACK_COL_MAJOR, lda, n, a_t, lda_t, a, lda ); LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_a, n, a_t, lda_t, a, lda );
/* Release memory and exit */ /* Release memory and exit */
LAPACKE_free( a_t ); LAPACKE_free( a_t );
exit_level_0: exit_level_0:

View File

@ -28,14 +28,14 @@
***************************************************************************** *****************************************************************************
* Contents: Native high-level C interface to LAPACK function slaswp * Contents: Native high-level C interface to LAPACK function slaswp
* Author: Intel Corporation * Author: Intel Corporation
* Generated November, 2011 * Generated June 2016
*****************************************************************************/ *****************************************************************************/
#include "lapacke_utils.h" #include "lapacke_utils.h"
lapack_int LAPACKE_slascl( int matrix_layout, char type, lapack_int kl, lapack_int LAPACKE_slascl( int matrix_layout, char type, lapack_int kl,
lapack_int ku, float cfrom, float cto, lapack_int ku, float cfrom, float cto,
lapack_int m, lapack_int n, float* a, lapack_int m, lapack_int n, float* a,
lapack_int lda ) lapack_int lda )
{ {
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
@ -46,50 +46,64 @@ lapack_int LAPACKE_slascl( int matrix_layout, char type, lapack_int kl,
/* Optionally check input matrices for NaNs */ /* Optionally check input matrices for NaNs */
switch (type) { switch (type) {
case 'G': case 'G':
if( LAPACKE_sge_nancheck( matrix_layout, lda, n, a, lda ) ) { if( LAPACKE_sge_nancheck( matrix_layout, m, n, a, lda ) ) {
return -9; return -9;
} }
break; break;
case 'L': case 'L':
// TYPE = 'L' - lower triangular matrix. // TYPE = 'L' - lower triangle of general matrix
if( LAPACKE_str_nancheck( matrix_layout, 'L', 'N', n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_sgb_nancheck( matrix_layout, m, n, m-1, 0, a, lda+1 ) ) {
} return -9;
}
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_sgb_nancheck( LAPACK_COL_MAJOR, n, m, 0, m-1, a-m+1, lda+1 ) ) {
return -9;
}
break; break;
case 'U': case 'U':
// TYPE = 'U' - upper triangular matrix // TYPE = 'U' - upper triangle of general matrix
if( LAPACKE_str_nancheck( matrix_layout, 'U', 'N', n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_sgb_nancheck( matrix_layout, m, n, 0, n-1, a-n+1, lda+1 ) ) {
} return -9;
}
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_sgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 0, a, lda+1 ) ) {
return -9;
}
break; break;
case 'H': case 'H':
// TYPE = 'H' - upper Hessenberg matrix // TYPE = 'H' - part of upper Hessenberg matrix in general matrix
if( LAPACKE_shs_nancheck( matrix_layout, n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_sgb_nancheck( matrix_layout, m, n, 1, n-1, a-n+1, lda+1 ) ) {
} return -9;
break; }
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_sgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 1, a-1, lda+1 ) ) {
return -9;
}
case 'B': case 'B':
// TYPE = 'B' - A is a symmetric band matrix with lower bandwidth KL // TYPE = 'B' - lower part of symmetric band matrix (assume m==n)
// and upper bandwidth KU and with the only the lower if( LAPACKE_ssb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) {
// half stored. return -9;
if( LAPACKE_ssb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) { }
return -9; break;
} case 'Q':
break; // TYPE = 'Q' - upper part of symmetric band matrix (assume m==n)
case 'Q': if( LAPACKE_ssb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) {
// TYPE = 'Q' - A is a symmetric band matrix with lower bandwidth KL return -9;
// and upper bandwidth KU and with the only the upper }
// half stored.
if( LAPACKE_ssb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) {
return -9;
}
break; break;
case 'Z': case 'Z':
// TYPE = 'Z' - A is a band matrix with lower bandwidth KL and upper // TYPE = 'Z' - band matrix laid out for ?GBTRF
// bandwidth KU. See DGBTRF for storage details. if( matrix_layout == LAPACK_COL_MAJOR &&
if( LAPACKE_sgb_nancheck( matrix_layout, n, n, kl, kl+ku, a, lda ) ) { LAPACKE_sgb_nancheck( matrix_layout, m, n, kl, ku, a+kl, lda ) ) {
return -6; return -9;
} }
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_sgb_nancheck( matrix_layout, m, n, kl, ku, a+lda*kl, lda ) ) {
return -9;
}
break; break;
} }
#endif #endif

View File

@ -28,14 +28,14 @@
***************************************************************************** *****************************************************************************
* Contents: Native middle-level C interface to LAPACK function slaswp * Contents: Native middle-level C interface to LAPACK function slaswp
* Author: Intel Corporation * Author: Intel Corporation
* Generated November, 2011 * Generated June 2016
*****************************************************************************/ *****************************************************************************/
#include "lapacke_utils.h" #include "lapacke_utils.h"
lapack_int LAPACKE_slascl_work( int matrix_layout, char type, lapack_int kl, lapack_int LAPACKE_slascl_work( int matrix_layout, char type, lapack_int kl,
lapack_int ku, float cfrom, float cto, lapack_int ku, float cfrom, float cto,
lapack_int m, lapack_int n, float* a, lapack_int m, lapack_int n, float* a,
lapack_int lda ) lapack_int lda )
{ {
lapack_int info = 0; lapack_int info = 0;
@ -46,7 +46,10 @@ lapack_int LAPACKE_slascl_work( int matrix_layout, char type, lapack_int kl,
info = info - 1; info = info - 1;
} }
} else if( matrix_layout == LAPACK_ROW_MAJOR ) { } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,lda); lapack_int nrows_a = LAPACKE_lsame(type, 'b') ? kl + 1 :
LAPACKE_lsame(type, 'q') ? ku + 1 :
LAPACKE_lsame(type, 'z') ? 2 * kl + ku + 1 : m;
lapack_int lda_t = MAX(1,nrows_a);
float* a_t = NULL; float* a_t = NULL;
/* Check leading dimension(s) */ /* Check leading dimension(s) */
if( lda < n ) { if( lda < n ) {
@ -61,12 +64,14 @@ lapack_int LAPACKE_slascl_work( int matrix_layout, char type, lapack_int kl,
goto exit_level_0; goto exit_level_0;
} }
/* Transpose input matrices */ /* Transpose input matrices */
LAPACKE_sge_trans( matrix_layout, lda, n, a, lda, a_t, lda_t ); LAPACKE_sge_trans( matrix_layout, nrows_a, n, a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */ /* Call LAPACK function and adjust info */
LAPACK_slascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a_t, &lda_t, &info); LAPACK_slascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a_t, &lda_t, &info);
info = 0; /* LAPACK call is ok! */ if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */ /* Transpose output matrices */
LAPACKE_sge_trans( LAPACK_COL_MAJOR, lda, n, a_t, lda_t, a, lda ); LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrows_a, n, a_t, lda_t, a, lda );
/* Release memory and exit */ /* Release memory and exit */
LAPACKE_free( a_t ); LAPACKE_free( a_t );
exit_level_0: exit_level_0:

View File

@ -28,68 +28,82 @@
***************************************************************************** *****************************************************************************
* Contents: Native high-level C interface to LAPACK function dlaswp * Contents: Native high-level C interface to LAPACK function dlaswp
* Author: Intel Corporation * Author: Intel Corporation
* Generated November 2015 * Generated June 2016
*****************************************************************************/ *****************************************************************************/
#include "lapacke_utils.h" #include "lapacke_utils.h"
lapack_int LAPACKE_zlascl( int matrix_layout, char type, lapack_int kl, lapack_int LAPACKE_zlascl( int matrix_layout, char type, lapack_int kl,
lapack_int ku, double cfrom, double cto, lapack_int ku, double cfrom, double cto,
lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int m, lapack_int n, lapack_complex_double* a,
lapack_int lda ) lapack_int lda )
{ {
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_zlascl", -1 ); LAPACKE_xerbla( "LAPACKE_zlascl", -1 );
return -1; return -1;
} }
#ifndef LAPACK_zISABLE_NAN_CHECK #ifndef LAPACK_DISABLE_NAN_CHECK
/* Optionally check input matrices for NaNs */ /* Optionally check input matrices for NaNs */
switch (type) { switch (type) {
case 'G': case 'G':
if( LAPACKE_zge_nancheck( matrix_layout, lda, n, a, lda ) ) { if( LAPACKE_zge_nancheck( matrix_layout, m, n, a, lda ) ) {
return -9; return -9;
} }
break; break;
case 'L': case 'L':
// TYPE = 'L' - lower triangular matrix. // TYPE = 'L' - lower triangle of general matrix
if( LAPACKE_ztr_nancheck( matrix_layout, 'L', 'N', n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_zgb_nancheck( matrix_layout, m, n, m-1, 0, a, lda+1 ) ) {
} return -9;
}
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_zgb_nancheck( LAPACK_COL_MAJOR, n, m, 0, m-1, a-m+1, lda+1 ) ) {
return -9;
}
break; break;
case 'U': case 'U':
// TYPE = 'U' - upper triangular matrix // TYPE = 'U' - upper triangle of general matrix
if( LAPACKE_ztr_nancheck( matrix_layout, 'U', 'N', n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_zgb_nancheck( matrix_layout, m, n, 0, n-1, a-n+1, lda+1 ) ) {
} return -9;
}
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_zgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 0, a, lda+1 ) ) {
return -9;
}
break; break;
case 'H': case 'H':
// TYPE = 'H' - upper Hessenberg matrix // TYPE = 'H' - part of upper Hessenberg matrix in general matrix
if( LAPACKE_zhs_nancheck( matrix_layout, n, a, lda ) ) { if( matrix_layout == LAPACK_COL_MAJOR &&
return -9; LAPACKE_zgb_nancheck( matrix_layout, m, n, 1, n-1, a-n+1, lda+1 ) ) {
} return -9;
break; }
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_zgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 1, a-1, lda+1 ) ) {
return -9;
}
case 'B': case 'B':
// TYPE = 'B' - A is a symmetric band matrix with lower bandwidth KL // TYPE = 'B' - lower part of symmetric band matrix (assume m==n)
// and upper bandwidth KU and with the only the lower if( LAPACKE_zhb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) {
// half stored. return -9;
if( LAPACKE_zhb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) { }
return -9; break;
} case 'Q':
break; // TYPE = 'Q' - upper part of symmetric band matrix (assume m==n)
case 'Q': if( LAPACKE_zhb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) {
// TYPE = 'Q' - A is a symmetric band matrix with lower bandwidth KL return -9;
// and upper bandwidth KU and with the only the upper }
// half stored.
if( LAPACKE_zhb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) {
return -9;
}
break; break;
case 'Z': case 'Z':
// TYPE = 'Z' - A is a band matrix with lower bandwidth KL and upper // TYPE = 'Z' - band matrix laid out for ?GBTRF
// bandwidth KU. See DGBTRF for storage details. if( matrix_layout == LAPACK_COL_MAJOR &&
if( LAPACKE_zgb_nancheck( matrix_layout, n, n, kl, kl+ku, a, lda ) ) { LAPACKE_zgb_nancheck( matrix_layout, m, n, kl, ku, a+kl, lda ) ) {
return -6; return -9;
} }
if( matrix_layout == LAPACK_ROW_MAJOR &&
LAPACKE_zgb_nancheck( matrix_layout, m, n, kl, ku, a+lda*kl, lda ) ) {
return -9;
}
break; break;
} }
#endif #endif

View File

@ -28,14 +28,14 @@
***************************************************************************** *****************************************************************************
* Contents: Native middle-level C interface to LAPACK function dlaswp * Contents: Native middle-level C interface to LAPACK function dlaswp
* Author: Intel Corporation * Author: Intel Corporation
* Generated November, 2011 * Generated June 2016
*****************************************************************************/ *****************************************************************************/
#include "lapacke_utils.h" #include "lapacke_utils.h"
lapack_int LAPACKE_zlascl_work( int matrix_layout, char type, lapack_int kl, lapack_int LAPACKE_zlascl_work( int matrix_layout, char type, lapack_int kl,
lapack_int ku, double cfrom, double cto, lapack_int ku, double cfrom, double cto,
lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int m, lapack_int n, lapack_complex_double* a,
lapack_int lda ) lapack_int lda )
{ {
lapack_int info = 0; lapack_int info = 0;
@ -46,7 +46,10 @@ lapack_int LAPACKE_zlascl_work( int matrix_layout, char type, lapack_int kl,
info = info - 1; info = info - 1;
} }
} else if( matrix_layout == LAPACK_ROW_MAJOR ) { } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,lda); lapack_int nrows_a = LAPACKE_lsame(type, 'b') ? kl + 1 :
LAPACKE_lsame(type, 'q') ? ku + 1 :
LAPACKE_lsame(type, 'z') ? 2 * kl + ku + 1 : m;
lapack_int lda_t = MAX(1,nrows_a);
lapack_complex_double* a_t = NULL; lapack_complex_double* a_t = NULL;
/* Check leading dimension(s) */ /* Check leading dimension(s) */
if( lda < n ) { if( lda < n ) {
@ -62,12 +65,14 @@ lapack_int LAPACKE_zlascl_work( int matrix_layout, char type, lapack_int kl,
goto exit_level_0; goto exit_level_0;
} }
/* Transpose input matrices */ /* Transpose input matrices */
LAPACKE_zge_trans( matrix_layout, lda, n, a, lda, a_t, lda_t ); LAPACKE_zge_trans( matrix_layout, nrows_a, n, a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */ /* Call LAPACK function and adjust info */
LAPACK_zlascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a_t, &lda_t, &info); LAPACK_zlascl( &type, &kl, &ku, &cfrom, &cto, &m, &n, a_t, &lda_t, &info);
info = 0; /* LAPACK call is ok! */ if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */ /* Transpose output matrices */
LAPACKE_zge_trans( LAPACK_COL_MAJOR, lda, n, a_t, lda_t, a, lda ); LAPACKE_zge_trans( LAPACK_COL_MAJOR, nrows_a, n, a_t, lda_t, a, lda );
/* Release memory and exit */ /* Release memory and exit */
LAPACKE_free( a_t ); LAPACKE_free( a_t );
exit_level_0: exit_level_0: