├── README.md ├── js ├── viz.js ├── crossfilter.min.js ├── colorbrewer.js └── kalman-filter.min.js ├── index.html └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # Course-Constructor 2 | Methods to simplify and streamline the ETL of points to tracks (or courses). This project is just for lolz, so please laugh with me. 3 | -------------------------------------------------------------------------------- /js/viz.js: -------------------------------------------------------------------------------- 1 | function getTops(source_group, num_top) { 2 | return { 3 | all: function () { 4 | return source_group.top(num_top); 5 | } 6 | }; 7 | } 8 | function changeValueAccessor(chart, attribute) { 9 | var redraw = (attribute && attribute.hasOwnProperty('redraw') ? 10 | attribute.redraw : true); 11 | console.log("changeValueAccessor", attribute, redraw); 12 | 13 | chart.valueAccessor( 14 | function (d) { 15 | return d.value[attribute.name]; 16 | } 17 | ).colorDomain( 18 | dataRanges[attribute.name] 19 | ).title( 20 | function (d) { 21 | console.log(d); 22 | return "Fragment: " + d.key + "\n " + attribute.label +": " + decformat(d.value) +' '+ attribute.units; 23 | } 24 | ); 25 | 26 | if (redraw) { 27 | $('[rel="metric"').html(attribute.label); 28 | var chartFilter = chart.filter(); 29 | chart.filter(null) 30 | .filter(chartFilter); 31 | dc.redrawAll(); 32 | } 33 | } 34 | 35 | const processVizData = (data) => { 36 | ndx = crossfilter(data); 37 | 38 | var all = ndx.groupAll(), 39 | addWeightedMean = function (prevValue, newValue, count) { 40 | return ((prevValue * (count - 1)) + newValue) / count; 41 | }, 42 | rmWeightedMean = function (prevValue, oldValue, count) { 43 | if (count === 0) { 44 | return 0; 45 | } else { 46 | return ((prevValue * (count + 1)) - oldValue) / count; 47 | } 48 | }; 49 | dimensions.data = ndx.dimension( 50 | function (d) { 51 | return d.fragment; 52 | } 53 | ); 54 | 55 | groups.data = dimensions.data 56 | .group() 57 | .reduce( 58 | function reduceAdd(p, v) { 59 | p.count += 1; 60 | p.t = addWeightedMean(p.t, v.t, p.count); 61 | p.dist = addWeightedMean(p.dist, v.dist, p.count); 62 | p.kmh = addWeightedMean(p.kmh, v.kmh, p.count); 63 | p.quad_speed += Math.pow(v.kmh, 2); 64 | p.speed_std = (p.count > 1 ? Math.sqrt(Math.pow(p.kmh, 2) - (p.quad_speed / p.count)) : 0); 65 | p.dist_km = addWeightedMean(p.dist_km, v.dist_km, p.count); 66 | p.bearing = addWeightedMean(p.bearing, v.bearing, p.count); 67 | p.abs_bank_diff = addWeightedMean(p.abs_bank_diff, v.abs_bank_diff, p.count); 68 | p.radius = addWeightedMean(p.radius, v.radius, p.count); 69 | p.radius_group = addWeightedMean(p.radius_group, v.radius_group, p.count); 70 | 71 | return p; 72 | }, 73 | function reduceRemove(p, v) { 74 | // console.log(p, v); 75 | 76 | p.count -= 1; 77 | p.t = rmWeightedMean(p.t, v.t, p.count); 78 | p.dist = rmWeightedMean(p.dist, v.dist, p.count); 79 | p.kmh = rmWeightedMean(p.kmh, v.kmh, p.count); 80 | p.quad_speed -= Math.pow(v.kmh, 2); 81 | p.speed_std = (p.count > 1 ? Math.sqrt(Math.pow(p.kmh, 2) - (p.quad_speed / p.count)) : 0); 82 | p.dist_km = rmWeightedMean(p.dist_km, v.dist_km, p.count); 83 | p.bearing = rmWeightedMean(p.bearing, v.bearing, p.count); 84 | p.abs_bank_diff = rmWeightedMean(p.abs_bank_diff, v.abs_bank_diff, p.count); 85 | p.radius = rmWeightedMean(p.radius, v.radius, p.count); 86 | p.radius_group = rmWeightedMean(p.radius_group, v.radius_group, p.count); 87 | 88 | return p; 89 | }, 90 | function reduceInit() { 91 | return { 92 | count: 0, 93 | t: 0, 94 | dist: 0, 95 | kmh: 0, 96 | quad_speed: 0, 97 | speed_std: 0, 98 | dist_km: 0, 99 | bearing: 0, 100 | abs_bank_diff: 0, 101 | radius: 0, 102 | radius_group: 0 103 | }; 104 | } 105 | ); 106 | 107 | dimensions.user = ndx.dimension( 108 | function (d) { 109 | return d.user; 110 | } 111 | ); 112 | 113 | allDim = ndx.dimension(function(d) {return d;}); 114 | 115 | groups.user = dimensions.user.group(); 116 | 117 | dimensions.bearing = ndx.dimension( 118 | function (d) { 119 | return Math.floor(d.bearing / 5) * 5; 120 | } 121 | ); 122 | 123 | groups.bearing = dimensions.bearing.group(); 124 | 125 | dimensions.speed = ndx.dimension( 126 | function (d) { 127 | // return Math.floor(d.kmh / 10) * 10; 128 | if (d.kmh>9999999) return 9999 129 | return d.kmh.toFixed(3); 130 | } 131 | ); 132 | 133 | dataRanges.bearing = d3.extent( 134 | groups.data.all(), 135 | function (d) { 136 | return d.value.bearing; 137 | } 138 | ); 139 | 140 | groups.speed = dimensions.speed.group(); 141 | 142 | dataRanges.speed = d3.extent( 143 | groups.data.all(), 144 | function (d) { 145 | console.log('data ranges: ', d.value); 146 | return d.value.speed; 147 | } 148 | ); 149 | 150 | dimensions.dist_km = ndx.dimension( 151 | function (d) { 152 | return Math.floor(d.dist_km); 153 | } 154 | ); 155 | 156 | groups.dist_km = dimensions.dist_km.group(); 157 | 158 | dataRanges.dist_km = d3.extent( 159 | groups.data.all(), 160 | function (d) { 161 | return d.value.dist_km; 162 | } 163 | ); 164 | 165 | bcDriver 166 | .dimension(dimensions.user) 167 | .group(getTops(groups.user,15)) //groups.user) 168 | .margins(margins) 169 | .x( 170 | d3.scaleOrdinal() 171 | .range([1, 2]) 172 | ) 173 | .y( 174 | d3.scaleLinear() 175 | .domain( 176 | d3.extent( 177 | groups.user.all(), 178 | function (d) { 179 | return d.value; 180 | } 181 | ) 182 | ) 183 | ) 184 | .elasticX(true) 185 | .elasticY(true) 186 | .xAxisLabel('User ID') 187 | .gap(10) 188 | .yAxisLabel('segments') 189 | .xUnits(dc.units.ordinal); 190 | 191 | // bcDriver 192 | // .xAxis() 193 | // .tickValues(['Racer', 'Journalist']); 194 | // console.log('bcDriver--',bcDriver); 195 | 196 | bcRad 197 | .dimension(dimensions.bearing) 198 | .group(groups.bearing) 199 | .margins(margins) 200 | .x( 201 | d3.scaleLinear() 202 | .range([0, 18]) 203 | .domain([0, 70]) 204 | ) 205 | .y( 206 | d3.scaleLinear() 207 | .domain( 208 | d3.extent( 209 | groups.bearing.all(), 210 | function (d) { 211 | return d.value; 212 | } 213 | ) 214 | ) 215 | ) 216 | .elasticX(true) 217 | .elasticY(true) 218 | .xAxisLabel('bearing (degrees)') 219 | .yAxisLabel('segments'); 220 | 221 | console.log('bcRad (bearing)--',bcRad); 222 | 223 | bcSpeed 224 | .dimension(dimensions.speed) 225 | .group(groups.speed) 226 | .margins(margins) 227 | .x( 228 | d3.scaleLinear() 229 | .domain( 230 | d3.extent( 231 | groups.speed.all(), 232 | function (d) { 233 | return d.key; 234 | } 235 | ) 236 | ) 237 | ) 238 | .y( 239 | d3.scaleLinear() 240 | .domain( 241 | d3.extent( 242 | groups.speed.all(), 243 | function (d) { 244 | return d.value; 245 | } 246 | ) 247 | ) 248 | ) 249 | .xAxisLabel('Speed (km/h)') 250 | .yAxisLabel('segments') 251 | .elasticX(true) 252 | .elasticY(true); 253 | 254 | console.log('bcSpeed--',bcSpeed); 255 | 256 | 257 | bcAcc 258 | .dimension(dimensions.dist_km) 259 | .group(groups.dist_km) 260 | .margins(margins) 261 | .x( 262 | d3.scaleLinear() 263 | .domain( 264 | d3.extent( 265 | groups.dist_km.all(), 266 | function (d) { 267 | return d.key; 268 | } 269 | ) 270 | ) 271 | ) 272 | .y( 273 | d3.scaleLinear() 274 | .domain( 275 | d3.extent( 276 | groups.dist_km.all(), 277 | function (d) { 278 | return d.value; 279 | } 280 | ) 281 | ) 282 | ) 283 | .xAxisLabel('distance (km)') 284 | .yAxisLabel('segments') 285 | .elasticX(true) 286 | .elasticY(true); 287 | 288 | console.log('bcAcc--',bcAcc); 289 | 290 | dataTable 291 | .dimension(allDim) 292 | .group(function (d) { return 'dc.js insists on putting a row here so I remove it using JS'; }) 293 | .size(Infinity) 294 | .showSections(false) 295 | 296 | dc.renderAll(); 297 | } -------------------------------------------------------------------------------- /js/crossfilter.min.js: -------------------------------------------------------------------------------- 1 | // https://crossfilter.github.io/crossfilter/ v1.5.4 Copyright 2020 Mike Bostock 2 | !function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r=r||self).crossfilter=e()}(this,(function(){"use strict";let r=o,e=o,n=o,t=f,u=i;function o(r){for(var e=new Array(r),n=-1;++n32)throw new Error("invalid array width!");return r}function a(e){this.length=e,this.subarrays=1,this.width=8,this.masks={0:0},this[0]=r(e)}"undefined"!=typeof Uint8Array&&(r=function(r){return new Uint8Array(r)},e=function(r){return new Uint16Array(r)},n=function(r){return new Uint32Array(r)},t=function(r,e){if(r.length>=e)return r;var n=new r.constructor(e);return n.set(r),n},u=function(r,t){var u;switch(t){case 16:u=e(r.length);break;case 32:u=n(r.length);break;default:throw new Error("invalid array width!")}return u.set(r),u}),a.prototype.lengthen=function(r){var e,n;for(e=0,n=this.subarrays;e>>0,!((n=this.width-32*o)>=32)||t)return n<32&&t&1<=r;t--)this[e][t]=0;this.length=r},a.prototype.zero=function(r){var e,n;for(e=0,n=this.subarrays;e>>0),o!=(f===t?u:0))return!1;return!0};var l={array8:o,array16:o,array32:o,arrayLengthen:f,arrayWiden:i,bitarray:a};var s={filterExact:(r,e)=>(function(n){var t=n.length;return[r.left(n,e,0,t),r.right(n,e,0,t)]}),filterRange:(r,e)=>{var n=e[0],t=e[1];return function(e){var u=e.length;return[r.left(e,n,0,u),r.left(e,t,0,u)]}},filterAll:r=>[0,r.length]},c=r=>r,h=()=>null,v=()=>0;function p(r){function e(r,e,t){for(var u=t-e,o=1+(u>>>1);--o>0;)n(r,o,u,e);return r}function n(e,n,t,u){for(var o,f=e[--u+n],i=r(f);(o=n<<1)<=t&&(or(e[u+o+1])&&o++,!(i<=r(e[u+o])));)e[u+n]=e[u+o],n=o;e[u+n]=f}return e.sort=function(r,e,t){for(var u,o=t-e;--o>0;)u=r[e],r[e]=r[e+o],r[e+o]=u,n(r,1,o,e);return r},e}const d=p(c);function g(r){var e=d.by(r);return function(n,t,u,o){var f,i,a,l=new Array(o=Math.min(u-t,o));for(i=0;if&&(l[0]=a,f=r(e(l,0,o)[0]))}while(++t>>1;n>>1;r(e[o]){for(var t=0,u=e.length,o=n?JSON.parse(JSON.stringify(r)):new Array(u);tr+1,reduceDecrement:r=>r-1,reduceAdd:r=>(function(e,n){return e+ +r(n)}),reduceSubtract:r=>(function(e,n){return e-r(n)})};const w=(r,e)=>{const n=r[e];return"function"==typeof n?n.call(r):n},A=/\[([\w\d]+)\]/g;var z=(r,e)=>(function(r,e,n,t,u){for(u in t=(n=n.split(".")).splice(-1,1),n)e=e[n[u]]=e[n[u]]||{};return r(e,t)})(w,r,e.replace(A,".$1")),k=-1;function O(){var r,e={add:a,remove:function(e){for(var o=new Array(t),i=[],a="function"==typeof e,l=0,s=0;l0&&(a=t);for(;--f>=K&&e>0;)r.zero(u=F[f])&&(a>0?--a:(o.push(n[u]),--e));if(i)for(f=0;f<$.length&&e>0;f++)r.zero(u=$[f])&&(a>0?--a:(o.push(n[u]),--e));return o},bottom:function(e,t){var u,o,f=[],a=0;t&&t>0&&(a=t);if(i)for(u=0;u<$.length&&e>0;u++)r.zero(o=$[u])&&(a>0?--a:(f.push(n[o]),--e));u=K;for(;u0;)r.zero(o=F[u])&&(a>0?--a:(f.push(n[o]),--e)),u++;return f},group:ur,groupAll:function(){var r=ur(h),e=r.all;return delete r.all,delete r.top,delete r.order,delete r.orderNatural,delete r.size,r.value=function(){return e()[0].value},r},dispose:or,remove:or,accessor:e,id:function(){return A}},$=[],q=function(r){return S(r).sort((function(r,e){var n=N[r],t=N[e];return nt?1:r-e}))},B=s.filterAll,G=[],H=[],K=0,P=0,Q=0;o.unshift(V),o.push(X),f.push(Y);var T=r.add();function V(n,u,o){var f,a;if(i){Q=0,G=0,J=[];for(var s=0;sK)for(o=K,f=Math.min(n,P);oP)for(o=Math.max(n,P),f=t;o1?l.arrayLengthen(s,t):M(t,R),H&&(g=(d=k[0]).key);Q=y);)++Q;for(;Q=v));)y=e(o[Q]);V()}for(;PP)if(i)for(P=0;P1||i?(D=$,I=B):(!U&&W&&(U=1,a=[{key:null,value:G()}]),1===U?(D=q,I=K):(D=h,I=h),s=null),u[p]=D}function j(r){if(U>1||i){var e,n,o,f=U,l=a,c=M(f,f);if(i){for(e=0,o=0;e1||i)if(i)for(e=0;e1||i?(I=B,D=$):1===U?(I=K,D=q):I=D=h}else if(1===U){if(W)return;for(var v=0;v=0&&u.splice(r,1),(r=G.indexOf(J))>=0&&G.splice(r,1),(r=f.indexOf(j))>=0&&f.splice(r,1),(r=H.indexOf(o))>=0&&H.splice(r,1),o}return arguments.length<1&&(e=c),u.push(D),G.push(J),f.push(j),J(O,F,0,t),T().orderNatural()}function or(){H.forEach((function(r){r.dispose()}));var e=o.indexOf(V);return e>=0&&o.splice(e,1),(e=o.indexOf(X))>=0&&o.splice(e,1),(e=f.indexOf(Y))>=0&&f.splice(e,1),r.masks[w]&=x,er()}return w=T.offset,p=T.one,x=~p,A=w<<7|Math.log(p)/Math.log(2),V(n,0,t),X(n,0,t),j},groupAll:function(){var e,f,i,a,l={reduce:p,reduceCount:d,reduceSum:function(r){return p(E.reduceAdd(r),E.reduceSubtract(r),v)},value:function(){s&&(function(){var u;for(e=a(),u=0;u=0&&u.splice(r,1),(r=o.indexOf(c))>=0&&o.splice(r,1),l}return(u.push(h),o.push(c),c(n,0),d())},size:function(){return t},all:function(){return n},allFiltered:function(e){var u=[],o=0,f=p(e||[]);for(o=0;o>7]&=~(1<<(63&o));return f}function g(r){for(var e=0;e 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | Clear filters 85 | 86 | 87 |
88 | 89 |
90 |
91 |
92 | 93 | 94 |
95 |
96 |
97 |
98 |
99 | 100 | 101 |
Lat and lon are expected in WGS84 decimal degrees 102 | 103 | 104 | 141 | 142 | 143 |
144 |
145 |
146 |
147 | 148 | 149 |
150 |
151 |
152 |
153 |
154 | 155 |
156 | 157 | 158 |
159 | 160 |
161 | 162 |
163 |
164 |
165 | 166 |
167 | 168 |
169 |
170 | 179 |
180 | 181 | 182 |
183 |
184 | 185 |
186 | 187 |
188 |
189 |
190 |
191 |
192 | 193 |
194 |
195 |
196 | 197 | 780 | 781 | 782 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /js/kalman-filter.min.js: -------------------------------------------------------------------------------- 1 | var kalmanFilter;kalmanFilter=(()=>{var t={6010:(t,r,e)=>{const n=e(7426);t.exports={registerDynamic:n.registerDynamic,KalmanFilter:e(2676),registerObservation:n.registerObservation,buildObservation:n.buildObservation,buildDynamic:n.buildDynamic,getCovariance:e(2694),State:e(4585),checkCovariance:e(1206),correlationToCovariance:e(4141),covarianceToCorrelation:e(5466)}},3706:(t,r,e)=>{const n=e(9447),i=e(3851),o=e(2188),a=e(8109),s=e(5554),u=e(4061),c=e(4585),f=e(9930),l={info:(...t)=>console.log(...t),debug:()=>{},warn:(...t)=>console.log(...t),error:(...t)=>console.log(...t)};t.exports=class{constructor({dynamic:t,observation:r,logger:e=l}){this.dynamic=t,this.observation=r,this.logger=e}getValue(t,r){return"function"==typeof t?t(r):t}getInitState(){const{mean:t,covariance:r,index:e}=this.dynamic.init;return new c({mean:t,covariance:r,index:e})}getPredictedCovariance(t={}){let{previousCorrected:r,index:e}=t;r=r||this.getInitState();const a=Object.assign({},{previousCorrected:r,index:e},t),s=this.getValue(this.dynamic.transition,a),u=i(s),c=n(s,r.covariance),l=n(c,u),h=this.getValue(this.dynamic.covariance,a),m=o(h,l);return f(m,[this.dynamic.dimension,this.dynamic.dimension],"predicted.covariance"),m}predict(t={}){let{previousCorrected:r,index:e}=t;r=r||this.getInitState(),"number"!=typeof e&&"number"==typeof r.index&&(e=r.index+1),c.check(r,{dimension:this.dynamic.dimension});const i=Object.assign({},{previousCorrected:r,index:e},t),o=this.getValue(this.dynamic.transition,i);f(o,[this.dynamic.dimension,this.dynamic.dimension],"dynamic.transition");const a=n(o,r.mean),s=this.getPredictedCovariance(i),u=new c({mean:a,covariance:s,index:e});return this.logger.debug("Prediction done",u),u}getGain(t){let{predicted:r,stateProjection:e}=t;const s=Object.assign({},{index:r.index},t);e=e||this.getValue(this.observation.stateProjection,s);const u=this.getValue(this.observation.covariance,s);f(u,[this.observation.dimension,this.observation.dimension],"observation.covariance");const c=i(e),l=n(n(e,r.covariance),c),h=o(l,u);return n(n(r.covariance,c),a(h))}getCorrectedCovariance(t){let{predicted:r,optimalKalmanGain:e,stateProjection:i}=t;const o=u(r.covariance.length);if(!i){const e=Object.assign({},{index:r.index},t);i=this.getValue(this.observation.stateProjection,e)}return e||(e=this.getGain(Object.assign({stateProjection:i},t))),n(s(o,n(e,i)),r.covariance)}correct(t){const{predicted:r,observation:e}=t;if(c.check(r,{dimension:this.dynamic.dimension}),!e)throw new Error("no measure available");const i=Object.assign({},{observation:e,predicted:r,index:r.index},t),a=this.getValue(this.observation.stateProjection,i),u=this.getGain(Object.assign({predicted:r,stateProjection:a},t)),f=s(e,n(a,r.mean)),l=o(r.mean,n(u,f));if(Number.isNaN(l[0][0]))throw console.log({optimalKalmanGain:u,innovation:f,predicted:r}),new TypeError("Mean is NaN after correction");const h=this.getCorrectedCovariance(Object.assign({predicted:r,optimalKalmanGain:u,stateProjection:a},t)),m=new c({mean:l,covariance:h,index:r.index});return this.logger.debug("Correction done",m),m}}},3658:(t,r,e)=>{const n=e(4061);t.exports=function(t,r){const e=t.timeStep||1,{observedProjection:i}=r,{stateProjection:o}=r,a=r.dimension;let s;if(o&&Number.isInteger(o[0].length/3))s=r.stateProjection[0].length;else if(i)s=3*i[0].length;else{if(!a)throw new Error("observedProjection or stateProjection should be defined in observation in order to use constant-speed filter");s=3*a}const u=s/3,c=n(s);for(let t=0;t{const n=e(4061);t.exports=function(t,r){let{dimension:e}=t;const i=r.dimension,{observedProjection:o}=r,{stateProjection:a}=r;let{covariance:s}=t;t.dimension||(i?e=i:o?e=o[0].length:a&&(e=a[0].length));const u=n(e);return s=s||n(e),Object.assign({},t,{dimension:e,transition:u,covariance:s})}},171:(t,r,e)=>{const n=e(4061);t.exports=function(t,r){const e=t.timeStep||1,{observedProjection:i}=r,{stateProjection:o}=r,a=r.dimension;let s;if(o&&Number.isInteger(o[0].length/2))s=r.stateProjection[0].length;else if(i)s=2*i[0].length;else{if(!a)throw new Error("observedProjection or stateProjection should be defined in observation in order to use constant-speed filter");s=2*a}const u=s/2,c=n(s);for(let t=0;t{const n=e(6942),i=e(5584),o=e(6156),a=e(992),s=e(8913),u=e(69),c=e(9835),f=e(3638),l=e(4450),h=e(4585),m=e(7426),v=e(3706);t.exports=class extends v{constructor(t={}){const r=function(t){const{observation:r,dynamic:e}=t;return c(t,{observation:{stateProjection:u(f(r.stateProjection)),covariance:u(f(r.covariance,{dimension:r.dimension}))},dynamic:{transition:u(f(e.transition)),covariance:u(f(e.covariance,{dimension:e.dimension}))}})}(function({observation:t,dynamic:r}){"object"==typeof t&&null!==t||(t=function(t){return"number"==typeof t?{name:"sensor",sensorDimension:t}:"string"==typeof t?{name:t}:{name:"sensor"}}(t)),"object"==typeof r&&null!==r||(r=function(t){return"string"==typeof t?{name:t}:{name:"constant-position"}}(r)),"string"==typeof t.name&&(t=m.buildObservation(t)),"string"==typeof r.name&&(r=m.buildDynamic(r,t));const e=i({observation:t,dynamic:r}),n=o(e),u=a(n);return s(u)}(t));super(Object.assign({},t,r))}correct(t){const r=n({observation:t.observation,dimension:this.observation.dimension});return super.correct(Object.assign({},t,{observation:r}))}filter(t){const r=super.predict(t);return this.correct(Object.assign({},t,{predicted:r}))}filterAll(t){const{mean:r,covariance:e,index:n}=this.dynamic.init;let i=new h({mean:r,covariance:e,index:n});const o=[];for(const r of t){const t=this.predict({previousCorrected:i});i=this.correct({predicted:t,observation:r}),o.push(i.mean.map((t=>t[0])))}return o}asymptoticStateCovariance(t=100,r=1e-6){let e,n=super.getInitState();const i=[];for(let o=0;o[0])),covariance:r});return super.getGain({previousCorrected:e})}}},2188:(t,r,e)=>{const n=e(5301);t.exports=function(...t){return n(t,(t=>t.reduce(((t,r)=>null===t||null===r?null:t+r),0)))}},7261:(t,r,e)=>{const n=e(6219);t.exports=function(t){const r=n(t.length,t.length);for(const[e,n]of t.entries())r[e][e]=n;return r}},4450:(t,r,e)=>{const n=e(8909),i=e(3851),o=e(5554),a=e(9447),s=e(2922);t.exports=function(t,r){if(void 0===t)return s(r);if(void 0===r)return s(t);const e=o(t,r),u=a(i(e),e);return Math.sqrt(n(u))}},5301:t=>{t.exports=function(t,r){return t[0].map(((e,n)=>e.map(((e,i)=>{const o=t.map((t=>t[n][i]));return r(o,n,i)}))))}},4061:t=>{t.exports=function(t){const r=[];for(let e=0;e{const n=e(9955);t.exports=function(t){return n(t)}},9447:t=>{t.exports=function(t,r){const e=[];for(let n=0;n{t.exports=function(t,{dimension:r}){const e=t.length,n=t[0].length,i=t.map((t=>t.concat()));if(r{t.exports=(t,r)=>r.map((e=>r.map((r=>t[e][r]))))},5554:(t,r,e)=>{const n=e(5301);t.exports=function(...t){return n(t,(([t,r])=>t-r))}},2922:t=>{t.exports=function(t){let r=0;for(let e=0;e{t.exports=function(t){let r=0;for(const[e,n]of t.entries())r+=n[e];return r}},3851:t=>{t.exports=function(t){return t[0].map(((r,e)=>t.map((t=>t[e]))))}},6219:t=>{t.exports=function(t,r){return new Array(t).fill(1).map((()=>new Array(r).fill(0)))}},7426:(t,r,e)=>{const n={"constant-position":e(8140),"constant-speed":e(171),"constant-acceleration":e(3658)},i={sensor:e(1940)};t.exports={registerObservation:(t,r)=>{i[t]=r},registerDynamic:(t,r)=>{n[t]=r},buildObservation:t=>{if(!i[t.name])throw new Error(`The provided observation model name (${t.name}) is not registered`);return i[t.name](t)},buildDynamic:(t,r)=>{if(!n[t.name])throw new Error(`The provided dynamic model (${t.name}) name is not registered`);return n[t.name](t,r)}}},1940:(t,r,e)=>{const n=e(4061),i=e(3638),o=e(9930);t.exports=function(t){const{sensorDimension:r=1,sensorCovariance:e=1,nSensors:a=1}=t,s=i(e,{dimension:r});o(s,[r,r],"observation.sensorCovariance");const u=n(r);let c=[];const f=r*a,l=n(f);for(let t=0;tt.concat()))),s.forEach(((e,n)=>e.forEach(((e,i)=>{l[n+t*r][i+t*r]=e}))));return Object.assign({},t,{dimension:f,observedProjection:c,covariance:l})}},992:(t,r,e)=>{const n=e(983),i=e(4061);t.exports=function({observation:t,dynamic:r}){const{observedProjection:e,stateProjection:o}=t,a=t.dimension,s=r.dimension;if(e&&o)throw new TypeError("You cannot use both observedProjection and stateProjection");if(e){const i=n(e,{dimension:s});return{observation:Object.assign({},t,{stateProjection:i}),dynamic:r}}if(a&&s){const e=i(a);return{observation:Object.assign({},t,{stateProjection:n(e,{dimension:s})}),dynamic:r}}return{observation:t,dynamic:r}}},6156:t=>{t.exports=function({observation:t,dynamic:r}){const e=r.dimension,n=t.dimension;if(!e||!n)throw new TypeError("Dimension is not set");return{observation:t,dynamic:r}}},8913:(t,r,e)=>{const n=e(7261);t.exports=function({observation:t,dynamic:r}){if(!r.init){const e=1e6,i=r.dimension,o=new Array(i).fill(0),a=new Array(i).fill(e);return{observation:t,dynamic:Object.assign({},r,{init:{mean:o.map((t=>[t])),covariance:n(a),index:-1}})}}return{observation:t,dynamic:r}}},5584:t=>{t.exports=function({observation:t,dynamic:r}){const{stateProjection:e}=t,{transition:n}=r,i=r.dimension,o=t.dimension;if(i&&o&&Array.isArray(e)&&(i!==e[0].length||o!==e.length))throw new TypeError("stateProjection dimensions not matching with observation and dynamic dimensions");if(i&&Array.isArray(n)&&i!==n.length)throw new TypeError("transition dimension not matching with dynamic dimension");return Array.isArray(e)?{observation:Object.assign({},t,{dimension:e.length}),dynamic:Object.assign({},r,{dimension:e[0].length})}:Array.isArray(n)?{observation:t,dynamic:Object.assign({},r,{dimension:n.length})}:{observation:t,dynamic:r}}},4585:(t,r,e)=>{const n=e(5554),i=e(3851),o=e(9447),a=e(8109),s=e(5301),u=e(8526),c=e(6942),f=e(9930),l=e(1206);class h{constructor({mean:t,covariance:r,index:e}){this.mean=t,this.covariance=r,this.index=e}check(t){this.constructor.check(this,t)}static check(t,{dimension:r=null,title:e=null,eigen:n}={}){if(!(t instanceof h))throw new TypeError("The argument is not a state \nTips: maybe you are using 2 different version of kalman-filter in your npm deps tree");const{mean:i,covariance:o}=t,a=i.length;if("number"==typeof r&&a!==r)throw new Error(`[${e}] State.mean ${i} with dimension ${a} does not match expected dimension (${r})`);f(i,[a,1],e?e+"-mean":"mean"),f(o,[a,a],e?e+"-covariance":"covariance"),l({covariance:o,eigen:n},e?e+"-covariance":"covariance")}static matMul({state:t,matrix:r}){const e=o(o(r,t.covariance),i(r)),n=o(r,t.mean);return new h({mean:n,covariance:e,index:t.index})}subState(t){return new h({mean:t.map((t=>this.mean[t])),covariance:u(this.covariance,t),index:this.index})}rawDetailedMahalanobis(t){const r=n(this.mean,t);this.check();const e=a(this.covariance);if(null===e)throw this.check({eigen:!0}),new Error(`Cannot invert covariance ${JSON.stringify(this.covariance)}`);const s=i(r),u=Math.sqrt(o(o(s,e),r));if(Number.isNaN(u))throw console.log({diff:r,covarianceInvert:e,this:this,point:t},o(o(s,e),r)),new Error("mahalanobis is NaN");return{diff:r,covarianceInvert:e,value:u}}detailedMahalanobis({kf:t,observation:r,obsIndexes:e}){if(r.length!==t.observation.dimension)throw new Error(`Mahalanobis observation ${r} (dimension: ${r.length}) does not match with kf observation dimension (${t.observation.dimension})`);let n=c({observation:r,dimension:r.length});const i=t.getValue(t.observation.stateProjection,{});let o=this.constructor.matMul({state:this,matrix:i});return Array.isArray(e)&&(o=o.subState(e),n=e.map((t=>n[t]))),o.rawDetailedMahalanobis(n)}mahalanobis(t){const r=this.detailedMahalanobis(t).value;if(Number.isNaN(r))throw new TypeError("mahalanobis is NaN");return r}obsBhattacharyya({kf:t,state:r,obsIndexes:e}){const n=t.getValue(t.observation.stateProjection,{});let i=this.constructor.matMul({state:this,matrix:n}),o=this.constructor.matMul({state:r,matrix:n});return Array.isArray(e)&&(i=i.subState(e),o=o.subState(e)),i.bhattacharyya(o)}bhattacharyya(t){const r=s([this.covariance,t.covariance],(([t,r])=>(t+r)/2));let e;try{e=a(r)}catch(t){throw console.log("Cannot invert",r),t}const u=n(this.mean,t.mean);return o(i(u),o(e,u))[0][0]}}t.exports=h},6942:t=>{t.exports=function({observation:t,dimension:r}){if(!Array.isArray(t)){if(1===r&&"number"==typeof t)return[[t]];throw new TypeError(`The observation (${t}) should be an array (dimension: ${r})`)}if(t.length!==r)throw new TypeError(`Observation (${t.length}) and dimension (${r}) not matching`);return"number"==typeof t[0]||null===t[0]?t.map((t=>[t])):t}},1206:(t,r,e)=>{const n=e(251),i=e(9930);t.exports=function({covariance:t,eigen:r=!1}){i(t),function(t,r="checkSymetric"){t.forEach(((e,n)=>e.forEach(((e,i)=>{if(n===i&&e<0)throw new Error(`[${r}] Variance[${i}] should be positive (actual: ${e})`);if(Math.abs(e)>Math.sqrt(t[n][n]*t[i][i]))throw console.log(t),new Error(`[${r}] Covariance[${n}][${i}] should verify Cauchy Schwarz Inequality (expected: |x| <= sqrt(${t[n][n]} * ${t[i][i]}) actual: ${e})`);if(Math.abs(e-t[i][n])>.1)throw new Error(`[${r}] Covariance[${n}][${i}] should equal Covariance[${i}][${n}] (actual diff: ${Math.abs(e-t[i][n])}) = ${e} - ${t[i][n]}\n${t.join("\n")} is invalid`)}))))}(t),r&&function(t,r=1e-10){new n(t).eigenvalues().forEach((e=>{if(e<=-r)throw console.log(t,e),new Error(`Eigenvalue should be positive (actual: ${e})`)})),console.log("is definite positive",t)}(t)}},9930:(t,r,e)=>{const n=e(3189);t.exports=function(t,r,e="checkMatrix"){if(t.reduce(((t,r)=>t.concat(r))).filter((t=>Number.isNaN(t))).length>0)throw new Error(`[${e}] Matrix should not have a NaN\nIn : \n`+t.join("\n"));r&&n(t,r,e)}},3189:t=>{const r=function(t,e,n="checkShape"){if(t.length!==e[0])throw new Error(`[${n}] expected size (${e[0]}) and length (${t.length}) does not match`);if(e.length>1)return t.forEach((t=>r(t,e.slice(1),n)))};t.exports=r},4141:(t,r,e)=>{const n=e(1206);t.exports=function({correlation:t,variance:r}){return n({covariance:t}),t.map(((t,e)=>t.map(((t,n)=>t*Math.sqrt(r[n]*r[e])))))}},5466:(t,r,e)=>{const n=e(1206);t.exports=function(t){n({covariance:t});const r=t.map(((r,e)=>t[e][e]));return{variance:r,correlation:t.map(((t,e)=>t.map(((t,n)=>t/Math.sqrt(r[n]*r[e])))))}}},9835:(t,r,e)=>{const n=e(9956),i=function(t,r){if(r>100)throw new Error(`In deepAssign, number of recursive call (${r}) reached limit (100), deepAssign is not working on self-referencing objects`);const e=t.filter((t=>null!=t)),o=e[e.length-1];if(1===e.length)return e[0];if("object"!=typeof o||Array.isArray(o))return o;if(0===e.length)return null;const a=e.filter((t=>"object"==typeof t));let s=[];a.forEach((t=>{s=s.concat(Object.keys(t))}));const u=n(s),c={};return u.forEach((t=>{const e=a.map((r=>r[t]));c[t]=i(e,r+1)})),c};t.exports=(...t)=>i(t,0)},2694:t=>{t.exports=function({measures:t,averages:r}){const e=t.length,n=t[0].length;if(0===e)throw new Error("Cannot find covariance for empty sample");return new Array(n).fill(1).map(((i,o)=>new Array(n).fill(1).map(((n,i)=>{const a=t.map(((t,e)=>(t[o]-r[e][o])*(t[i]-r[e][i]))).reduce(((t,r)=>t+r))/e;if(Number.isNaN(a))throw new TypeError("result is NaN");return a}))))}},3638:(t,r,e)=>{const n=e(7261),i=e(9930);t.exports=function(t,{dimension:r,title:e="polymorph"}={}){if("number"==typeof t||Array.isArray(t)){if("number"==typeof t&&"number"==typeof r)return n(new Array(r).fill(t));if(Array.isArray(t)&&Array.isArray(t[0])){let n;return"number"==typeof r&&(n=[r,r]),i(t,n,e),t}if(Array.isArray(t)&&"number"==typeof t[0])return n(t)}return t}},69:t=>{t.exports=function(t){if("function"==typeof t)return t;if(Array.isArray(t))return t;throw new Error("Only arrays and functions are authorized")}},9956:t=>{t.exports=function(t){return t.filter(((r,e)=>t.indexOf(r)===e))}},4456:t=>{"use strict";t.exports=function(){var t=this.re,r=this.im,e=1/(2*Math.pow(10,15));if(!(Math.abs(t)0?.5*Math.PI:1.5*Math.PI:0===r?t>0?0:Math.PI:t>0&&r>0?Math.atan(r/t):t<0&&r>0?Math.PI-Math.atan(r/(-1*t)):t<0&&r<0?Math.PI+Math.atan(-1*r/(-1*t)):2*Math.PI-Math.atan(-1*r/t)}},6719:t=>{"use strict";t.exports=function(){return this.im}},2930:t=>{"use strict";t.exports=function(){return Math.sqrt(Math.pow(this.re,2)+Math.pow(this.im,2))}},5217:t=>{"use strict";t.exports=function(){return this.re}},3515:t=>{"use strict";t.exports=function(){var t=this.re,r=this.im;return Number.isNaN(t)||Number.isNaN(r)?"NaN":0===t&&0===r?"0":0===t?1===r?"i":-1===r?"-i":"".concat(r,"i"):0===r?"".concat(t):r>0?1===r?"".concat(t," + i"):"".concat(t," + ").concat(r,"i"):-1===r?"".concat(t," - i"):"".concat(t," - ").concat(Math.abs(r),"i")}},8522:t=>{"use strict";t.exports=function(t){return this.subtract(new this(Math.PI/2),this.asin(t))}},8360:t=>{"use strict";t.exports=function(t){return this.atan(this.inverse(t))}},4824:t=>{"use strict";t.exports=function(t){return this.asin(this.inverse(t))}},1983:t=>{"use strict";t.exports=function(t,r){return t instanceof this&&r instanceof this?new this(t.re+r.re,t.im+r.im):this.NaN}},567:t=>{"use strict";t.exports=function(t){return this.acos(this.inverse(t))}},9684:t=>{"use strict";t.exports=function(t){return this.multiply(new this(0,-1),this.log(this.add(this.multiply(new this(0,1),t),this.pow(this.subtract(this.ONE,this.pow(t,2)),.5))))}},7065:t=>{"use strict";t.exports=function(t){return this.multiply(new this(0,.5),this.subtract(this.log(this.subtract(this.ONE,this.multiply(new this(0,1),t))),this.log(this.add(this.ONE,this.multiply(new this(0,1),t)))))}},7308:t=>{"use strict";t.exports=function(t){return t instanceof this?new this(t.getReal(),-1*t.getImaginary()):this.NaN}},372:t=>{"use strict";t.exports=function(t){if(!(t instanceof this))return this.NaN;var r=t.getReal(),e=t.getImaginary();return new this(Math.cos(r)*Math.cosh(e),Math.sin(r)*Math.sinh(e)*-1)}},2215:t=>{"use strict";t.exports=function(t){return this.divide(this.ONE,this.tan(t))}},7613:t=>{"use strict";t.exports=function(t){return this.divide(this.ONE,this.sin(t))}},4019:t=>{"use strict";t.exports=function(t,r){if(!(t instanceof this&&r instanceof this))return this.NaN;var e=t.re,n=t.im,i=r.re,o=r.im;if(Math.abs(i){"use strict";t.exports=function(t){if(!(t instanceof this))return this.NaN;var r=t.getReal(),e=t.getImaginary(),n=Math.exp(r);return new this(n*Math.cos(e),n*Math.sin(e))}},6522:t=>{"use strict";t.exports=function(t){return t instanceof this?this.divide(this.ONE,t):this.NaN}},7761:t=>{"use strict";t.exports=function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:15;if(!(t instanceof this&&r instanceof this))return!1;if(!Number.isInteger(e)||e<0)throw new Error("Invalid argument: Expected a non-negative integer digit");var n=1/(2*Math.pow(10,e)),i=t.getReal(),o=t.getImaginary(),a=r.getReal(),s=r.getImaginary();return!!(Number.isNaN(i)&&Number.isNaN(o)&&Number.isNaN(a)&&Number.isNaN(s))||Math.abs(i-a){"use strict";t.exports=function(t){if(!(t instanceof this))return!1;var r=t.getReal(),e=t.getImaginary();return!(!Number.isNaN(r)&&!Number.isNaN(e))}},2288:t=>{"use strict";t.exports=function(t){if(!(t instanceof this))return this.NaN;var r=t.getModulus(),e=t.getArgument();return r{"use strict";t.exports=function(t,r){if(!(t instanceof this&&r instanceof this))return this.NaN;var e=t.re,n=t.im,i=r.re,o=r.im;return new this(e*i-n*o,e*o+n*i)}},7859:t=>{"use strict";t.exports=function(t,r){return t instanceof this&&("number"==typeof r||r instanceof this)?"number"==typeof r?!Number.isFinite(r)||Number.isNaN(r)?this.NaN:0===r?this.ONE:this.isEqual(t,this.ZERO)?this.ZERO:this.exp(this.multiply(new this(r,0),this.log(t))):r instanceof this?this.exp(this.multiply(r,this.log(t))):this.NaN:this.NaN}},2941:t=>{"use strict";t.exports=function(t){return this.divide(this.ONE,this.cos(t))}},5536:t=>{"use strict";t.exports=function(t){if(!(t instanceof this))return this.NaN;var r=t.getReal(),e=t.getImaginary();return new this(Math.sin(r)*Math.cosh(e),Math.cos(r)*Math.sinh(e))}},458:t=>{"use strict";t.exports=function(t,r){return t instanceof this&&r instanceof this?new this(t.re-r.re,t.im-r.im):this.NaN}},9186:t=>{"use strict";t.exports=function(t){return this.divide(this.sin(t),this.cos(t))}},3271:(t,r,e)=>{"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,r){var e=n(t),i=n(r);return"number"===e&&"undefined"===i?Number.isNaN(t)||!Number.isFinite(t)?(this.re=NaN,this.im=NaN,this):(this.re=t,this.im=0,this):"number"===e&&"number"===i?Number.isNaN(t)||Number.isNaN(r)||!Number.isFinite(t)||!Number.isFinite(r)?(this.re=NaN,this.im=NaN,this):(this.re=t,this.im=r,this):(this.re=NaN,this.im=NaN,this)}t.exports=i,i.prototype.getReal=e(5217),i.prototype.getImaginary=e(6719),i.prototype.getModulus=e(2930),i.prototype.getArgument=e(4456),i.prototype.toString=e(3515),i.isNaN=e(7466),i.isEqual=e(7761),i.conjugate=e(7308),i.inverse=e(6522),i.add=e(1983),i.subtract=e(458),i.multiply=e(4787),i.divide=e(4019),i.exp=e(4184),i.log=e(2288),i.pow=e(7859),i.sin=e(5536),i.cos=e(372),i.tan=e(9186),i.csc=e(7613),i.sec=e(2941),i.cot=e(2215),i.asin=e(9684),i.acos=e(8522),i.atan=e(7065),i.acsc=e(4824),i.asec=e(567),i.acot=e(8360),i.NaN=new i(NaN),i.ONE=new i(1),i.ZERO=new i(0),i.PI=new i(Math.PI),i.E=new i(Math.E),i.EPSILON=1/(2*Math.pow(10,15))},5300:t=>{"use strict";t.exports={INVALID_ARRAY:"Invalid argument: Received a non-array argument",INVALID_MATRIX:"Invalid argument: Received an invalid matrix",INVALID_SQUARE_MATRIX:"Invalid argument: Received a non-square matrix",INVALID_UPPER_TRIANGULAR_MATRIX:"Invalid argument: Received a non upper-triangular matrix",INVALID_LOWER_TRIANGULAR_MATRIX:"Invalid argument: Received a non lower-triangular matrix",INVALID_EXPONENT:"Invalid argument: Expected a non-negative integer exponent",INVALID_ROW_COL:"Invalid argument: Expected non-negative integer row and column",INVALID_ROW:"Invalid argument: Expected non-negative integer row",INVALID_COLUMN:"Invalid argument: Expected non-negative integer column",INVALID_ROWS_EXPRESSION:"Invalid argument: Received invalid rows expression",INVALID_COLUMNS_EXPRESSION:"Invalid argument: Received invalid columns expression",INVALID_P_NORM:"Invalid argument: Received invalid p-norm",OVERFLOW_INDEX:"Invalid argument: Matrix index overflow",OVERFLOW_COLUMN:"Invalid argument: Column index overflow",OVERFLOW_ROW:"Invalid argument: Row index overflow",NO_UNIQUE_SOLUTION:"Arithmetic Exception: The system has no unique solution",SIZE_INCOMPATIBLE:"Invalid argument: Matrix size-incompatible",SINGULAR_MATRIX:"Arithmetic Exception: The matrix is not invertible",EXPECTED_STRING_NUMBER_AT_POS_1_2:"Invalid argument: Expected a string or a number at arguments[1] and arguments[2]",EXPECTED_ARRAY_OF_NUMBERS_OR_MATRICES:"Invalid argument: Expected either an array of numbers or an array of square matrices"}},8800:(t,r,e)=>{"use strict";function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);es&&(a=u,s=c)}var f=r[e];r[e]=r[a],r[a]=f}t.exports=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(t instanceof this))throw new Error(o);for(var e=t.size(),i=n(e,2),u=i[0],c=i[1],f=Math.min(u,c),l=1/(2*Math.pow(10,t._digit)),h=a(u),m=this.clone(t)._matrix,v=0;v=l){for(var A=w/p,I=y;Ir?0:S[t][r]}));return[_,N,E]}},8313:(t,r,e)=>{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e=s){l=!1;break}if(!l){for(var m=0,v=f;vP&&(u[U][P]=0);return[new this(c),new this(u)]}},4697:(t,r,e)=>{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e=0;b--){for(var g=0,w=b+1;w{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e{"use strict";function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e=0;b--)if(Math.abs(d[b][b])=0;_--){for(var N=0,E=_+1;E{"use strict";function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e{"use strict";var n=e(5300),i=n.INVALID_MATRIX,o=n.INVALID_SQUARE_MATRIX,a=n.SINGULAR_MATRIX,s=e(251);t.exports=function(t){if(!(t instanceof this))throw new Error(i);if(!t.isSquare())throw new Error(o);var r=t.size()[0];if(0===r)return new s([]);for(var e=1/(2*Math.pow(10,t._digit)),n=this.identity(r)._matrix,u=this.clone(t)._matrix,c=function(t){for(var r=new Array(t),e=0;ef&&(u[d][p]/=h),n[d][p]/=h;h=1}if(y!==f&&Math.abs(u[d][f])>=e)for(var b=u[d][f]/h,g=0;gf&&(u[d][g]-=b*u[v][g]),n[d][g]-=b*n[v][g]}}for(var w=0;w{"use strict";function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e{"use strict";var n=e(5300),i=n.INVALID_MATRIX,o=n.INVALID_SQUARE_MATRIX,a=n.INVALID_EXPONENT;t.exports=function(t,r){if(!(t instanceof this))throw new Error(i);if(!t.isSquare())throw new Error(o);if(!Number.isInteger(r)||r<0)throw new Error(a);var e=t.size()[0];if(0===r)return this.identity(e);if(1===r)return this.clone(t);if(r%2==0){var n=this.pow(t,r/2);return this.multiply(n,n)}var s=this.pow(t,(r-1)/2);return this.multiply(this.multiply(s,s),t)}},8551:(t,r,e)=>{"use strict";function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e{"use strict";var n=e(251),i=e(5300),o=i.INVALID_P_NORM,a=i.SINGULAR_MATRIX,s=i.INVALID_SQUARE_MATRIX;t.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;if(1!==t&&2!==t&&t!==1/0&&"F"!==t)throw new Error(o);if(!this.isSquare())throw new Error(s);try{var r=n.inverse(this);return r.norm(t)*this.norm(t)}catch(t){if(t.message===a)return 1/0;throw t}}},7382:(t,r,e)=>{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e{"use strict";function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e=0?(o=0,s=0,a=c/(i=u>=0?(-1*u-Math.sqrt(f))/2:(-1*u+Math.sqrt(f))/2)):(a=i=-u/2,s=-1*(o=Math.sqrt(-1*f)/2)),{metric:Math.sqrt(Math.pow(i,2)+Math.pow(o,2)),eigen1:{re:i,im:o},eigen2:{re:a,im:s}}}t.exports=function(){if(!this.isSquare())throw new Error(s);if(void 0!==this._eigenvalues)return this._eigenvalues;var t=this.size()[0],r=[],e=this._digit,n=1/(2*Math.pow(10,e)),i=a.clone(this)._matrix,f=!0,l=!1;!function(t,r){for(var e=t.length,n=1/(2*Math.pow(10,r)),i=0;i=0?a[0]+=o:a[0]-=o;for(var c=0,f=0;f0;h--){var m=0,v=void 0;if(l)l=!1;else for(var y=i[t-1][t-1];;){v=f?Math.abs(i[h][h-1]):c(i[h-1][h-1],i[h-1][h],i[h][h-1],i[h][h]).metric;for(var d=0;d3&&(f=!1)}}return l||(r[0]=new o(i[0][0])),this._eigenvalues=r,r}},8982:(t,r,e)=>{"use strict";function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e0&&void 0!==arguments[0]?arguments[0]:2,r=this.size(),e=n(r,2),i=e[0],s=e[1];if(1!==t&&2!==t&&t!==1/0&&"F"!==t)throw new Error(a);var u=this._matrix,c=0;if(1===t){for(var f=0;fc&&(c=l)}return c}if(2===t){for(var m=o.transpose(this),v=o.multiply(m,this),y=v.eigenvalues(),d=0;dc&&(c=p)}return Math.sqrt(c)}if(t===1/0){for(var b=0;bc&&(c=g)}return c}for(var A=0;A{"use strict";t.exports=function(){if(void 0!==this._nullity)return this._nullity;var t=this.size()[1],r=this.rank();return this._nullity=t-r,this._nullity}},9486:(t,r,e)=>{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e=t){u++;break}return this._rank=u,u}},9923:t=>{"use strict";t.exports=function(){if(void 0!==this._size)return this._size;var t=this._matrix;return 0===t.length?(this._size=[0,0],this._size):(this._size=[t.length,t[0].length],this._size)}},7530:(t,r,e)=>{"use strict";var n=e(5300).INVALID_SQUARE_MATRIX;t.exports=function(){if(!(void 0!==this._isSquare?this._isSquare:this.isSquare()))throw new Error(n);if(void 0!==this._trace)return this._trace;for(var t=this._matrix,r=t.length,e=0,i=0;i{"use strict";function r(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e0&&void 0!==arguments[0]?arguments[0]:this._digit;if(void 0!==this._isDiagonal)return this._isDiagonal;var e=1/(2*Math.pow(10,t)),n=this._matrix,i=this.size(),o=r(i,2),a=o[0],s=o[1];if(0===a)return this._isDiagonal=!0,!0;for(var u=0;u=e)return this.isDiagonal=!1,!1;return this._isDiagonal=!0,!0}},352:t=>{"use strict";function r(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e0&&void 0!==arguments[0]?arguments[0]:this._digit;if(void 0!==this._isLowerTriangular)return this._isLowerTriangular;var e=1/(2*Math.pow(10,t)),n=this._matrix,i=this.size(),o=r(i,2),a=o[0],s=o[1];if(0===a)return this._isLowerTriangular=!0,!0;for(var u=0;u=e)return this._isLowerTriangular=!1,!1;return this._isLowerTriangular=!0,!0}},5628:t=>{"use strict";t.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._digit;if(void 0!==this._isOrthogonal)return this._isOrthogonal;if(!this.isSquare())return this._isOrthogonal=!1,!1;for(var r=this._matrix,e=1/(2*Math.pow(10,t)),n=r.length,i=0;i=e)return this._isOrthogonal=!1,!1;if(i!==o&&Math.abs(a)>=e)return this._isOrthogonal=!1,!1}return this._isOrthogonal=!0,!0}},7917:t=>{"use strict";t.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._digit;if(void 0!==this._isSkewSymmetric)return this._isSkewSymmetric;if(!this.isSquare())return this._isSkewSymmetric=!1,!1;var r=this._matrix,e=1/(2*Math.pow(10,t)),n=r.length;if(0===n)return this._isSkewSymmetric=!0,!0;for(var i=0;i=e)return this._isSkewSymmetric=!1,!1;return this._isSkewSymmetric=!0,!0}},9479:t=>{"use strict";t.exports=function(){if(void 0!==this._isSquare)return this._isSquare;var t=this._matrix;return 0===t.length?(this._isSquare=!0,!0):(this._isSquare=t.length===t[0].length,this._isSquare)}},5933:t=>{"use strict";t.exports=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._digit;if(void 0!==this._isSymmetric)return this._isSymmetric;if(!this.isSquare())return!1;for(var r=this._matrix,e=1/(2*Math.pow(10,t)),n=r.length,i=0;i=e)return this._isSymmetric=!1,!1;return this._isSymmetric=!0,!0}},4380:t=>{"use strict";function r(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e0&&void 0!==arguments[0]?arguments[0]:this._digit;if(void 0!==this._isUpperTriangular)return this._isUpperTriangular;var e=1/(2*Math.pow(10,t)),n=this._matrix,i=this.size(),o=r(i,2),a=o[0],s=o[1];if(0===a)return this._isUpperTriangular=!0,!0;for(var u=0;u=e)return this._isUpperTriangular=!1,!1;return this._isUpperTriangular=!0,!0}},1595:(t,r,e)=>{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e=f)throw new Error(a);var l=t._matrix;return this.generate(c,1,(function(t){return l[t][r]}))}},3842:(t,r,e)=>{"use strict";var n=e(251),i=e(3907),o=e(5300),a=o.INVALID_ARRAY,s=o.EXPECTED_ARRAY_OF_NUMBERS_OR_MATRICES,u=o.INVALID_SQUARE_MATRIX;t.exports=function(t){if(!Array.isArray(t))throw new Error(a);for(var r,e=t.length,o=0;o=0&&i=0?t[v]._matrix[n][i]:0}))}},1531:(t,r,e)=>{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e=c||r>=f)throw new Error(a);return s[t][r]}},8879:(t,r,e)=>{"use strict";var n=e(8307);t.exports=function(t,r,e){var i=n(t,r);if(0===t||0===r)return new this([]);for(var o=0;o{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e{"use strict";t.exports=function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return this.generate(t,r,(function(){return Number.parseFloat((Math.random()*(n-e)+e).toFixed(i))}))}},2023:t=>{"use strict";t.exports=function(t){return this.generate(t,t,(function(t,r){return t===r?1:0}))}},4534:(t,r,e)=>{"use strict";function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e2&&void 0!==arguments[2]?arguments[2]:5;if(!(t instanceof this&&r instanceof this))throw new Error(o);var i=t.size(),a=n(i,2),s=a[0],u=a[1],c=r.size(),f=n(c,2),l=f[0],h=f[1];if(s!==l||u!==h)return!1;for(var m=1/(2*Math.pow(10,e)),v=t._matrix,y=r._matrix,d=0;d=m)return!1;return!0}},9127:(t,r,e)=>{"use strict";function n(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e=c)throw new Error(a);var l=t._matrix;return this.generate(1,f,(function(t,e){return l[r][e]}))}},8122:(t,r,e)=>{"use strict";function n(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(e.push(a.value),!r||e.length!==r);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return e}}(t,r)||function(t,r){if(t){if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e=w)throw new Error(l);y=r,d=r}else{var I=r.split(":");if(2!==I.length)throw new Error(h);var S=n(I,2),x=S[0],_=S[1];if(""===x)y=0;else{var N=Number(x);if(!Number.isInteger(N)||N<0)throw new Error(c);if(N>=w)throw new Error(l);y=N}if(""===_)d=w-1;else{var E=Number(_);if(!Number.isInteger(E)||E<0)throw new Error(c);if(E>=w)throw new Error(l);d=E}if(y>d)throw new Error(h)}if("number"===a){if(!Number.isInteger(e)||e<0)throw new Error(f);if(e>=A)throw new Error(v);p=e,b=e}else{var M=e.split(":");if(2!==M.length)throw new Error(m);var O=n(M,2),j=O[0],R=O[1];if(""===j)p=0;else{var T=Number(j);if(!Number.isInteger(T)||T<0)throw new Error(f);if(T>=A)throw new Error(v);p=T}if(""===R)b=A-1;else{var L=Number(R);if(!Number.isInteger(L)||L<0)throw new Error(f);if(L>=A)throw new Error(v);b=L}if(p>b)throw new Error(m)}for(var C=t._matrix,D=b-p+1,U=new Array(d-y+1),P=y;P<=d;P++){for(var V=new Array(D),$=p;$<=b;$++)V[$-p]=C[P][$];U[P-y]=V}return new this(U)}},6164:t=>{"use strict";function r(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e{"use strict";t.exports=function(t,r){return void 0===r?this.generate(t,t,(function(){return 0})):this.generate(t,r,(function(){return 0}))}},251:(t,r,e)=>{"use strict";var n=e(5526),i=e(5300).INVALID_MATRIX;function o(t){if(!n(t))throw new Error(i);this._matrix=t,this._digit=8}t.exports=o,o.prototype.isDiagonal=e(5248),o.prototype.isSkewSymmetric=e(7917),o.prototype.isSquare=e(9479),o.prototype.isSymmetric=e(5933),o.prototype.isLowerTriangular=e(352),o.prototype.isUpperTriangular=e(4380),o.prototype.isOrthogonal=e(5628),o.prototype.cond=e(8933),o.prototype.det=e(7382),o.prototype.eigenvalues=e(4808),o.prototype.nullity=e(5157),o.prototype.norm=e(8982),o.prototype.rank=e(9486),o.prototype.size=e(9923),o.prototype.trace=e(7530),o.add=e(3632),o.inverse=e(4536),o.multiply=e(298),o.pow=e(5967),o.subtract=e(8551),o.transpose=e(8849),o.backward=e(4697),o.forward=e(1956),o.solve=e(6878),o.LU=e(8800),o.QR=e(8313),o.clone=e(1595),o.column=e(204),o.diag=e(3842),o.elementwise=e(1531),o.generate=e(8879),o.getDiag=e(6357),o.getRandomMatrix=e(3134),o.identity=e(2023),o.isEqual=e(4534),o.row=e(9127),o.submatrix=e(8122),o.zero=e(6529),o.prototype.entry=e(1293),o.prototype.toString=e(6164)},8307:(t,r,e)=>{"use strict";var n=e(5300).INVALID_ROW_COL;t.exports=function(t,r){if(!Number.isInteger(t)||t<0||!Number.isInteger(r)||r<0)throw new Error(n);if(0===t||0===r)return[];for(var e=new Array(t),i=0;i{"use strict";var n=e(3907);t.exports=function(t){if(!Array.isArray(t))return!1;var r=t.length;if(0===r)return!0;var e=t[0];if(!Array.isArray(e))return!1;var i=e.length;if(0===i)return!1;for(var o=0;o{"use strict";t.exports=function(t){return Number.isFinite(t)}},9955:t=>{var r={Matrix:function(){}};r.Matrix.create=function(t){return(new r.Matrix).setElements(t)},r.Matrix.I=function(t){for(var e,n=[],i=t;i--;)for(e=t,n[i]=[];e--;)n[i][e]=i===e?1:0;return r.Matrix.create(n)},r.Matrix.prototype={dup:function(){return r.Matrix.create(this.elements)},isSquare:function(){var t=0===this.elements.length?0:this.elements[0].length;return this.elements.length===t},toRightTriangular:function(){if(0===this.elements.length)return r.Matrix.create([]);var t,e,n,i,o=this.dup(),a=this.elements.length,s=this.elements[0].length;for(e=0;e=a&&f[s].push(o);for(u.elements[s]=n,t=s;t--;){for(n=[],e=0;e