Skip to content

Commit 7f7fb0b

Browse files
committed
Add C implementation for @stdlib/stats/base/dists/planck/mode
--- 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: na --- --- 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: na --- --- 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: na ---
1 parent 501db1b commit 7f7fb0b

File tree

15 files changed

+116
-116
lines changed

15 files changed

+116
-116
lines changed

lib/node_modules/@stdlib/stats/base/dists/planck/mode/README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ for ( i = 0; i < lambda.length; i++ ) {
126126

127127
## C APIs
128128

129-
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
129+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
130130

131131
<section class="intro">
132132

@@ -146,10 +146,10 @@ for ( i = 0; i < lambda.length; i++ ) {
146146

147147
#### stdlib_base_dists_planck_mode( lambda )
148148

149-
Evaluates the mode for an planck distribution.
149+
Evaluates the mode for planck distribution.
150150

151151
```c
152-
double out = stdlib_base_dists_planck_mean( 0.1 );
152+
double out = stdlib_base_dists_planck_mode( 0.1 );
153153
// returns ~0
154154
```
155155

@@ -160,6 +160,7 @@ The function accepts the following arguments:
160160
```c
161161
double stdlib_base_dists_planck_mode( const double lambda );
162162
```
163+
163164
</section>
164165
165166
<!-- /.usage -->
@@ -184,18 +185,18 @@ double stdlib_base_dists_planck_mode( const double lambda );
184185
#include <stdio.h>
185186
186187
static double random_uniform( const double min, const double max ) {
187-
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
188-
return min + ( v * (max - min) );
188+
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
189+
return min + ( v * (max - min) );
189190
}
190191
int main( void ) {
191-
double lambda;
192-
double y;
193-
int i;
194-
for ( i = 0; i < 25; i++ ) {
195-
lambda = random_uniform( 0.1, 10.0 );
196-
y = stdlib_base_dists_planck_mode( lambda );
197-
printf( "lambda: %lf, E(X;λ): %lf\n", lambda, y );
198-
}
192+
double lambda;
193+
double y;
194+
int i;
195+
for ( i = 0; i < 25; i++ ) {
196+
lambda = random_uniform( 0.1, 10.0 );
197+
y = stdlib_base_dists_planck_mode( lambda );
198+
printf( "lambda: %lf, E(X;λ): %lf\n", lambda, y );
199+
}
199200
}
200201
```
201202

lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/benchmark.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* distributed under the License is distributed on an "AS IS" BASIS,
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
16-
* limitations under the License.
16+
* limitations under the License .
1717
*/
1818

1919
'use strict';
@@ -22,7 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var Float64Array = require( '@stdlib/array/float64' );
25-
var randu = require( '@stdlib/random/base/randu' );
25+
var uniform = require( '@stdlib/random/base/uniform' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var pkg = require( './../package.json' ).name;
2828
var mode = require( './../lib' );
@@ -39,7 +39,7 @@ bench( pkg, function benchmark( b ) {
3939
len = 100;
4040
lambda = new Float64Array( len );
4141
for ( i = 0; i < len; i++ ) {
42-
lambda[ i ] = ( randu() * 10.0 ) + 1.0;
42+
lambda[ i ] = uniform(0.1, 11);
4343
}
4444

4545
b.tic();

lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/benchmark.native.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* distributed under the License is distributed on an "AS IS" BASIS,
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
16-
* limitations under the License.
16+
* limitations under the License .
1717
*/
1818

1919
'use strict';
@@ -23,7 +23,7 @@
2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
2525
var Float64Array = require( '@stdlib/array/float64' );
26-
var randu = require( '@stdlib/random/base/randu' );
26+
var uniform = require( '@stdlib/random/base/uniform' );
2727
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2828
var tryRequire = require( '@stdlib/utils/try-require' );
2929
var pkg = require( './../package.json' ).name;
@@ -48,7 +48,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4848
len = 100;
4949
lambda = new Float64Array( len );
5050
for ( i = 0; i < len; i++ ) {
51-
lambda[ i ] = ( randu() * 10.0 ) + 1.0;
51+
lambda[ i ] = uniform(0.1, 11);
5252
}
5353

5454
b.tic();

lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# distributed under the License is distributed on an "AS IS" BASIS,
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
# See the License for the specific language governing permissions and
16-
# limitations under the License.
16+
# limitations under the License .
1717
#/
1818

1919
# VARIABLES #

lib/node_modules/@stdlib/stats/base/dists/planck/mode/benchmark/c/benchmark.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* distributed under the License is distributed on an "AS IS" BASIS,
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
16-
* limitations under the License.
16+
* limitations under the License .
1717
*/
1818

1919
#include "stdlib/stats/base/dists/planck/mode.h"

lib/node_modules/@stdlib/stats/base/dists/planck/mode/examples/c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# distributed under the License is distributed on an "AS IS" BASIS,
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
# See the License for the specific language governing permissions and
16-
# limitations under the License.
16+
# limitations under the License .
1717
#/
1818

1919
# VARIABLES #

lib/node_modules/@stdlib/stats/base/dists/planck/mode/examples/c/example.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ static double random_uniform( const double min, const double max ) {
2424
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
2525
return min + ( v*(max-min) );
2626
}
27-
2827
int main( void ) {
2928
double lambda;
3029
double y;

lib/node_modules/@stdlib/stats/base/dists/planck/mode/include/stdlib/stats/base/dists/planck/mode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C" {
2727
#endif
2828

2929
/**
30-
* Evaluates the mode for planck distribution.
30+
* Evaluates the mode for planck distribution.
3131
*/
3232
double stdlib_base_dists_planck_mode( const double lambda );
3333

lib/node_modules/@stdlib/stats/base/dists/planck/mode/lib/native.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* distributed under the License is distributed on an "AS IS" BASIS,
1414
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
* See the License for the specific language governing permissions and
16-
* limitations under the License.
16+
* limitations under the License .
1717
*/
1818

1919
'use strict';
@@ -26,19 +26,19 @@ var addon = require( './../src/addon.node' );
2626
// MAIN //
2727

2828
/**
29-
* Evaluates the mode for a Planck distribution with shape parameter `lambda`.
29+
* Returns the mode for Planck distribution with shape parameter `lambda`.
3030
*
3131
* @private
3232
* @param {number} lambda - shape parameter
3333
* @returns {number} mode
3434
*
3535
* @example
3636
* var y = mode( 0.1 );
37-
* // returns 0
37+
* // returns 0.0
3838
*
3939
* @example
4040
* var y = mode( 1.5 );
41-
* // returns 0
41+
* // returns 0.0
4242
*
4343
* @example
4444
* var y = mode( NaN );
Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,85 @@
11
{
2-
"options": {
2+
"options": {
3+
"task": "build",
4+
"wasm": false
5+
},
6+
"fields": [
7+
{
8+
"field": "src",
9+
"resolve": true,
10+
"relative": true
11+
},
12+
{
13+
"field": "include",
14+
"resolve": true,
15+
"relative": true
16+
},
17+
{
18+
"field": "libraries",
19+
"resolve": false,
20+
"relative": false
21+
},
22+
{
23+
"field": "libpath",
24+
"resolve": true,
25+
"relative": false
26+
}
27+
],
28+
"confs": [
29+
{
330
"task": "build",
4-
"wasm": false
31+
"wasm": false,
32+
"src": [
33+
"./src/main.c"
34+
],
35+
"include": [
36+
"./include"
37+
],
38+
"libraries": [],
39+
"libpath": [],
40+
"dependencies": [
41+
"@stdlib/math/base/napi/unary",
42+
"@stdlib/math/base/special/asin",
43+
"@stdlib/math/base/assert/is-nan",
44+
"@stdlib/math/base/special/sqrt",
45+
"@stdlib/constants/float64/pi"
46+
]
47+
},
48+
{
49+
"task": "benchmark",
50+
"wasm": false,
51+
"src": [
52+
"./src/main.c"
53+
],
54+
"include": [
55+
"./include"
56+
],
57+
"libraries": [],
58+
"libpath": [],
59+
"dependencies": [
60+
"@stdlib/math/base/special/asin",
61+
"@stdlib/math/base/assert/is-nan",
62+
"@stdlib/math/base/special/sqrt",
63+
"@stdlib/constants/float64/pi"
64+
]
565
},
6-
"fields": [
7-
{
8-
"field": "src",
9-
"resolve": true,
10-
"relative": true
11-
},
12-
{
13-
"field": "include",
14-
"resolve": true,
15-
"relative": true
16-
},
17-
{
18-
"field": "libraries",
19-
"resolve": false,
20-
"relative": false
21-
},
22-
{
23-
"field": "libpath",
24-
"resolve": true,
25-
"relative": false
26-
}
27-
],
28-
"confs": [
29-
{
30-
"task": "build",
31-
"wasm": false,
32-
"src": [
33-
"./src/main.c"
34-
],
35-
"include": [
36-
"./include"
37-
],
38-
"libraries": [],
39-
"libpath": [],
40-
"dependencies": [
41-
"@stdlib/math/base/napi/unary",
42-
"@stdlib/math/base/assert/is-nan",
43-
"@stdlib/math/base/special/asin",
44-
"@stdlib/math/base/special/sqrt",
45-
"@stdlib/constants/float64/pi"
46-
]
47-
},
48-
{
49-
"task": "benchmark",
50-
"wasm": false,
51-
"src": [
52-
"./src/main.c"
53-
],
54-
"include": [
55-
"./include"
56-
],
57-
"libraries": [],
58-
"libpath": [],
59-
"dependencies": [
60-
"@stdlib/math/base/assert/is-nan",
61-
"@stdlib/math/base/special/asin",
62-
"@stdlib/math/base/special/sqrt",
63-
"@stdlib/constants/float64/pi"
64-
]
65-
},
66-
{
67-
"task": "examples",
68-
"wasm": false,
69-
"src": [
70-
"./src/main.c"
71-
],
72-
"include": [
73-
"./include"
74-
],
75-
"libraries": [],
76-
"libpath": [],
77-
"dependencies": [
78-
"@stdlib/math/base/assert/is-nan",
79-
"@stdlib/math/base/special/asin",
80-
"@stdlib/math/base/special/sqrt",
81-
"@stdlib/constants/float64/pi"
82-
]
83-
}
84-
]
85-
}
66+
{
67+
"task": "examples",
68+
"wasm": false,
69+
"src": [
70+
"./src/main.c"
71+
],
72+
"include": [
73+
"./include"
74+
],
75+
"libraries": [],
76+
"libpath": [],
77+
"dependencies": [
78+
"@stdlib/math/base/special/asin",
79+
"@stdlib/math/base/assert/is-nan",
80+
"@stdlib/math/base/special/sqrt",
81+
"@stdlib/constants/float64/pi"
82+
]
83+
}
84+
]
85+
}

0 commit comments

Comments
 (0)