repl.txt (1727B)
1 2 {{alias}}( out[, means] ) 3 Returns an accumulator function which incrementally computes a sample 4 Pearson product-moment correlation distance matrix. 5 6 If provided a data vector, the accumulator function returns an updated 7 sample correlation distance matrix. If not provided a data vector, the 8 accumulator function returns the current sample correlation distance matrix. 9 10 Due to limitations inherent in representing numeric values using floating- 11 point format (i.e., the inability to represent numeric values with infinite 12 precision), the correlation distance between perfectly correlated random 13 variables may *not* be `0` or `2`. In fact, the correlation distance is 14 *not* guaranteed to be strictly on the interval [0,2]. Any computed distance 15 should, however, be within floating-point roundoff error. 16 17 Parameters 18 ---------- 19 out: integer|ndarray 20 Order of the correlation distance matrix or a square 2-dimensional 21 ndarray for storing the correlation distance matrix. 22 23 means: ndarray (optional) 24 Known means. 25 26 Returns 27 ------- 28 acc: Function 29 Accumulator function. 30 31 Examples 32 -------- 33 > var accumulator = {{alias}}( 2 ); 34 > var out = accumulator() 35 <ndarray> 36 > var buf = new {{alias:@stdlib/array/float64}}( 2 ); 37 > var shape = [ 2 ]; 38 > var strides = [ 1 ]; 39 > var v = {{alias:@stdlib/ndarray/ctor}}( 'float64', buf, shape, strides, 0, 'row-major' ); 40 > v.set( 0, 2.0 ); 41 > v.set( 1, 1.0 ); 42 > out = accumulator( v ) 43 <ndarray> 44 > v.set( 0, -5.0 ); 45 > v.set( 1, 3.14 ); 46 > out = accumulator( v ) 47 <ndarray> 48 > out = accumulator() 49 <ndarray> 50 51 See Also 52 -------- 53