From b281eb78aaa3470e7c7752bc2e9fa603891ed7e1 Mon Sep 17 00:00:00 2001 From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com> Date: Sun, 12 Jan 2025 18:10:35 +0530 Subject: [PATCH] fix: updated function to support ndarray --- 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: na - 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: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed --- --- .../stats/base/dvariancepn/lib/ndarray.native.js | 2 +- .../@stdlib/stats/base/dvariancepn/src/main.c | 8 ++------ .../stats/base/dvariancepn/test/test.ndarray.native.js | 10 +++++----- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dvariancepn/lib/ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dvariancepn/lib/ndarray.native.js index 23d889bc2916..d363f4601601 100644 --- a/lib/node_modules/@stdlib/stats/base/dvariancepn/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/stats/base/dvariancepn/lib/ndarray.native.js @@ -38,7 +38,7 @@ var addon = require( './../src/addon.node' ); * @example * var Float64Array = require( '@stdlib/array/float64' ); * -* var x = new Float64Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] ); +* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); * * var v = dvariancepn( 4, 1, x, 2, 1 ); * // returns 6.25 diff --git a/lib/node_modules/@stdlib/stats/base/dvariancepn/src/main.c b/lib/node_modules/@stdlib/stats/base/dvariancepn/src/main.c index 905e11ffa804..191a0f9ed54d 100644 --- a/lib/node_modules/@stdlib/stats/base/dvariancepn/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dvariancepn/src/main.c @@ -73,13 +73,9 @@ double API_SUFFIX(stdlib_strided_dvariancepn_ndarray)( const CBLAS_INT N, const return 0.0; } // Compute an estimate for the mean: - mu = stdlib_strided_dsumpw( N, X, strideX ) / dN; + mu = API_SUFFIX(stdlib_strided_dsumpw_ndarray)( N, X, strideX, offsetX ) / dN; - if ( strideX < 0 ) { - ix = (1-N) * strideX; - } else { - ix = 0; - } + ix = offsetX; // Compute the variance... M2 = 0.0; M = 0.0; diff --git a/lib/node_modules/@stdlib/stats/base/dvariancepn/test/test.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dvariancepn/test/test.ndarray.native.js index 1a70c493aa74..437e464619b4 100644 --- a/lib/node_modules/@stdlib/stats/base/dvariancepn/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/stats/base/dvariancepn/test/test.ndarray.native.js @@ -188,13 +188,13 @@ tape( 'the function supports an `offset` parameter', opts, function test( t ) { x = new Float64Array([ 1.0, - 2.0, // 0 + 1.0, // 0 2.0, - -7.0, // 1 + -2.0, // 1 -2.0, - 3.0, // 2 - 4.0, - 2.0 // 3 + 2.0, // 2 + 3.0, + 4.0 // 3 ]); v = dvariancepn( 4, 1, x, 2, 1 );