Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions LAPACKE/utils/lapacke_c_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ lapack_logical API_SUFFIX(LAPACKE_c_nancheck)( lapack_int n,
if( incx == 0 ) return (lapack_logical) LAPACK_CISNAN( x[0] );
inc = ( incx > 0 ) ? incx : -incx ;

for( i = 0; i < n*inc; i+=inc ) {
if( LAPACK_CISNAN( x[i] ) )
for( i = 0; i < n; i++ ) {
if( LAPACK_CISNAN( x[(size_t)i*inc] ) )
return (lapack_logical) 1;
}
return (lapack_logical) 0;
Expand Down
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_chp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
lapack_logical API_SUFFIX(LAPACKE_chp_nancheck)( lapack_int n,
const lapack_complex_float *ap )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_c_nancheck)( len, ap, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_cpf_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
lapack_logical API_SUFFIX(LAPACKE_cpf_nancheck)( lapack_int n,
const lapack_complex_float *a )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_c_nancheck)( len, a, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_cpp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
lapack_logical API_SUFFIX(LAPACKE_cpp_nancheck)( lapack_int n,
const lapack_complex_float *ap )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_c_nancheck)( len, ap, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_csp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
lapack_logical API_SUFFIX(LAPACKE_csp_nancheck)( lapack_int n,
const lapack_complex_float *ap )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_c_nancheck)( len, ap, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_ctf_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ lapack_logical API_SUFFIX(LAPACKE_ctf_nancheck)( int matrix_layout, char transr,
}
} else {
/* Non-unit case - just check whole array for NaNs. */
len = n*(n+1)/2;
len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_cge_nancheck)( LAPACK_COL_MAJOR, len, 1, a, len );
}
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_ctp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ lapack_logical API_SUFFIX(LAPACKE_ctp_nancheck)( int matrix_layout, char uplo, c
return (lapack_logical) 0;
} else {
/* Non-unit case - just check whole array for NaNs. */
len = n*(n+1)/2;
len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_c_nancheck)( len, ap, 1 );
}
}
4 changes: 2 additions & 2 deletions LAPACKE/utils/lapacke_ctr_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ lapack_logical API_SUFFIX(LAPACKE_ctr_nancheck)( int matrix_layout, char uplo, c
if( ( colmaj || lower ) && !( colmaj && lower ) ) {
for( j = st; j < n; j++ ) {
for( i = 0; i < MIN( j+1-st, lda ); i++ ) {
if( LAPACK_CISNAN( a[i+j*lda] ) )
if( LAPACK_CISNAN( a[i+(size_t)j*lda] ) )

@langou langou Jun 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of size_t here is certainly going to have a significant impact. Thanks!

return (lapack_logical) 1;
}
}
} else {
for( j = 0; j < n-st; j++ ) {
for( i = j+st; i < MIN( n, lda ); i++ ) {
if( LAPACK_CISNAN( a[i+j*lda] ) )
if( LAPACK_CISNAN( a[i+(size_t)j*lda] ) )
return (lapack_logical) 1;
}
}
Expand Down
12 changes: 6 additions & 6 deletions LAPACKE/utils/lapacke_ctz_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,27 @@ lapack_logical API_SUFFIX(LAPACKE_ctz_nancheck)( int matrix_layout, char direct,
}

/* Initial offsets and sizes of triangular and rectangular parts */
lapack_int tri_offset = 0;
int64_t tri_offset = 0;

@langou langou Jun 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then using int64_t instead of size_t because we need to be signed (as opposed to unsigned) for this variable sounds good to me. Great work.

lapack_int tri_n = MIN(m,n);
lapack_int rect_offset = -1;
int64_t rect_offset = -1;
lapack_int rect_m = ( m > n ) ? m - n : m;
lapack_int rect_n = ( n > m ) ? n - m : n;

/* Fix offsets depending on the shape of the matrix */
if( front ) {
if( lower && m > n ) {
rect_offset = tri_n * ( !colmaj ? lda : 1 );
rect_offset = (int64_t)tri_n * ( !colmaj ? lda : 1 );
} else if( !lower && n > m ) {
rect_offset = tri_n * ( colmaj ? lda : 1 );
rect_offset = (int64_t)tri_n * ( colmaj ? lda : 1 );
}
} else {
if( m > n ) {
tri_offset = rect_m * ( !colmaj ? lda : 1 );
tri_offset = (int64_t)rect_m * ( !colmaj ? lda : 1 );
if( !lower ) {
rect_offset = 0;
}
} else if( n > m ) {
tri_offset = rect_n * ( colmaj ? lda : 1 );
tri_offset = (int64_t)rect_n * ( colmaj ? lda : 1 );
if( lower ) {
rect_offset = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions LAPACKE/utils/lapacke_d_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ lapack_logical API_SUFFIX(LAPACKE_d_nancheck)( lapack_int n,
if( incx == 0 ) return (lapack_logical) LAPACK_DISNAN( x[0] );
inc = ( incx > 0 ) ? incx : -incx ;

for( i = 0; i < n*inc; i+=inc ) {
if( LAPACK_DISNAN( x[i] ) )
for( i = 0; i < n; i++ ) {
if( LAPACK_DISNAN( x[(size_t)i*inc] ) )
return (lapack_logical) 1;
}
return (lapack_logical) 0;
Expand Down
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_dpf_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
lapack_logical API_SUFFIX(LAPACKE_dpf_nancheck)( lapack_int n,
const double *a )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_d_nancheck)( len, a, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_dpp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
lapack_logical API_SUFFIX(LAPACKE_dpp_nancheck)( lapack_int n,
const double *ap )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_d_nancheck)( len, ap, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_dsp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
lapack_logical API_SUFFIX(LAPACKE_dsp_nancheck)( lapack_int n,
const double *ap )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_d_nancheck)( len, ap, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_dtf_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ lapack_logical API_SUFFIX(LAPACKE_dtf_nancheck)( int matrix_layout, char transr,
}
} else {
/* Non-unit case - just check whole array for NaNs. */
len = n*(n+1)/2;
len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_dge_nancheck)( LAPACK_COL_MAJOR, len, 1, a, len );
}
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_dtp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ lapack_logical API_SUFFIX(LAPACKE_dtp_nancheck)( int matrix_layout, char uplo, c
return (lapack_logical) 0;
} else {
/* Non-unit case - just check whole array for NaNs. */
len = n*(n+1)/2;
len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_d_nancheck)( len, ap, 1 );
}
}
4 changes: 2 additions & 2 deletions LAPACKE/utils/lapacke_dtr_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ lapack_logical API_SUFFIX(LAPACKE_dtr_nancheck)( int matrix_layout, char uplo, c
if( ( colmaj || lower ) && !( colmaj && lower ) ) {
for( j = st; j < n; j++ ) {
for( i = 0; i < MIN( j+1-st, lda ); i++ ) {
if( LAPACK_DISNAN( a[i+j*lda] ) )
if( LAPACK_DISNAN( a[i+(size_t)j*lda] ) )
return (lapack_logical) 1;
}
}
} else {
for( j = 0; j < n-st; j++ ) {
for( i = j+st; i < MIN( n, lda ); i++ ) {
if( LAPACK_DISNAN( a[i+j*lda] ) )
if( LAPACK_DISNAN( a[i+(size_t)j*lda] ) )
return (lapack_logical) 1;
}
}
Expand Down
12 changes: 6 additions & 6 deletions LAPACKE/utils/lapacke_dtz_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,27 +102,27 @@ lapack_logical API_SUFFIX(LAPACKE_dtz_nancheck)( int matrix_layout, char direct,
}

/* Initial offsets and sizes of triangular and rectangular parts */
lapack_int tri_offset = 0;
int64_t tri_offset = 0;
lapack_int tri_n = MIN(m,n);
lapack_int rect_offset = -1;
int64_t rect_offset = -1;
lapack_int rect_m = ( m > n ) ? m - n : m;
lapack_int rect_n = ( n > m ) ? n - m : n;

/* Fix offsets depending on the shape of the matrix */
if( front ) {
if( lower && m > n ) {
rect_offset = tri_n * ( !colmaj ? lda : 1 );
rect_offset = (int64_t)tri_n * ( !colmaj ? lda : 1 );
} else if( !lower && n > m ) {
rect_offset = tri_n * ( colmaj ? lda : 1 );
rect_offset = (int64_t)tri_n * ( colmaj ? lda : 1 );
}
} else {
if( m > n ) {
tri_offset = rect_m * ( !colmaj ? lda : 1 );
tri_offset = (int64_t)rect_m * ( !colmaj ? lda : 1 );
if( !lower ) {
rect_offset = 0;
}
} else if( n > m ) {
tri_offset = rect_n * ( colmaj ? lda : 1 );
tri_offset = (int64_t)rect_n * ( colmaj ? lda : 1 );
if( lower ) {
rect_offset = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions LAPACKE/utils/lapacke_s_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ lapack_logical API_SUFFIX(LAPACKE_s_nancheck)( lapack_int n,
if( incx == 0 ) return (lapack_logical) LAPACK_SISNAN( x[0] );
inc = ( incx > 0 ) ? incx : -incx ;

for( i = 0; i < n*inc; i+=inc ) {
if( LAPACK_SISNAN( x[i] ) )
for( i = 0; i < n; i++ ) {
if( LAPACK_SISNAN( x[(size_t)i*inc] ) )
return (lapack_logical) 1;
}
return (lapack_logical) 0;
Expand Down
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_spf_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
lapack_logical API_SUFFIX(LAPACKE_spf_nancheck)( lapack_int n,
const float *a )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_s_nancheck)( len, a, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_spp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
lapack_logical API_SUFFIX(LAPACKE_spp_nancheck)( lapack_int n,
const float *ap )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_s_nancheck)( len, ap, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_ssp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
lapack_logical API_SUFFIX(LAPACKE_ssp_nancheck)( lapack_int n,
const float *ap )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_s_nancheck)( len, ap, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_stf_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ lapack_logical API_SUFFIX(LAPACKE_stf_nancheck)( int matrix_layout, char transr,
}
} else {
/* Non-unit case - just check whole array for NaNs. */
len = n*(n+1)/2;
len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_sge_nancheck)( LAPACK_COL_MAJOR, len, 1, a, len );
}
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_stp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ lapack_logical API_SUFFIX(LAPACKE_stp_nancheck)( int matrix_layout, char uplo, c
return (lapack_logical) 0;
} else {
/* Non-unit case - just check whole array for NaNs. */
len = n*(n+1)/2;
len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_s_nancheck)( len, ap, 1 );
}
}
4 changes: 2 additions & 2 deletions LAPACKE/utils/lapacke_str_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ lapack_logical API_SUFFIX(LAPACKE_str_nancheck)( int matrix_layout, char uplo, c
if( ( colmaj || lower ) && !( colmaj && lower ) ) {
for( j = st; j < n; j++ ) {
for( i = 0; i < MIN( j+1-st, lda ); i++ ) {
if( LAPACK_SISNAN( a[i+j*lda] ) )
if( LAPACK_SISNAN( a[i+(size_t)j*lda] ) )
return (lapack_logical) 1;
}
}
} else {
for( j = 0; j < n-st; j++ ) {
for( i = j+st; i < MIN( n, lda ); i++ ) {
if( LAPACK_SISNAN( a[i+j*lda] ) )
if( LAPACK_SISNAN( a[i+(size_t)j*lda] ) )
return (lapack_logical) 1;
}
}
Expand Down
12 changes: 6 additions & 6 deletions LAPACKE/utils/lapacke_stz_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,27 +102,27 @@ lapack_logical API_SUFFIX(LAPACKE_stz_nancheck)( int matrix_layout, char direct,
}

/* Initial offsets and sizes of triangular and rectangular parts */
lapack_int tri_offset = 0;
int64_t tri_offset = 0;
lapack_int tri_n = MIN(m,n);
lapack_int rect_offset = -1;
int64_t rect_offset = -1;
lapack_int rect_m = ( m > n ) ? m - n : m;
lapack_int rect_n = ( n > m ) ? n - m : n;

/* Fix offsets depending on the shape of the matrix */
if( front ) {
if( lower && m > n ) {
rect_offset = tri_n * ( !colmaj ? lda : 1 );
rect_offset = (int64_t)tri_n * ( !colmaj ? lda : 1 );
} else if( !lower && n > m ) {
rect_offset = tri_n * ( colmaj ? lda : 1 );
rect_offset = (int64_t)tri_n * ( colmaj ? lda : 1 );
}
} else {
if( m > n ) {
tri_offset = rect_m * ( !colmaj ? lda : 1 );
tri_offset = (int64_t)rect_m * ( !colmaj ? lda : 1 );
if( !lower ) {
rect_offset = 0;
}
} else if( n > m ) {
tri_offset = rect_n * ( colmaj ? lda : 1 );
tri_offset = (int64_t)rect_n * ( colmaj ? lda : 1 );
if( lower ) {
rect_offset = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions LAPACKE/utils/lapacke_z_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ lapack_logical API_SUFFIX(LAPACKE_z_nancheck)( lapack_int n,
if( incx == 0 ) return (lapack_logical) LAPACK_ZISNAN( x[0] );
inc = ( incx > 0 ) ? incx : -incx ;

for( i = 0; i < n*inc; i+=inc ) {
if( LAPACK_ZISNAN( x[i] ) )
for( i = 0; i < n; i++ ) {
if( LAPACK_ZISNAN( x[(size_t)i*inc] ) )
return (lapack_logical) 1;
}
return (lapack_logical) 0;
Expand Down
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_zhp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
lapack_logical API_SUFFIX(LAPACKE_zhp_nancheck)( lapack_int n,
const lapack_complex_double *ap )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_z_nancheck)( len, ap, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_zpf_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
lapack_logical API_SUFFIX(LAPACKE_zpf_nancheck)( lapack_int n,
const lapack_complex_double *a )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_z_nancheck)( len, a, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_zpp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
lapack_logical API_SUFFIX(LAPACKE_zpp_nancheck)( lapack_int n,
const lapack_complex_double *ap )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_z_nancheck)( len, ap, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_zsp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
lapack_logical API_SUFFIX(LAPACKE_zsp_nancheck)( lapack_int n,
const lapack_complex_double *ap )
{
lapack_int len = n*(n+1)/2;
lapack_int len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_z_nancheck)( len, ap, 1 );
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_ztf_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ lapack_logical API_SUFFIX(LAPACKE_ztf_nancheck)( int matrix_layout, char transr,
}
} else {
/* Non-unit case - just check whole array for NaNs. */
len = n*(n+1)/2;
len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_zge_nancheck)( LAPACK_COL_MAJOR, len, 1, a, len );
}
}
2 changes: 1 addition & 1 deletion LAPACKE/utils/lapacke_ztp_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ lapack_logical API_SUFFIX(LAPACKE_ztp_nancheck)( int matrix_layout, char uplo, c
return (lapack_logical) 0;
} else {
/* Non-unit case - just check whole array for NaNs. */
len = n*(n+1)/2;
len = (lapack_int)(((size_t)n*(n+1))/2);
return API_SUFFIX(LAPACKE_z_nancheck)( len, ap, 1 );
}
}
4 changes: 2 additions & 2 deletions LAPACKE/utils/lapacke_ztr_nancheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ lapack_logical API_SUFFIX(LAPACKE_ztr_nancheck)( int matrix_layout, char uplo, c
if( ( colmaj || lower ) && !( colmaj && lower ) ) {
for( j = st; j < n; j++ ) {
for( i = 0; i < MIN( j+1-st, lda ); i++ ) {
if( LAPACK_ZISNAN( a[i+j*lda] ) )
if( LAPACK_ZISNAN( a[i+(size_t)j*lda] ) )
return (lapack_logical) 1;
}
}
} else {
for( j = 0; j < n-st; j++ ) {
for( i = j+st; i < MIN( n, lda ); i++ ) {
if( LAPACK_ZISNAN( a[i+j*lda] ) )
if( LAPACK_ZISNAN( a[i+(size_t)j*lda] ) )
return (lapack_logical) 1;
}
}
Expand Down
Loading
Loading