|
| 1 | +<!-- |
| 2 | +
|
| 3 | +@license Apache-2.0 |
| 4 | +
|
| 5 | +Copyright (c) 2025 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 | +# dcumax |
| 22 | + |
| 23 | +> Compute the cumulative maximum value of a one-dimensional double-precision floating-point ndarray. |
| 24 | +
|
| 25 | +<section class="intro"> |
| 26 | + |
| 27 | +</section> |
| 28 | + |
| 29 | +<!-- /.intro --> |
| 30 | + |
| 31 | +<section class="usage"> |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +```javascript |
| 36 | +var dcumax = require( '@stdlib/stats/base/ndarray/dcumax' ); |
| 37 | +``` |
| 38 | + |
| 39 | +#### dcumax( arrays ) |
| 40 | + |
| 41 | +Computes the cumulative maximum value of a one-dimensional double-precision floating-point ndarray. |
| 42 | + |
| 43 | +```javascript |
| 44 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 45 | +var ndarray2array = require( '@stdlib/ndarray/to-array' ); |
| 46 | +var ndarray = require( '@stdlib/ndarray/base/ctor' ); |
| 47 | + |
| 48 | +var xbuf = new Float64Array( [ 1.0, 3.0, 4.0, 2.0 ] ); |
| 49 | +var x = new ndarray( 'float64', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); |
| 50 | + |
| 51 | +var ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); |
| 52 | +var y = new ndarray( 'float64', xbuf, [ 4 ], [ 1 ], 0, 'row-major' ); |
| 53 | + |
| 54 | +var v = dcumax( [ x, y ] ); |
| 55 | +// returns <ndarray> |
| 56 | + |
| 57 | +var bool = ( v === y ); |
| 58 | +// returns true |
| 59 | + |
| 60 | +var arr = ndarray2array( v ); |
| 61 | +// returns [ 1.0, 3.0, 4.0, 4.0 ] |
| 62 | +``` |
| 63 | + |
| 64 | +The function has the following parameters: |
| 65 | + |
| 66 | +- **arrays**: array-like object containing a one-dimensional input ndarray and a one-dimensional output ndarray. |
| 67 | + |
| 68 | +</section> |
| 69 | + |
| 70 | +<!-- /.usage --> |
| 71 | + |
| 72 | +<section class="notes"> |
| 73 | + |
| 74 | +## Notes |
| 75 | + |
| 76 | +- If provided an empty one-dimensional input ndarray, the function returns the output ndarray unchanged. |
| 77 | + |
| 78 | +</section> |
| 79 | + |
| 80 | +<!-- /.notes --> |
| 81 | + |
| 82 | +<section class="examples"> |
| 83 | + |
| 84 | +## Examples |
| 85 | + |
| 86 | +<!-- eslint no-undef: "error" --> |
| 87 | + |
| 88 | +```javascript |
| 89 | +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); |
| 90 | +var ndarray = require( '@stdlib/ndarray/base/ctor' ); |
| 91 | +var zerosLike = require( '@stdlib/ndarray/zeros-like' ); |
| 92 | +var ndarray2array = require( '@stdlib/ndarray/to-array' ); |
| 93 | +var dcumax = require( '@stdlib/stats/base/ndarray/dcumax' ); |
| 94 | + |
| 95 | +var xbuf = discreteUniform( 10, -50, 50, { |
| 96 | + 'dtype': 'float64' |
| 97 | +}); |
| 98 | +var x = new ndarray( 'float64', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' ); |
| 99 | +console.log( ndarray2array( x ) ); |
| 100 | + |
| 101 | +var y = zerosLike( x ); |
| 102 | +console.log( ndarray2array( y ) ); |
| 103 | + |
| 104 | +var v = dcumax( [ x, y ] ); |
| 105 | +console.log( ndarray2array( v ) ); |
| 106 | +``` |
| 107 | + |
| 108 | +</section> |
| 109 | + |
| 110 | +<!-- /.examples --> |
| 111 | + |
| 112 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 113 | + |
| 114 | +<section class="related"> |
| 115 | + |
| 116 | +</section> |
| 117 | + |
| 118 | +<!-- /.related --> |
| 119 | + |
| 120 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 121 | + |
| 122 | +<section class="links"> |
| 123 | + |
| 124 | +</section> |
| 125 | + |
| 126 | +<!-- /.links --> |
0 commit comments