Skip to content

Commit 4481ce3

Browse files
committed
docs: add note about accessor array support
--- 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: na - task: lint_javascript_benchmarks status: na - 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: 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 ---
1 parent 418d3ec commit 4481ce3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/node_modules/@stdlib/stats/base/nanvariancech/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ var v = nanvariancech.ndarray( 5, 1, x, 2, 1 );
172172
## Notes
173173

174174
- If `N <= 0`, both functions return `NaN`.
175+
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]).
175176
- If `n - c` is less than or equal to `0` (where `c` corresponds to the provided degrees of freedom adjustment and `n` corresponds to the number of non-`NaN` indexed elements), both functions return `NaN`.
176177
- The underlying algorithm is a specialized case of Neely's two-pass algorithm. As the variance is invariant with respect to changes in the location parameter, the underlying algorithm uses the first non-`NaN` strided array element as a trial mean to shift subsequent data values and thus mitigate catastrophic cancellation. Accordingly, the algorithm's accuracy is best when data is **unordered** (i.e., the data is **not** sorted in either ascending or descending order such that the first value is an "extreme" value).
177178
- Depending on the environment, the typed versions ([`dnanvariancech`][@stdlib/stats/strided/dnanvariancech], [`snanvariancech`][@stdlib/stats/base/snanvariancech], etc.) are likely to be significantly more performant.
@@ -273,6 +274,8 @@ console.log( v );
273274

274275
[@stdlib/stats/base/variancech]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/variancech
275276

277+
[@stdlib/array/base/accessor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/accessor
278+
276279
<!-- </related-links> -->
277280

278281
</section>

lib/node_modules/@stdlib/stats/base/nanvariancech/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var ndarray = require( './ndarray.js' );
5353
* // returns ~4.3333
5454
*/
5555
function nanvariancech( N, correction, x, strideX ) {
56-
return ndarray( N, correction, x, strideX, stride2offset( N, strideX) );
56+
return ndarray( N, correction, x, strideX, stride2offset( N, strideX ) );
5757
}
5858

5959

0 commit comments

Comments
 (0)