8000 docs: change variable naming in `blas/base/zscal` by ShabiShett07 · Pull Request #6880 · stdlib-js/stdlib · GitHub
[go: up one dir, main page]

Skip to content

docs: change variable naming in blas/base/zscal #6880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2025
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
docs: change variable naming in blas/base/zscal
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: passed
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: passed
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: missing_dependencies
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: na
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
  • Loading branch information
ShabiShett07 committed Apr 30, 2025
commit c8407ca7f809f75daf1d285fd335a45ccb8f80c6
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/blas/base/zscal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var alpha = new Complex128( 2.0, 2.0 );
// Create an offset view:
var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element

// Scales every other value from `zx1` by `za`...
// Scales every other value from `x1` by `alpha`...
zscal( 3, alpha, x1, 1 );
// x0 => <Complex128Array>[ 1.0, 2.0, -2.0, 14.0, -2.0, 22.0, -2.0, 30.0 ]
```
Expand Down
18 changes: 9 additions & 9 deletions lib/node_modules/@stdlib/blas/base/zscal/benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var zxbuf;
var za;
var zx;
var alpha;
var xbuf;
var x;

zxbuf = uniform( len*2, -100.0, 100.0, options );
zx = new Complex128Array( zxbuf.buffer );
xbuf = uniform( len*2, -100.0, 100.0, options );
x = new Complex128Array( xbuf.buffer );

za = new Complex128( 1.0, 0.0 );
alpha = new Complex128( 1.0, 0.0 );

return benchmark;

Expand All @@ -69,13 +69,13 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
zscal( zx.length, za, zx, 1 );
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
zscal( x.length, alpha, x, 1 );
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var zxbuf;
var za;
var zx;
var alpha;
var xbuf;
var x;

zxbuf = uniform( len*2, -100.0, 100.0, options );
zx = new Complex128Array( zxbuf.buffer );
xbuf = uniform( len*2, -100.0, 100.0, options );
x = new Complex128Array( xbuf.buffer );

za = new Complex128( 1.0, 0.0 );
alpha = new Complex128( 1.0, 0.0 );

return benchmark;

Expand All @@ -74,13 +74,13 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
zscal( zx.length, za, zx, 1 );
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
zscal( x.length, alpha, x, 1 );
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var zxbuf;
var za;
var zx;
var alpha;
var xbuf;
var x;

zxbuf = uniform( len*2, -100.0, 100.0, options );
zx = new Complex128Array( zxbuf.buffer );
xbuf = uniform( len*2, -100.0, 100.0, options );
x = new Complex128Array( xbuf.buffer );

za = new Complex128( 1.0, 0.0 );
alpha = new Complex128( 1.0, 0.0 );

return benchmark;

Expand All @@ -69,13 +69,13 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
zscal( zx.length, za, zx, 1, 0 );
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
zscal( x.length, alpha, x, 1, 0 );
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not retu 6D40 rn NaN' );
}
}
b.toc();
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ var options = {
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var zxbuf;
var za;
var zx;
var alpha;
var xbuf;
var x;

zxbuf = uniform( len*2, -100.0, 100.0, options );
zx = new Complex128Array( zxbuf.buffer );
xbuf = uniform( len*2, -100.0, 100.0, options );
x = new Complex128Array( xbuf.buffer );

za = new Complex128( 1.0, 0.0 );
alpha = new Complex128( 1.0, 0.0 );

return benchmark;

Expand All @@ -74,13 +74,13 @@ function createBenchmark( len ) {

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
zscal( zx.length, za, zx, 1, 0 );
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
zscal( x.length, alpha, x, 1, 0 );
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( zxbuf[ i%(len*2) ] ) ) {
if ( isnan( xbuf[ i%(len*2) ] ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,27 @@ static double rand_double( void ) {
* @return elapsed time in seconds
*/
static double benchmark1( int iterations, int len ) {
stdlib_complex128_t za;
double zx[ len*2 ];
stdlib_complex128_t alpha;
double x[ len*2 ];
double elapsed;
double t;
int i;

za = stdlib_complex128( 1.0, 0.0 );
alpha = stdlib_complex128( 1.0, 0.0 );
for ( i = 0; i < len*2; i+=2 ) {
zx[ i ] = ( rand_double()*2.0 ) - 1.0;
zx[ i+1 ] = ( rand_double()*2.0 ) - 1.0;
x[ i ] = ( rand_double()*2.0 ) - 1.0;
x[ i+1 ] = ( rand_double()*2.0 ) - 1.0;
}
t = tic();
for ( i = 0; i < iterations; i++ ) {
c_zscal( len, za, (void *)zx, 1 );
if ( zx[ 0 ] != zx[ 0 ] ) {
c_zscal( len, alpha, (void *)x, 1 );
if ( x[ 0 ] != x[ 0 ] ) {
printf( "should not return NaN\n" );
break;
}
}
elapsed = tic() - t;
if ( zx[ 0 ] != zx[ 0 ] ) {
if ( x[ 0 ] != x[ 0 ] ) {
printf( "should not return NaN\n" );
}
return elapsed;
Expand All @@ -130,27 +130,27 @@ static double benchmark1( int iterations, int len ) {
* @return elapsed time in seconds
*/
static double benchmark2( int iterations, int len ) {
stdlib_complex128_t za;
double zx[ len*2 ];
stdlib_complex128_t alpha;
double x[ len*2 ];
double elapsed;
double t;
int i;

za = stdlib_complex128( 1.0, 0.0 );
alpha = stdlib_complex128( 1.0, 0.0 );
for ( i = 0; i < len*2; i+=2 ) {
zx[ i ] = ( rand_double()*2.0 ) - 1.0;
zx[ i+1 ] = ( rand_double()*2.0 ) - 1.0;
x[ i ] = ( rand_double()*2.0 ) - 1.0;
x[ i+1 ] = ( rand_double()*2.0 ) - 1.0;
}
t = tic();
for ( i = 0; i < iterations; i++ ) {
c_zscal_ndarray( len, za, (void *)zx, 1, 0 );
if ( zx[ 0 ] != zx[ 0 ] ) {
c_zscal_ndarray( len, alpha, (void *)x, 1, 0 );
if ( x[ 0 ] != x[ 0 ] ) {
printf( "should not return NaN\n" );
break;
}
}
elapsed = tic() - t;
if ( zx[ 0 ] != zx[ 0 ] ) {
if ( x[ 0 ] != x[ 0 ] ) {
printf( "should not return NaN\n" );
}
return elapsed;
Expand Down
10000
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ double precision function benchmark( iterations, len )
! ..
! External functions:
interface
subroutine zscal( N, za, zx, strideX )
complex(kind=kind(0.0d0)) :: za, zx(*)
subroutine zscal( N, alpha, x, strideX )
complex(kind=kind(0.0d0)) :: alpha, x(*)
integer :: strideX, N
end subroutine zscal
end interface
Expand All @@ -142,7 +142,7 @@ end subroutine zscal
complex(kind=kind(0.0d0)), allocatable :: x(:)
! ..
! Local scalar:
complex(kind=kind(0.0d0)) :: za
complex(kind=kind(0.0d0)) :: alpha
! ..
! Intrinsic functions:
intrinsic random_number, cpu_time, cmplx
Expand All @@ -152,7 +152,7 @@ end subroutine zscal
! ..
call random_number( r1 )
call random_number( r2 )
za = cmplx( (r1*1.0d0), (r2*0.0d0), kind=kind(0.0d0) )
alpha = cmplx( (r1*1.0d0), (r2*0.0d0), kind=kind(0.0d0) )
do i = 1, len
call random_number( r1 )
call random_number( r2 )
Expand All @@ -162,7 +162,7 @@ end subroutine zscal
call cpu_time( t1 )
! ..
do i = 1, iterations
call zscal( len, za, x, 1 );
call zscal( len, alpha, x, 1 );
if ( x( 1 ) /= x( 1 ) ) then
print '(A)', 'should not return NaN'
exit
Expand Down Expand Up @@ -219,4 +219,4 @@ subroutine main()
end do
call print_summary( count, count )
end subroutine main
end program bench
end program bench
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ var addon = require( './../src/addon.node' );
* // x => <Complex128Array>[ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ]
*/
function zscal( N, alpha, x, strideX, offsetX ) {
var viewZX = reinterpret( x, 0 );
addon.ndarray( N, alpha, viewZX, strideX, offsetX );
var viewX = reinterpret( x, 0 );
addon.ndarray( N, alpha, viewX, strideX, offsetX );
return x;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/blas/base/zscal/lib/zscal.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ var addon = require( './../src/addon.node' );
* // x => <Complex128Array>[ -2.0, 6.0, -2.0, 14.0, -2.0, 22.0 ]
*/
function zscal( N, alpha, x, strideX ) {
var viewZX = reinterpret( x, 0 );
addon( N, alpha, viewZX, strideX );
var viewX = reinterpret( x, 0 );
addon( N, alpha, viewX, strideX );
return x;
}

Expand Down
18 changes: 9 additions & 9 deletions lib/node_modules/@stdlib/blas/base/zscal/src/zscal.f
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@
! > * We will gladly answer any questions regarding the software. If a modification is done, however, it is the responsibility of the person who modified the routine to provide support.
!
! @param {integer} N - number of indexed elements
! @param {complex<double>} za - scalar constant
! @param {Array<complex<double>>} zx - input array
! @param {integer} strideX - `zx` stride length
! @param {complex<double>} alpha - scalar constant
! @param {Array<complex<double>>} x - input array
! @param {integer} strideX - `x` stride length
!<
subroutine zscal( N, za, zx, strideX )
subroutine zscal( N, alpha, x, strideX )
implicit none
! ..
! Scalar arguments:
complex(kind=kind(0.0d0)) :: za
complex(kind=kind(0.0d0)) :: alpha
integer :: strideX, N
! ..
! Array arguments:
complex(kind=kind(0.0d0)) :: zx(*)
complex(kind=kind(0.0d0)) :: x(*)
! ..
! Local scalars:
integer :: ix, i
Expand All @@ -72,14 +72,14 @@ subroutine zscal( N, za, zx, strideX )
! ..
if ( strideX == 1 ) then
do i = 1, N
zx(i) = za * zx(i)
x(i) = alpha * x(i)
end do
else
ix = 1
do i = 1, N
zx(ix) = za * zx(ix)
x(ix) = alpha * x(ix)
ix = ix + strideX
end do
end if
return
end subroutine zscal
end subroutine zscal
Loading
0