feat: add math/base/special/boxcoxf#10150
feat: add math/base/special/boxcoxf#10150navyansh007 wants to merge 4 commits intostdlib-js:developfrom
math/base/special/boxcoxf#10150Conversation
…files
---
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: passed
- 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: passed
- task: lint_c_examples
status: passed
- task: lint_c_benchmarks
status: passed
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
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: na
- 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: missing_dependencies
- 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: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
…pecial/boxcoxf
---
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: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- 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: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
---
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: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: missing_dependencies
- task: lint_r
status: na
- task: lint_c_src
status: passed
- task: lint_c_examples
status: passed
- task: lint_c_benchmarks
status: passed
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
| var abs = require( '@stdlib/math/base/special/abs' ); | ||
| var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
| var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); | ||
| var lnf = require( '@stdlib/math/base/special/lnf' ); | ||
| var expm1 = require( '@stdlib/math/base/special/expm1' ); |
There was a problem hiding this comment.
@navyansh007 Any reasons to use double-precision functions here instead of single-precision ones?
| var abs = require( '@stdlib/math/base/special/abs' ); | |
| var isnan = require( '@stdlib/math/base/assert/is-nan' ); | |
| var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' ); | |
| var lnf = require( '@stdlib/math/base/special/lnf' ); | |
| var expm1 = require( '@stdlib/math/base/special/expm1' ); | |
| var absf = require( '@stdlib/math/base/special/absf' ); | |
| var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); | |
| var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' ); | |
| var lnf = require( '@stdlib/math/base/special/lnf' ); | |
| var expm1f = require( '@stdlib/math/base/special/expm1f' ); |
There was a problem hiding this comment.
Thanks @gunjjoshi. My mistake- I copied the imports directly from math/base/special/boxcox/lib/main.js without switching them to the single-precision equivalents. I'll update abs, isnan, and isPositiveZero to absf, isnanf, and isPositiveZerof.
However, expm1f doesn't currently exist in stdlib, so I'm keeping the double-precision expm1 and casting the result to float32- this matches the approach used in the C implementation as well.
| // MAIN // | ||
|
|
||
| /** | ||
| * Computes a one-parameter Box-Cox transformation for single-precision floating-point number. |
There was a problem hiding this comment.
| * Computes a one-parameter Box-Cox transformation for single-precision floating-point number. | |
| * Computes a one-parameter Box-Cox transformation for a single-precision floating-point number. |
|
|
||
| /** | ||
| * Computes a one-parameter Box-Cox transformation for single-precision floating-point number. | ||
| * |
There was a problem hiding this comment.
@navyansh007 We are missing the "Method" description here, which is present in boxcox
There was a problem hiding this comment.
I intentionally left out the Method section because the one in boxcox is specifically a numerical analysis for double-precision (float64). It derives the threshold 1.0e-19 from the float64 epsilon and the range of ln for double-precision numbers. Copying it as-is didn't seem correct to me for boxcoxf, since float32 has a larger epsilon and a different log range, which is why the threshold here is 1.0e-10 instead. I'd be happy to add a Method section with the corresponding float32 analysis. Would you be able to point me in the right direction on how to best frame that, or should I follow the same derivation approach as boxcox but with single-precision constants?
| { | ||
| "name": "@stdlib/math/base/special/boxcoxf", | ||
| "version": "0.0.0", | ||
| "description": "Compute a one-parameter Box-Cox transformation for single-precision floating-point number.", |
There was a problem hiding this comment.
| "description": "Compute a one-parameter Box-Cox transformation for single-precision floating-point number.", | |
| "description": "Compute a one-parameter Box-Cox transformation for a single-precision floating-point number.", |
|
|
||
| # boxcoxf | ||
|
|
||
| > Compute a one-parameter [Box-Cox transformation][box-cox-transformation] for single-precision floating-point number. |
There was a problem hiding this comment.
| > Compute a one-parameter [Box-Cox transformation][box-cox-transformation] for single-precision floating-point number. | |
| > Compute a one-parameter [Box-Cox transformation][box-cox-transformation] for a single-precision floating-point number. |
Let's use 'a' here and everywhere else in this PR too.
| float r; | ||
| double t; |
There was a problem hiding this comment.
| float r; | |
| double t; | |
| double t; | |
| float r; |
Resolves #10149
Description
This pull request:
@stdlib/math/base/special/boxcoxf, a single-precision floating-point one-parameter Box-Cox transformationRelated Issues
This pull request has the following related issues:
@stdlib/math/base/special/boxcoxf#10149Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
@stdlib-js/reviewers