{"version":3,"file":"ml-airpls.min.js","sources":["../node_modules/cuthill-mckee/cuthill-mckee.js","../src/choleskySolver.js","../src/index.js"],"sourcesContent":["'use strict'\n\nmodule.exports = cuthillMckee\n\nfunction compareNum(a, b) { return a - b }\n\nfunction cuthillMckee(list, n) {\n var adj = new Array(n)\n var visited = new Array(n)\n for(var i=0; i= 0 */\n Ap, /* input of size n + 1, not modified */\n Ai, /* input of size nz=Ap[n], not modified */\n Lp, /* output of size n + 1, not defined on input */\n Parent, /* output of size n, not defined on input */\n Lnz, /* output of size n, not defined on input */\n Flag /* workspace of size n, not defn. on input or output */\n ) {\n var i, k, p, kk, p2;\n \n for (k = 0; k < n; k++) {\n /* L(k,:) pattern: all nodes reachable in etree from nz in A(0:k-1,k) */\n Parent[k] = -1; /* parent of k is not yet known */\n Flag[k] = k; /* mark node k as visited */\n Lnz[k] = 0; /* count of nonzeros in column k of L */\n kk = (k); /* kth original, or permuted, column */\n p2 = Ap[kk + 1];\n for (p = Ap[kk]; p < p2; p++) {\n /* A (i,k) is nonzero (original or permuted A) */\n i = (Ai[p]);\n \n if (i < k) {\n /* follow path from i to root of etree, stop at flagged node */\n for (; Flag[i] !== k; i = Parent[i]) {\n /* find parent of i if not yet determined */\n if (Parent[i] === -1) Parent[i] = k;\n Lnz[i]++; /* L (k,i) is nonzero */\n Flag[i] = k; /* mark i as visited */\n }\n }\n }\n }\n /* construct Lp index array from Lnz column counts */\n Lp[0] = 0;\n for (k = 0; k < n; k++) {\n Lp[k + 1] = Lp[k] + Lnz[k];\n }\n }\n \n function ldl_numeric(\n n, /* A and L are n-by-n, where n >= 0 */\n Ap, /* input of size n+1, not modified */\n Ai, /* input of size nz=Ap[n], not modified */\n Ax, /* input of size nz=Ap[n], not modified */\n Lp, /* input of size n+1, not modified */\n Parent, /* input of size n, not modified */\n Lnz, /* output of size n, not defn. on input */\n Li, /* output of size lnz=Lp[n], not defined on input */\n Lx, /* output of size lnz=Lp[n], not defined on input */\n D, /* output of size n, not defined on input */\n Y, /* workspace of size n, not defn. on input or output */\n Pattern, /* workspace of size n, not defn. on input or output */\n Flag /* workspace of size n, not defn. on input or output */\n ) {\n var yi, l_ki;\n var i, k, p, kk, p2, len, top;\n for (k = 0; k < n; k++) {\n /* compute nonzero Pattern of kth row of L, in topological order */\n Y[k] = 0.0; /* Y(0:k) is now all zero */\n top = n; /* stack for pattern is empty */\n Flag[k] = k; /* mark node k as visited */\n Lnz[k] = 0; /* count of nonzeros in column k of L */\n kk = (k); /* kth original, or permuted, column */\n p2 = Ap[kk + 1];\n for (p = Ap[kk]; p < p2; p++) {\n i = (Ai[p]); /* get A(i,k) */\n if (i <= k) {\n Y[i] += Ax[p]; /* scatter A(i,k) into Y (sum duplicates) */\n for (len = 0; Flag[i] !== k; i = Parent[i]) {\n Pattern[len++] = i; /* L(k,i) is nonzero */\n Flag[i] = k; /* mark i as visited */\n }\n while (len > 0) Pattern[--top] = Pattern[--len];\n }\n }\n /* compute numerical values kth row of L (a sparse triangular solve) */\n D[k] = Y[k]; /* get D(k,k) and clear Y(k) */\n Y[k] = 0.0;\n for (; top < n; top++) {\n i = Pattern[top]; /* Pattern[top:n-1] is pattern of L(:,k) */\n yi = Y[i]; /* get and clear Y(i) */\n Y[i] = 0.0;\n p2 = Lp[i] + Lnz[i];\n for (p = Lp[i]; p < p2; p++) {\n Y[Li[p]] -= Lx[p] * yi;\n }\n l_ki = yi / D[i]; /* the nonzero entry L(k,i) */\n D[k] -= l_ki * yi;\n Li[p] = k; /* store L(k,i) in column form of L */\n Lx[p] = l_ki;\n Lnz[i]++; /* increment count of nonzeros in col i */\n }\n \n if (D[k] === 0.0) return (k); /* failure, D(k,k) is zero */\n }\n \n return (n); /* success, diagonal of D is all nonzero */\n }\n \n function ldl_lsolve(\n n, /* L is n-by-n, where n >= 0 */\n X, /* size n. right-hand-side on input, soln. on output */\n Lp, /* input of size n+1, not modified */\n Li, /* input of size lnz=Lp[n], not modified */\n Lx /* input of size lnz=Lp[n], not modified */\n ) {\n var j, p, p2;\n for (j = 0; j < n; j++) {\n p2 = Lp[j + 1];\n for (p = Lp[j]; p < p2; p++) {\n X[Li[p]] -= Lx[p] * X[j];\n }\n }\n }\n function ldl_dsolve(\n n, /* D is n-by-n, where n >= 0 */\n X, /* size n. right-hand-side on input, soln. on output */\n D /* input of size n, not modified */\n ) {\n var j;\n for (j = 0; j < n; j++) {\n X[j] /= D[j];\n }\n }\n function ldl_ltsolve(\n n, /* L is n-by-n, where n >= 0 */\n X, /* size n. right-hand-side on input, soln. on output */\n Lp, /* input of size n+1, not modified */\n Li, /* input of size lnz=Lp[n], not modified */\n Lx /* input of size lnz=Lp[n], not modified */\n ) {\n var j, p, p2;\n for (j = n - 1; j >= 0; j--) {\n p2 = Lp[j + 1];\n for (p = Lp[j]; p < p2; p++) {\n X[j] -= Lx[p] * X[Li[p]];\n }\n }\n }\n \n function ldl_perm(\n n,\t\t/* size of X, B, and P */\n X,\t/* output of size n. */\n B,\t/* input of size n. */\n P\t/* input permutation array of size n. */\n ) {\n var j;\n for (j = 0; j < n; j++) {\n X[j] = B [P[j]];\n }\n }\n \n function ldl_permt(\n n,\t\t/* size of X, B, and P */\n X,\t/* output of size n. */\n B,\t/* input of size n. */\n P\t/* input permutation array of size n. */\n ) {\n var j;\n for (j = 0; j < n; j++) {\n X [P[j]] = B[j];\n }\n }\n \n function prepare(M, n, P) {\n const ANZ = M.length;\n \n // if a permutation was specified, apply it.\n if (P) {\n var Pinv = new Array(n);\n \n for (let k = 0; k < n; k++) {\n Pinv[P[k]] = k;\n }\n \n var Mt = []; // scratch memory\n // Apply permutation. We make M into P*M*P^T\n for (var a = 0; a < M.length; ++a) {\n var ar = Pinv[M[a][0]];\n var ac = Pinv[M[a][1]];\n \n // we only store the upper-diagonal elements(since we assume matrix is symmetric, we only need to store these)\n // if permuted element is below diagonal, we simply transpose it.\n if (ac < ar) {\n var t = ac;\n ac = ar;\n ar = t;\n }\n \n Mt[a] = [];\n Mt[a][0] = ar;\n Mt[a][1] = ac;\n Mt[a][2] = M[a][2];\n }\n \n M = Mt; // copy scratch memory.\n } else {\n // if P argument is null, we just use an identity permutation.\n var P = [];\n for (var i = 0; i < n; ++i) {\n P[i] = i;\n }\n }\n \n // The sparse matrix we are decomposing is A.\n // Now we shall create A from M.\n var Ap = new Array(n + 1);\n var Ai = new Array(M.length);\n var Ax = new Array(M.length);\n \n // count number of non-zero elements in columns.\n var LNZ = [];\n for (var i = 0; i < n; ++i) {\n LNZ[i] = 0;\n }\n for (var a = 0; a < M.length; ++a) {\n LNZ[M[a][1]]++;\n }\n \n Ap[0] = 0;\n for (var i = 0; i < n; ++i) {\n Ap[i + 1] = Ap[i] + LNZ[i];\n }\n \n var coloffset = [];\n for (var a = 0; a < n; ++a) {\n coloffset[a] = 0;\n }\n \n // go through all elements in M, and add them to sparse matrix A.\n for (var i = 0; i < M.length; ++i) {\n var e = M[i];\n var col = e[1];\n \n var adr = Ap[col] + coloffset[col];\n Ai[adr] = e[0];\n Ax[adr] = e[2];\n \n coloffset[col]++;\n }\n \n var D = new Array(n);\n var Y = new Array(n);\n var Lp = new Array(n + 1);\n var Parent = new Array(n);\n var Lnz = new Array(n);\n var Flag = new Array(n);\n var Pattern = new Array(n);\n var bp1 = new Array(n);\n var x = new Array(n);\n var d;\n \n ldl_symbolic(n, Ap, Ai, Lp, Parent, Lnz, Flag);\n \n var Lx = new Array(Lp[n]);\n var Li = new Array(Lp[n]);\n \n d = ldl_numeric(n, Ap, Ai, Ax, Lp, Parent, Lnz, Li, Lx, D, Y, Pattern, Flag);\n \n if (d === n) {\n return function (b) {\n ldl_perm(n, bp1, b, P);\n ldl_lsolve(n, bp1, Lp, Li, Lx);\n ldl_dsolve(n, bp1, D);\n ldl_ltsolve(n, bp1, Lp, Li, Lx);\n ldl_permt(n, x, bp1, P);\n \n return x;\n };\n } else {\n return null;\n }\n }\n \n export { prepare as default };\n ","import cuthillMckee from 'cuthill-mckee';\nimport Cholesky from './choleskySolver';\n\n/**\n * Fit the baseline drift by iteratively changing weights of sum square error between the fitted baseline and original signals,\n * for further information about the parameters you can get the [paper of airPLS](https://github.com/zmzhang/airPLS/blob/master/airPLS_manuscript.pdf)\n * @param {Array} yData - original data\n * @param {object} [options={}] - options\n * @param {number} [options.maxIterations = 100] - maximal number of iterations if the method does not reach the stop criterion\n * @param {number} [options.factorCriterion = 0.001] - factor of the sum of absolute value of original data, to compute stop criterion\n * @param {Array} [options.weights = [1,1,...]] - initial weights vector, default each point has the same weight\n * @param {number} [options.lambda = 100] - factor of weights matrix in -> [I + lambda D'D]z = x\n * @returns {array} - list with baseline, corrected (original - baseline), iteration and error value.\n */\nfunction airPLS(yData, options = {}) {\n let {\n maxIterations = 100,\n lambda = 100,\n factorCriterion = 0.001,\n weights = new Array(yData.length).fill(1),\n controlPoints = []\n } = options;\n\n var nbPoints = yData.length;\n var stopCriterion = factorCriterion * yData.reduce((sum, e) => Math.abs(e) + sum, 0);\n\n var { lowerTriangularNonZeros, permutationEncodedArray } = getDeltaMatrix(nbPoints, lambda);\n\n var sumNegDifferences = Number.MAX_SAFE_INTEGER;\n for (var iteration = 0; (iteration < maxIterations && Math.abs(sumNegDifferences) > stopCriterion); iteration++) {\n let [leftHandSide, rightHandSide] = updateSystem(lowerTriangularNonZeros, yData, weights);\n\n let cho = Cholesky(leftHandSide, nbPoints, permutationEncodedArray);\n\n var baseline = cho(rightHandSide);\n\n sumNegDifferences = 0;\n\n let difference = yData.map(calculateError);\n\n let maxNegativeDiff = -1 * Number.MAX_SAFE_INTEGER;\n for (var i = 1, l = nbPoints - 1; i < l; i++) {\n let diff = difference[i];\n if (diff >= 0) {\n weights[i] = 0;\n } else {\n weights[i] = Math.exp(iteration * diff / sumNegDifferences);\n if (maxNegativeDiff < diff) maxNegativeDiff = diff;\n }\n }\n\n let value = Math.exp(iteration * maxNegativeDiff / sumNegDifferences);\n weights[0] = value;\n weights[l] = value;\n controlPoints.forEach(i => (weights[i] = value))\n }\n\n return {\n corrected: yData.map((e, i) => e - baseline[i]),\n baseline,\n iteration,\n error: sumNegDifferences\n };\n\n function calculateError(e, i) {\n let diff = e - baseline[i];\n if (diff < 0) sumNegDifferences += diff;\n return diff;\n }\n}\n\n\nfunction getDeltaMatrix(nbPoints, lambda) {\n var matrix = [];\n for (var i = 0, last = nbPoints - 1; i < last; i++) {\n matrix.push([i, i, lambda * 2]);\n matrix.push([i + 1, i, -1 * lambda]);\n }\n matrix[0][2] = lambda;\n matrix.push([last, last, lambda]);\n return { lowerTriangularNonZeros: matrix, permutationEncodedArray: cuthillMckee(matrix, nbPoints) };\n}\n\nfunction updateSystem(matrix, yData, weights) {\n let nbPoints = yData.length;\n var newMatrix = new Array(matrix.length);\n var newVector = new Float64Array(nbPoints);\n for (var i = 0, l = nbPoints - 1; i < l; i++) {\n let w = weights[i];\n let diag = i * 2;\n let next = diag + 1;\n newMatrix[diag] = matrix[diag].slice();\n newMatrix[next] = matrix[next].slice();\n if (w === 0) {\n newVector[i] = 0;\n } else {\n newVector[i] = yData[i] * w;\n newMatrix[diag][2] += w;\n }\n }\n newVector[l] = yData[l] * weights[l];\n newMatrix[l * 2] = matrix[l * 2].slice();\n newMatrix[l * 2][2] += weights[l];\n\n return [newMatrix, newVector];\n}\n\n\nexport { airPLS as default };\n"],"names":["list","n","adj","Array","visited","i","length","l","push","toVisit","eol","ptr","v","nbhd","sort","compareNum","j","u","result","a","b","prepare","M","P","Pinv","k","Mt","ar","ac","t","Ap","Ai","Ax","LNZ","coloffset","e","col","adr","D","Y","Lp","Parent","Lnz","Flag","Pattern","bp1","x","p","kk","p2","ldl_symbolic","Lx","Li","yi","l_ki","len","top","ldl_numeric","X","B","ldl_perm","ldl_lsolve","ldl_dsolve","ldl_ltsolve","ldl_permt","getDeltaMatrix","nbPoints","lambda","matrix","last","lowerTriangularNonZeros","permutationEncodedArray","cuthillMckee","updateSystem","yData","weights","newMatrix","newVector","Float64Array","w","diag","next","slice","options","maxIterations","factorCriterion","fill","controlPoints","stopCriterion","reduce","sum","Math","abs","sumNegDifferences","Number","MAX_SAFE_INTEGER","iteration","leftHandSide","rightHandSide","baseline","Cholesky","cho","difference","map","calculateError","maxNegativeDiff","diff","exp","value","forEach","corrected","error"],"mappings":"+LAEA,MAIA,SAAsBA,EAAMC,WACtBC,EAAM,IAAIC,MAAMF,GAChBG,EAAU,IAAID,MAAMF,GAChBI,EAAE,EAAGA,EAAEJ,IAAKI,EAClBH,EAAIG,GAAS,GACbD,EAAQC,IAAK,MAGPA,EAAE,EAAGA,EAAEL,EAAKM,SAAUD,EAAG,KAC3BE,EAAIP,EAAKK,GACbH,EAAIK,EAAE,IAAIC,KAAKD,EAAE,QAGfE,EAAU,IAAIN,MAAMF,GACpBS,EAAM,EACNC,EAAM,MACFN,EAAE,EAAGA,EAAEJ,IAAKI,MACfD,EAAQC,OAGXI,EAAQC,KAASL,EACjBD,EAAQC,IAAK,EACPM,EAAMD,GAAK,KACXE,EAAIH,EAAQE,KACZE,EAAOX,EAAIU,GACfC,EAAKC,KAAKC,OACN,IAAIC,EAAE,EAAGA,EAAEH,EAAKP,SAAUU,EAAG,KAC3BC,EAAIJ,EAAKG,GACVZ,EAAQa,KAGXb,EAAQa,IAAK,EACbR,EAAQC,KAASO,QAKnBC,EAAS,IAAIf,MAAMF,OACfI,EAAE,EAAGA,EAAEJ,IAAKI,EAClBa,EAAOT,EAAQJ,IAAMA,SAGhBa,GA5CT,SAASH,EAAWI,EAAGC,UAAYD,EAAIC,ECiKrC,SAASC,EAAQC,EAAGrB,EAAGsB,GACTD,EAAEhB,UAGViB,EAAG,KACDC,EAAO,IAAIrB,MAAMF,OAEhB,IAAIwB,EAAI,EAAGA,EAAIxB,EAAGwB,IACrBD,EAAKD,EAAEE,IAAMA,UAGXC,EAAK,GAEAP,EAAI,EAAGA,EAAIG,EAAEhB,SAAUa,EAAG,KAC7BQ,EAAKH,EAAKF,EAAEH,GAAG,IACfS,EAAKJ,EAAKF,EAAEH,GAAG,OAIfS,EAAKD,EAAI,KACPE,EAA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