time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (2820B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2019 The Stdlib Authors.
      6 
      7 Licensed under the Apache License, Version 2.0 (the "License");
      8 you may not use this file except in compliance with the License.
      9 You may obtain a copy of the License at
     10 
     11    http://www.apache.org/licenses/LICENSE-2.0
     12 
     13 Unless required by applicable law or agreed to in writing, software
     14 distributed under the License is distributed on an "AS IS" BASIS,
     15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 See the License for the specific language governing permissions and
     17 limitations under the License.
     18 
     19 -->
     20 
     21 # itermax
     22 
     23 > Compute the maximum value of all [iterated][mdn-iterator-protocol] values.
     24 
     25 <section class="intro">
     26 
     27 </section>
     28 
     29 <!-- /.intro -->
     30 
     31 <!-- Package usage documentation. -->
     32 
     33 <section class="usage">
     34 
     35 ## Usage
     36 
     37 ```javascript
     38 var itermax = require( '@stdlib/stats/iter/max' );
     39 ```
     40 
     41 #### itermax( iterator )
     42 
     43 Computes the maximum value of all [iterated][mdn-iterator-protocol] values.
     44 
     45 ```javascript
     46 var array2iterator = require( '@stdlib/array/to-iterator' );
     47 
     48 var arr = array2iterator( [ 1.0, -2.0, 3.0, -4.0 ] );
     49 
     50 var m = itermax( arr );
     51 // returns 3.0
     52 ```
     53 
     54 </section>
     55 
     56 <!-- /.usage -->
     57 
     58 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     59 
     60 <section class="notes">
     61 
     62 ## Notes
     63 
     64 -   If an iterated value is non-numeric (including `NaN`), the returned [`iterator`][mdn-iterator-protocol] returns `NaN`. If non-numeric iterated values are possible, you are advised to provide an [`iterator`][mdn-iterator-protocol] which type checks and handles non-numeric values accordingly.
     65 
     66 </section>
     67 
     68 <!-- /.notes -->
     69 
     70 <!-- Package usage examples. -->
     71 
     72 <section class="examples">
     73 
     74 ## Examples
     75 
     76 <!-- eslint no-undef: "error" -->
     77 
     78 ```javascript
     79 var runif = require( '@stdlib/random/iter/uniform' );
     80 var itermax = require( '@stdlib/stats/iter/max' );
     81 
     82 // Create an iterator for generating uniformly distributed pseudorandom numbers:
     83 var rand = runif( -10.0, 10.0, {
     84     'seed': 1234,
     85     'iter': 100
     86 });
     87 
     88 // Compute the maximum value:
     89 var m = itermax( rand );
     90 // returns <number>
     91 
     92 console.log( 'Max: %d.', m );
     93 ```
     94 
     95 </section>
     96 
     97 <!-- /.examples -->
     98 
     99 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    100 
    101 <section class="references">
    102 
    103 </section>
    104 
    105 <!-- /.references -->
    106 
    107 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    108 
    109 <section class="links">
    110 
    111 [mdn-iterator-protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterator_protocol
    112 
    113 </section>
    114 
    115 <!-- /.links -->