@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 2.79 kB
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import e from"./../../utils/define-nonenumerable-read-only-property.js";import n from"./../../utils/define-nonenumerable-read-only-accessor.js";import t from"./../../utils/define-nonenumerable-read-write-accessor.js";import r from"./../../assert/is-plain-object.js";import o from"./../../assert/is-function.js";import i from"./../../assert/has-own-property.js";import s from"./../../utils/constant-function.js";import a from"./../../utils/noop.js";import u from"./mt19937.js";import m from"./../../math/base/assert/is-nan.js";import p from"./../../array/to-json.js";import f from"./../../assert/is-number.js";import l from"./../../assert/is-positive-number.js";import g from"./../../assert/is-nan.js";import c from"./../../stats/base/dists/cosine/quantile.js";var d=f.isPrimitive,b=l.isPrimitive,h=g;function j(e,n){return!d(e)||h(e)?new TypeError("invalid argument. `mu` must be a number primitive and not `NaN`. Value: `"+e+"`."):b(n)?null:new TypeError("invalid argument. `s` must be a positive number. Value: `"+n+"`.")}var v=c;function y(e,n,t){return v(e(),n,t)}var w=e,N=n,L=t,E=r,O=o,T=i,P=s,V=a,G=u.factory,R=m,A=p,J=j,M=y;function S(){var e,n,t,r,o,i;if(0===arguments.length)n=G();else if(1===arguments.length){if(!E(e=arguments[0]))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+e+"`.");if(T(e,"prng")){if(!O(e.prng))throw new TypeError("invalid option. `prng` option must be a pseudorandom number generator function. Option: `"+e.prng+"`.");n=e.prng}else n=G(e)}else{if(r=J(o=arguments[0],i=arguments[1]))throw r;if(arguments.length>2){if(!E(e=arguments[2]))throw new TypeError("invalid argument. Options argument must be an object. Value: `"+e+"`.");if(T(e,"prng")){if(!O(e.prng))throw new TypeError("invalid option. `prng` option must be a pseudorandom number generator function. Option: `"+e.prng+"`.");n=e.prng}else n=G(e)}else n=G()}return w(t=void 0===o?c:g,"NAME","cosine"),e&&e.prng?(w(t,"seed",null),w(t,"seedLength",null),L(t,"state",P(null),V),w(t,"stateLength",null),w(t,"byteLength",null),w(t,"toJSON",P(null)),w(t,"PRNG",n)):(N(t,"seed",s),N(t,"seedLength",a),L(t,"state",p,f),N(t,"stateLength",u),N(t,"byteLength",m),w(t,"toJSON",l),w(t,"PRNG",n),n=n.normalized),t;function s(){return n.seed}function a(){return n.seedLength}function u(){return n.stateLength}function m(){return n.byteLength}function p(){return n.state}function f(e){n.state=e}function l(){var e={type:"PRNG"};return e.name=t.NAME,e.state=A(n.state),e.params=void 0===o?[]:[o,i],e}function g(){return M(n,o,i)}function c(e,t){return R(e)||R(t)||t<=0?NaN:M(n,e,t)}}var q=S,x=q(),z=e,k=x,B=S;z(k,"factory",B);export default k;
//# sourceMappingURL=cosine.js.map