@zukhruf/statistics 0.8.273 → 0.8.275

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -41,6 +41,7 @@ nanmean([1, NaN, 3]); // 2, as numpy.nanmean(a)
41
41
  | Export | NumPy, SciPy or arch | What it does |
42
42
  | -------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
43
43
  | `sum` | `numpy.sum` of a 1-D float64 array | The pairwise sum of NumPy: blocks of up to 128 values in 8 accumulators, and two halves for more values. It starts from 0, so values of −0 give 0. No values give 0. |
44
+ | `addReduceat` | `numpy.add.reduceat` of a 1-D float64 array for increasing starts | Each segment is its first value plus the pairwise sum of the rest, and the last runs to the end. A start outside the values is a `RangeError`, where NumPy raises an `IndexError`. |
44
45
  | `mean` | `numpy.mean` of a 1-D float64 array | `sum` divided by the number of values. No values give NaN. |
45
46
  | `nanmean` | `numpy.nanmean` of a 1-D float64 array | Each NaN becomes 0, `sum` adds all the values, and the sum is divided by the number of values that are not NaN. A `mean` of only the values that are not NaN can give other last bits. No values, or only NaN values, give NaN. |
46
47
  | `std` | `numpy.std` of a 1-D float64 array, with its `ddof` | The square root of the `sum` of the squared deviations from the `mean`, divided by n − `ddof`. `ddof` is 0 by default (the population standard deviation), and `ddof: 1` gives the sample standard deviation. No values give NaN. A `ddof` of n or more divides by 0: NaN or Infinity, as NumPy gives them. |
@@ -103,6 +104,11 @@ Each error is a `RangeError`. Its message says which input is out of range.
103
104
  ```ts
104
105
  // numpy.sum, numpy.mean, numpy.nanmean and numpy.std of a 1-D float64 array.
105
106
  function sum(values: ArrayLike<number>): number;
107
+ // numpy.add.reduceat for increasing starts; throws RangeError for a start outside the values.
108
+ function addReduceat(
109
+ values: ArrayLike<number>,
110
+ starts: readonly number[],
111
+ ): number[];
106
112
  function mean(values: ArrayLike<number>): number;
107
113
  function nanmean(values: ArrayLike<number>): number;
108
114
  function std(
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { InvertedCdf } from './quantile/inverted-cdf.ts';
11
11
  export { Linear } from './quantile/linear.ts';
12
12
  export { Lower } from './quantile/lower.ts';
13
13
  export { QuantileMethod } from './quantile/quantile-method.ts';
14
+ export { addReduceat } from './sum/add-reduceat.ts';
14
15
  export { mean } from './sum/mean.ts';
15
16
  export { nanmean } from './sum/nanmean.ts';
16
17
  export { std } from './sum/std.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,YAAY,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,YAAY,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,YAAY,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,YAAY,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export { InvertedCdf } from './quantile/inverted-cdf.js';
9
9
  export { Linear } from './quantile/linear.js';
10
10
  export { Lower } from './quantile/lower.js';
11
11
  export { QuantileMethod } from './quantile/quantile-method.js';
12
+ export { addReduceat } from './sum/add-reduceat.js';
12
13
  export { mean } from './sum/mean.js';
13
14
  export { nanmean } from './sum/nanmean.js';
14
15
  export { std } from './sum/std.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function addReduceat(values: ArrayLike<number>, starts: readonly number[]): number[];
2
+ //# sourceMappingURL=add-reduceat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-reduceat.d.ts","sourceRoot":"","sources":["../../src/sum/add-reduceat.ts"],"names":[],"mappings":"AAMA,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,EACzB,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,MAAM,EAAE,CAUV"}
@@ -0,0 +1,15 @@
1
+ import gsumpw from '@stdlib/blas-ext-base-gsumpw';
2
+ // numpy.add.reduceat of a 1-D float64 array for increasing starts: each
3
+ // segment is its first value plus numpy's pairwise sum of the rest, and the
4
+ // segment of the last start runs to the end of the values. A start outside
5
+ // the values is a RangeError, where NumPy raises an IndexError.
6
+ export function addReduceat(values, starts) {
7
+ return starts.map((start, index) => {
8
+ const first = values[start];
9
+ if (first === undefined)
10
+ throw new RangeError(`index ${start} out-of-bounds in add.reduceat [0, ${values.length})`);
11
+ const end = starts[index + 1] ?? values.length;
12
+ return first + gsumpw.ndarray(end - start - 1, values, 1, start + 1);
13
+ });
14
+ }
15
+ //# sourceMappingURL=add-reduceat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-reduceat.js","sourceRoot":"","sources":["../../src/sum/add-reduceat.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,8BAA8B,CAAC;AAElD,wEAAwE;AACxE,4EAA4E;AAC5E,2EAA2E;AAC3E,gEAAgE;AAChE,MAAM,UAAU,WAAW,CACzB,MAAyB,EACzB,MAAyB;IAEzB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACjC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,KAAK,KAAK,SAAS;YACrB,MAAM,IAAI,UAAU,CAClB,SAAS,KAAK,sCAAsC,MAAM,CAAC,MAAM,GAAG,CACrE,CAAC;QACJ,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC;QAC/C,OAAO,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,GAAG,KAAK,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/statistics",
3
- "version": "0.8.273",
3
+ "version": "0.8.275",
4
4
  "description": "The percentile bootstrap, NumPy's quantile methods, and the sum, mean, nanmean and std of NumPy in JavaScript, to the last bit: resamples with a random generator that the caller gives, the percentile interval of their statistic, and NumPy's pairwise sum.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -43,6 +43,6 @@
43
43
  "@stdlib/blas-ext-base-gsumpw": "^0.3.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@zukhruf/parameterized-test": "^0.8.273"
46
+ "@zukhruf/parameterized-test": "^0.8.275"
47
47
  }
48
48
  }