@mojir/dvala 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (914) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1613 -4
  3. package/dist/bundler.esm.js +2 -0
  4. package/dist/bundler.esm.js.map +1 -0
  5. package/dist/bundler.js +2 -0
  6. package/dist/bundler.js.map +1 -0
  7. package/dist/cli/cli/src/cli.d.ts +2 -0
  8. package/dist/cli/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
  9. package/dist/cli/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
  10. package/dist/cli/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
  11. package/dist/cli/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
  12. package/dist/cli/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
  13. package/dist/cli/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
  14. package/dist/cli/cli/src/cliDocumentation/getCliType.d.ts +3 -0
  15. package/dist/cli/cli/src/cliFormatterRules.d.ts +13 -0
  16. package/dist/cli/cli/src/colorizer.d.ts +939 -0
  17. package/dist/cli/cli/src/createReadlineInterface.d.ts +5 -0
  18. package/dist/cli/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
  19. package/dist/cli/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
  20. package/dist/cli/cli/src/js-interop/Cli/index.d.ts +2 -0
  21. package/dist/cli/cli.js +38614 -0
  22. package/dist/cli/common/createFormatter.d.ts +6 -0
  23. package/dist/cli/common/utils.d.ts +2 -0
  24. package/dist/cli/reference/api.d.ts +75 -0
  25. package/dist/cli/reference/datatype.d.ts +3 -0
  26. package/dist/cli/reference/effect.d.ts +3 -0
  27. package/dist/cli/reference/examples.d.ts +11 -0
  28. package/dist/cli/reference/index.d.ts +191 -0
  29. package/dist/cli/reference/shorthand.d.ts +3 -0
  30. package/dist/cli/src/AutoCompleter/AutoCompleter.d.ts +25 -0
  31. package/dist/cli/src/Dvala/Cache.d.ts +16 -0
  32. package/dist/cli/src/Dvala/Dvala.d.ts +68 -0
  33. package/dist/cli/src/allModules.d.ts +2 -0
  34. package/dist/cli/src/builtin/bindingNode.d.ts +11 -0
  35. package/dist/cli/src/builtin/core/array.d.ts +2 -0
  36. package/dist/cli/src/builtin/core/assertion.d.ts +2 -0
  37. package/dist/cli/src/builtin/core/bitwise.d.ts +2 -0
  38. package/dist/cli/src/builtin/core/collection.d.ts +2 -0
  39. package/dist/cli/src/builtin/core/functional.d.ts +2 -0
  40. package/dist/cli/src/builtin/core/math.d.ts +2 -0
  41. package/dist/cli/src/builtin/core/meta.d.ts +3 -0
  42. package/dist/cli/src/builtin/core/misc.d.ts +2 -0
  43. package/dist/cli/src/builtin/core/object.d.ts +2 -0
  44. package/dist/cli/src/builtin/core/predicates.d.ts +2 -0
  45. package/dist/cli/src/builtin/core/regexp.d.ts +2 -0
  46. package/dist/cli/src/builtin/core/sequence.d.ts +2 -0
  47. package/dist/cli/src/builtin/core/string.d.ts +2 -0
  48. package/dist/cli/src/builtin/core/vector.d.ts +2 -0
  49. package/dist/cli/src/builtin/index.d.ts +13 -0
  50. package/dist/cli/src/builtin/interface.d.ts +113 -0
  51. package/dist/cli/src/builtin/modules/assertion/docs.d.ts +2 -0
  52. package/dist/cli/src/builtin/modules/assertion/index.d.ts +2 -0
  53. package/dist/cli/src/builtin/modules/bitwise/index.d.ts +2 -0
  54. package/dist/cli/src/builtin/modules/collection/index.d.ts +2 -0
  55. package/dist/cli/src/builtin/modules/convert/index.d.ts +2 -0
  56. package/dist/cli/src/builtin/modules/functional/index.d.ts +2 -0
  57. package/dist/cli/src/builtin/modules/grid/docs.d.ts +2 -0
  58. package/dist/cli/src/builtin/modules/grid/fromArray.d.ts +8 -0
  59. package/dist/cli/src/builtin/modules/grid/index.d.ts +2 -0
  60. package/dist/cli/src/builtin/modules/grid/transpose.d.ts +2 -0
  61. package/dist/cli/src/builtin/modules/interface.d.ts +11 -0
  62. package/dist/cli/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
  63. package/dist/cli/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
  64. package/dist/cli/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
  65. package/dist/cli/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
  66. package/dist/cli/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
  67. package/dist/cli/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
  68. package/dist/cli/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
  69. package/dist/cli/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
  70. package/dist/cli/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
  71. package/dist/cli/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
  72. package/dist/cli/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
  73. package/dist/cli/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
  74. package/dist/cli/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
  75. package/dist/cli/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
  76. package/dist/cli/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
  77. package/dist/cli/src/builtin/modules/linear-algebra/index.d.ts +4 -0
  78. package/dist/cli/src/builtin/modules/math/index.d.ts +2 -0
  79. package/dist/cli/src/builtin/modules/matrix/docs.d.ts +2 -0
  80. package/dist/cli/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
  81. package/dist/cli/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
  82. package/dist/cli/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
  83. package/dist/cli/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
  84. package/dist/cli/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
  85. package/dist/cli/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
  86. package/dist/cli/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
  87. package/dist/cli/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
  88. package/dist/cli/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
  89. package/dist/cli/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
  90. package/dist/cli/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
  91. package/dist/cli/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
  92. package/dist/cli/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
  93. package/dist/cli/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
  94. package/dist/cli/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
  95. package/dist/cli/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
  96. package/dist/cli/src/builtin/modules/matrix/index.d.ts +4 -0
  97. package/dist/cli/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
  98. package/dist/cli/src/builtin/modules/number-theory/combinations.d.ts +2 -0
  99. package/dist/cli/src/builtin/modules/number-theory/derangements.d.ts +2 -0
  100. package/dist/cli/src/builtin/modules/number-theory/divisors.d.ts +4 -0
  101. package/dist/cli/src/builtin/modules/number-theory/docs.d.ts +2 -0
  102. package/dist/cli/src/builtin/modules/number-theory/factorial.d.ts +3 -0
  103. package/dist/cli/src/builtin/modules/number-theory/index.d.ts +4 -0
  104. package/dist/cli/src/builtin/modules/number-theory/partitions.d.ts +2 -0
  105. package/dist/cli/src/builtin/modules/number-theory/permutations.d.ts +2 -0
  106. package/dist/cli/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
  107. package/dist/cli/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
  108. package/dist/cli/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
  109. package/dist/cli/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
  110. package/dist/cli/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
  111. package/dist/cli/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
  112. package/dist/cli/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
  113. package/dist/cli/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
  114. package/dist/cli/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
  115. package/dist/cli/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
  116. package/dist/cli/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
  117. package/dist/cli/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
  118. package/dist/cli/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
  119. package/dist/cli/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
  120. package/dist/cli/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
  121. package/dist/cli/src/builtin/modules/number-theory/sequences/index.d.ts +27 -0
  122. package/dist/cli/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
  123. package/dist/cli/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
  124. package/dist/cli/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
  125. package/dist/cli/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
  126. package/dist/cli/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
  127. package/dist/cli/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
  128. package/dist/cli/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
  129. package/dist/cli/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
  130. package/dist/cli/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
  131. package/dist/cli/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
  132. package/dist/cli/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
  133. package/dist/cli/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
  134. package/dist/cli/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
  135. package/dist/cli/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
  136. package/dist/cli/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
  137. package/dist/cli/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
  138. package/dist/cli/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
  139. package/dist/cli/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
  140. package/dist/cli/src/builtin/modules/random/docs.d.ts +2 -0
  141. package/dist/cli/src/builtin/modules/random/index.d.ts +2 -0
  142. package/dist/cli/src/builtin/modules/sequence/index.d.ts +2 -0
  143. package/dist/cli/src/builtin/modules/string/index.d.ts +2 -0
  144. package/dist/cli/src/builtin/modules/vector/bincount.d.ts +9 -0
  145. package/dist/cli/src/builtin/modules/vector/calcMad.d.ts +1 -0
  146. package/dist/cli/src/builtin/modules/vector/calcMean.d.ts +1 -0
  147. package/dist/cli/src/builtin/modules/vector/calcMedad.d.ts +1 -0
  148. package/dist/cli/src/builtin/modules/vector/calcMedian.d.ts +1 -0
  149. package/dist/cli/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
  150. package/dist/cli/src/builtin/modules/vector/calcVariance.d.ts +2 -0
  151. package/dist/cli/src/builtin/modules/vector/docs.d.ts +2 -0
  152. package/dist/cli/src/builtin/modules/vector/entropy.d.ts +8 -0
  153. package/dist/cli/src/builtin/modules/vector/histogram.d.ts +9 -0
  154. package/dist/cli/src/builtin/modules/vector/index.d.ts +2 -0
  155. package/dist/cli/src/builtin/modules/vector/mode.d.ts +6 -0
  156. package/dist/cli/src/builtin/modules/vector/outliers.d.ts +7 -0
  157. package/dist/cli/src/builtin/modules/vector/percentile.d.ts +7 -0
  158. package/dist/cli/src/builtin/modules/vector/quartiles.d.ts +1 -0
  159. package/dist/cli/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
  160. package/dist/cli/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
  161. package/dist/cli/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
  162. package/dist/cli/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
  163. package/dist/cli/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
  164. package/dist/cli/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
  165. package/dist/cli/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
  166. package/dist/cli/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
  167. package/dist/cli/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
  168. package/dist/cli/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
  169. package/dist/cli/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
  170. package/dist/cli/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
  171. package/dist/cli/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
  172. package/dist/cli/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
  173. package/dist/cli/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
  174. package/dist/cli/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
  175. package/dist/cli/src/builtin/normalExpressions/index.d.ts +8 -0
  176. package/dist/cli/src/builtin/specialExpressionTypes.d.ts +26 -0
  177. package/dist/cli/src/builtin/specialExpressions/and.d.ts +6 -0
  178. package/dist/cli/src/builtin/specialExpressions/array.d.ts +6 -0
  179. package/dist/cli/src/builtin/specialExpressions/block.d.ts +6 -0
  180. package/dist/cli/src/builtin/specialExpressions/cond.d.ts +6 -0
  181. package/dist/cli/src/builtin/specialExpressions/defined.d.ts +5 -0
  182. package/dist/cli/src/builtin/specialExpressions/effect.d.ts +5 -0
  183. package/dist/cli/src/builtin/specialExpressions/functions.d.ts +6 -0
  184. package/dist/cli/src/builtin/specialExpressions/if.d.ts +6 -0
  185. package/dist/cli/src/builtin/specialExpressions/import.d.ts +6 -0
  186. package/dist/cli/src/builtin/specialExpressions/let.d.ts +6 -0
  187. package/dist/cli/src/builtin/specialExpressions/loop.d.ts +6 -0
  188. package/dist/cli/src/builtin/specialExpressions/loops.d.ts +9 -0
  189. package/dist/cli/src/builtin/specialExpressions/match.d.ts +7 -0
  190. package/dist/cli/src/builtin/specialExpressions/object.d.ts +6 -0
  191. package/dist/cli/src/builtin/specialExpressions/or.d.ts +6 -0
  192. package/dist/cli/src/builtin/specialExpressions/parallel.d.ts +6 -0
  193. package/dist/cli/src/builtin/specialExpressions/perform.d.ts +6 -0
  194. package/dist/cli/src/builtin/specialExpressions/qq.d.ts +6 -0
  195. package/dist/cli/src/builtin/specialExpressions/race.d.ts +6 -0
  196. package/dist/cli/src/builtin/specialExpressions/recur.d.ts +5 -0
  197. package/dist/cli/src/builtin/specialExpressions/throw.d.ts +5 -0
  198. package/dist/cli/src/builtin/specialExpressions/try.d.ts +7 -0
  199. package/dist/cli/src/builtin/specialExpressions/unless.d.ts +6 -0
  200. package/dist/cli/src/builtin/utils.d.ts +6 -0
  201. package/dist/cli/src/bundler/index.d.ts +9 -0
  202. package/dist/cli/src/bundler/interface.d.ts +15 -0
  203. package/dist/cli/src/bundler.d.ts +3 -0
  204. package/dist/cli/src/cli.d.ts +2 -0
  205. package/dist/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
  206. package/dist/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
  207. package/dist/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
  208. package/dist/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
  209. package/dist/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
  210. package/dist/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
  211. package/dist/cli/src/cliDocumentation/getCliType.d.ts +3 -0
  212. package/dist/cli/src/cliFormatterRules.d.ts +13 -0
  213. package/dist/cli/src/colorizer.d.ts +939 -0
  214. package/dist/cli/src/constants/constants.d.ts +19 -0
  215. package/dist/cli/src/createReadlineInterface.d.ts +5 -0
  216. package/dist/cli/src/effects.d.ts +106 -0
  217. package/dist/cli/src/errors.d.ts +24 -0
  218. package/dist/cli/src/evaluator/ContextStack.d.ts +65 -0
  219. package/dist/cli/src/evaluator/effectRef.d.ts +27 -0
  220. package/dist/cli/src/evaluator/effectTypes.d.ts +79 -0
  221. package/dist/cli/src/evaluator/frames.d.ts +525 -0
  222. package/dist/cli/src/evaluator/interface.d.ts +14 -0
  223. package/dist/cli/src/evaluator/serialization.d.ts +45 -0
  224. package/dist/cli/src/evaluator/standardEffects.d.ts +35 -0
  225. package/dist/cli/src/evaluator/step.d.ts +159 -0
  226. package/dist/cli/src/evaluator/suspension.d.ts +53 -0
  227. package/dist/cli/src/evaluator/trampoline.d.ts +119 -0
  228. package/dist/cli/src/getUndefinedSymbols/index.d.ts +7 -0
  229. package/dist/cli/src/index.d.ts +18 -0
  230. package/dist/cli/src/initReferenceData.d.ts +1 -0
  231. package/dist/cli/src/interface.d.ts +7 -0
  232. package/dist/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
  233. package/dist/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
  234. package/dist/cli/src/js-interop/Cli/index.d.ts +2 -0
  235. package/dist/cli/src/parser/ParserContext.d.ts +20 -0
  236. package/dist/cli/src/parser/getPrecedence.d.ts +3 -0
  237. package/dist/cli/src/parser/helpers.d.ts +19 -0
  238. package/dist/cli/src/parser/index.d.ts +5 -0
  239. package/dist/cli/src/parser/subParsers/parseArray.d.ts +3 -0
  240. package/dist/cli/src/parser/subParsers/parseBindingTarget.d.ts +8 -0
  241. package/dist/cli/src/parser/subParsers/parseCond.d.ts +4 -0
  242. package/dist/cli/src/parser/subParsers/parseDo.d.ts +3 -0
  243. package/dist/cli/src/parser/subParsers/parseExpression.d.ts +5 -0
  244. package/dist/cli/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
  245. package/dist/cli/src/parser/subParsers/parseFunction.d.ts +4 -0
  246. package/dist/cli/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
  247. package/dist/cli/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
  248. package/dist/cli/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
  249. package/dist/cli/src/parser/subParsers/parseLet.d.ts +4 -0
  250. package/dist/cli/src/parser/subParsers/parseLoop.d.ts +4 -0
  251. package/dist/cli/src/parser/subParsers/parseMatch.d.ts +4 -0
  252. package/dist/cli/src/parser/subParsers/parseNumber.d.ts +3 -0
  253. package/dist/cli/src/parser/subParsers/parseObject.d.ts +3 -0
  254. package/dist/cli/src/parser/subParsers/parseOperand.d.ts +3 -0
  255. package/dist/cli/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
  256. package/dist/cli/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
  257. package/dist/cli/src/parser/subParsers/parseString.d.ts +4 -0
  258. package/dist/cli/src/parser/subParsers/parseSymbol.d.ts +3 -0
  259. package/dist/cli/src/parser/subParsers/parseTry.d.ts +4 -0
  260. package/dist/cli/src/parser/types.d.ts +129 -0
  261. package/dist/cli/src/symbolPatterns.d.ts +2 -0
  262. package/dist/cli/src/testFramework/index.d.ts +15 -0
  263. package/dist/cli/src/tokenizer/minifyTokenStream.d.ts +4 -0
  264. package/dist/cli/src/tokenizer/operators.d.ts +12 -0
  265. package/dist/cli/src/tokenizer/reservedNames.d.ts +66 -0
  266. package/dist/cli/src/tokenizer/token.d.ts +84 -0
  267. package/dist/cli/src/tokenizer/tokenize.d.ts +8 -0
  268. package/dist/cli/src/tokenizer/tokenizers.d.ts +14 -0
  269. package/dist/cli/src/transformer/index.d.ts +2 -0
  270. package/dist/cli/src/typeGuards/annotatedArrays.d.ts +16 -0
  271. package/dist/cli/src/typeGuards/array.d.ts +9 -0
  272. package/dist/cli/src/typeGuards/astNode.d.ts +19 -0
  273. package/dist/cli/src/typeGuards/dvala.d.ts +26 -0
  274. package/dist/cli/src/typeGuards/dvalaFunction.d.ts +12 -0
  275. package/dist/cli/src/typeGuards/index.d.ts +7 -0
  276. package/dist/cli/src/typeGuards/number.d.ts +66 -0
  277. package/dist/cli/src/typeGuards/string.d.ts +15 -0
  278. package/dist/cli/src/untokenizer/index.d.ts +2 -0
  279. package/dist/cli/src/utils/arity.d.ts +10 -0
  280. package/dist/cli/src/utils/debug/debugTools.d.ts +1 -0
  281. package/dist/cli/src/utils/debug/getCodeMarker.d.ts +2 -0
  282. package/dist/cli/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
  283. package/dist/cli/src/utils/docString/generateDocString.d.ts +2 -0
  284. package/dist/cli/src/utils/getAssertionError.d.ts +3 -0
  285. package/dist/cli/src/utils/index.d.ts +14 -0
  286. package/dist/cli/src/utils/maybePromise.d.ts +54 -0
  287. package/dist/cli/src/utils/symbols.d.ts +3 -0
  288. package/dist/common/createFormatter.d.ts +6 -0
  289. package/dist/common/utils.d.ts +2 -0
  290. package/dist/debug.esm.js +2 -0
  291. package/dist/debug.esm.js.map +1 -0
  292. package/dist/debug.js +2 -0
  293. package/dist/debug.js.map +1 -0
  294. package/dist/dvala.iife.js +2 -0
  295. package/dist/dvala.iife.js.map +1 -0
  296. package/dist/full.esm.js +2 -0
  297. package/dist/full.esm.js.map +1 -0
  298. package/dist/full.js +2 -0
  299. package/dist/full.js.map +1 -0
  300. package/dist/index.esm.js +2 -0
  301. package/dist/index.esm.js.map +1 -0
  302. package/dist/index.js +2 -2
  303. package/dist/index.js.map +1 -1
  304. package/dist/modules/assertion.esm.js +2 -0
  305. package/dist/modules/assertion.esm.js.map +1 -0
  306. package/dist/modules/assertion.js +2 -0
  307. package/dist/modules/assertion.js.map +1 -0
  308. package/dist/modules/bitwise.esm.js +2 -0
  309. package/dist/modules/bitwise.esm.js.map +1 -0
  310. package/dist/modules/bitwise.js +2 -0
  311. package/dist/modules/bitwise.js.map +1 -0
  312. package/dist/modules/cli/src/cli.d.ts +2 -0
  313. package/dist/modules/cli/src/cliDocumentation/formatCliDescription.d.ts +3 -0
  314. package/dist/modules/cli/src/cliDocumentation/getCliArgumentInfo.d.ts +3 -0
  315. package/dist/modules/cli/src/cliDocumentation/getCliDocumentation.d.ts +2 -0
  316. package/dist/modules/cli/src/cliDocumentation/getCliFunctionExamples.d.ts +3 -0
  317. package/dist/modules/cli/src/cliDocumentation/getCliFunctionSignature.d.ts +3 -0
  318. package/dist/modules/cli/src/cliDocumentation/getCliTitle.d.ts +3 -0
  319. package/dist/modules/cli/src/cliDocumentation/getCliType.d.ts +3 -0
  320. package/dist/modules/cli/src/cliFormatterRules.d.ts +13 -0
  321. package/dist/modules/cli/src/colorizer.d.ts +939 -0
  322. package/dist/modules/cli/src/createReadlineInterface.d.ts +5 -0
  323. package/dist/modules/cli/src/js-interop/Cli/Fs/index.d.ts +2 -0
  324. package/dist/modules/cli/src/js-interop/Cli/Proc/index.d.ts +3 -0
  325. package/dist/modules/cli/src/js-interop/Cli/index.d.ts +2 -0
  326. package/dist/modules/collection.esm.js +2 -0
  327. package/dist/modules/collection.esm.js.map +1 -0
  328. package/dist/modules/collection.js +2 -0
  329. package/dist/modules/collection.js.map +1 -0
  330. package/dist/modules/common/createFormatter.d.ts +6 -0
  331. package/dist/modules/common/utils.d.ts +2 -0
  332. package/dist/modules/convert.esm.js +2 -0
  333. package/dist/modules/convert.esm.js.map +1 -0
  334. package/dist/modules/convert.js +2 -0
  335. package/dist/modules/convert.js.map +1 -0
  336. package/dist/modules/functional.esm.js +2 -0
  337. package/dist/modules/functional.esm.js.map +1 -0
  338. package/dist/modules/functional.js +2 -0
  339. package/dist/modules/functional.js.map +1 -0
  340. package/dist/modules/grid.esm.js +2 -0
  341. package/dist/modules/grid.esm.js.map +1 -0
  342. package/dist/modules/grid.js +2 -0
  343. package/dist/modules/grid.js.map +1 -0
  344. package/dist/modules/linear-algebra.esm.js +2 -0
  345. package/dist/modules/linear-algebra.esm.js.map +1 -0
  346. package/dist/modules/linear-algebra.js +2 -0
  347. package/dist/modules/linear-algebra.js.map +1 -0
  348. package/dist/modules/math.esm.js +2 -0
  349. package/dist/modules/math.esm.js.map +1 -0
  350. package/dist/modules/math.js +2 -0
  351. package/dist/modules/math.js.map +1 -0
  352. package/dist/modules/matrix.esm.js +2 -0
  353. package/dist/modules/matrix.esm.js.map +1 -0
  354. package/dist/modules/matrix.js +2 -0
  355. package/dist/modules/matrix.js.map +1 -0
  356. package/dist/modules/number-theory.esm.js +2 -0
  357. package/dist/modules/number-theory.esm.js.map +1 -0
  358. package/dist/modules/number-theory.js +2 -0
  359. package/dist/modules/number-theory.js.map +1 -0
  360. package/dist/modules/random.esm.js +2 -0
  361. package/dist/modules/random.esm.js.map +1 -0
  362. package/dist/modules/random.js +2 -0
  363. package/dist/modules/random.js.map +1 -0
  364. package/dist/modules/reference/api.d.ts +75 -0
  365. package/dist/modules/reference/datatype.d.ts +3 -0
  366. package/dist/modules/reference/effect.d.ts +3 -0
  367. package/dist/modules/reference/index.d.ts +191 -0
  368. package/dist/modules/reference/shorthand.d.ts +3 -0
  369. package/dist/modules/sequence.esm.js +2 -0
  370. package/dist/modules/sequence.esm.js.map +1 -0
  371. package/dist/modules/sequence.js +2 -0
  372. package/dist/modules/sequence.js.map +1 -0
  373. package/dist/modules/src/AutoCompleter/AutoCompleter.d.ts +25 -0
  374. package/dist/modules/src/Dvala/Cache.d.ts +16 -0
  375. package/dist/modules/src/Dvala/Dvala.d.ts +68 -0
  376. package/dist/modules/src/allModules.d.ts +2 -0
  377. package/dist/modules/src/builtin/bindingNode.d.ts +11 -0
  378. package/dist/modules/src/builtin/core/array.d.ts +2 -0
  379. package/dist/modules/src/builtin/core/assertion.d.ts +2 -0
  380. package/dist/modules/src/builtin/core/bitwise.d.ts +2 -0
  381. package/dist/modules/src/builtin/core/collection.d.ts +2 -0
  382. package/dist/modules/src/builtin/core/functional.d.ts +2 -0
  383. package/dist/modules/src/builtin/core/math.d.ts +2 -0
  384. package/dist/modules/src/builtin/core/meta.d.ts +3 -0
  385. package/dist/modules/src/builtin/core/misc.d.ts +2 -0
  386. package/dist/modules/src/builtin/core/object.d.ts +2 -0
  387. package/dist/modules/src/builtin/core/predicates.d.ts +2 -0
  388. package/dist/modules/src/builtin/core/regexp.d.ts +2 -0
  389. package/dist/modules/src/builtin/core/sequence.d.ts +2 -0
  390. package/dist/modules/src/builtin/core/string.d.ts +2 -0
  391. package/dist/modules/src/builtin/core/vector.d.ts +2 -0
  392. package/dist/modules/src/builtin/index.d.ts +13 -0
  393. package/dist/modules/src/builtin/interface.d.ts +113 -0
  394. package/dist/modules/src/builtin/modules/assertion/docs.d.ts +2 -0
  395. package/dist/modules/src/builtin/modules/assertion/index.d.ts +2 -0
  396. package/dist/modules/src/builtin/modules/bitwise/index.d.ts +2 -0
  397. package/dist/modules/src/builtin/modules/collection/index.d.ts +2 -0
  398. package/dist/modules/src/builtin/modules/convert/index.d.ts +2 -0
  399. package/dist/modules/src/builtin/modules/functional/index.d.ts +2 -0
  400. package/dist/modules/src/builtin/modules/grid/docs.d.ts +2 -0
  401. package/dist/modules/src/builtin/modules/grid/fromArray.d.ts +8 -0
  402. package/dist/modules/src/builtin/modules/grid/index.d.ts +2 -0
  403. package/dist/modules/src/builtin/modules/grid/transpose.d.ts +2 -0
  404. package/dist/modules/src/builtin/modules/interface.d.ts +11 -0
  405. package/dist/modules/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
  406. package/dist/modules/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
  407. package/dist/modules/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
  408. package/dist/modules/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
  409. package/dist/modules/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
  410. package/dist/modules/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
  411. package/dist/modules/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
  412. package/dist/modules/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
  413. package/dist/modules/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
  414. package/dist/modules/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
  415. package/dist/modules/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
  416. package/dist/modules/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
  417. package/dist/modules/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
  418. package/dist/modules/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
  419. package/dist/modules/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
  420. package/dist/modules/src/builtin/modules/linear-algebra/index.d.ts +4 -0
  421. package/dist/modules/src/builtin/modules/math/index.d.ts +2 -0
  422. package/dist/modules/src/builtin/modules/matrix/docs.d.ts +2 -0
  423. package/dist/modules/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
  424. package/dist/modules/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
  425. package/dist/modules/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
  426. package/dist/modules/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
  427. package/dist/modules/src/builtin/modules/matrix/helpers/diagonal.d.ts +1 -0
  428. package/dist/modules/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
  429. package/dist/modules/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
  430. package/dist/modules/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
  431. package/dist/modules/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
  432. package/dist/modules/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
  433. package/dist/modules/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
  434. package/dist/modules/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
  435. package/dist/modules/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
  436. package/dist/modules/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
  437. package/dist/modules/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
  438. package/dist/modules/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
  439. package/dist/modules/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
  440. package/dist/modules/src/builtin/modules/matrix/index.d.ts +4 -0
  441. package/dist/modules/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
  442. package/dist/modules/src/builtin/modules/number-theory/combinations.d.ts +2 -0
  443. package/dist/modules/src/builtin/modules/number-theory/derangements.d.ts +2 -0
  444. package/dist/modules/src/builtin/modules/number-theory/divisors.d.ts +4 -0
  445. package/dist/modules/src/builtin/modules/number-theory/docs.d.ts +2 -0
  446. package/dist/modules/src/builtin/modules/number-theory/factorial.d.ts +3 -0
  447. package/dist/modules/src/builtin/modules/number-theory/index.d.ts +4 -0
  448. package/dist/modules/src/builtin/modules/number-theory/partitions.d.ts +2 -0
  449. package/dist/modules/src/builtin/modules/number-theory/permutations.d.ts +2 -0
  450. package/dist/modules/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
  451. package/dist/modules/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
  452. package/dist/modules/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
  453. package/dist/modules/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
  454. package/dist/modules/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
  455. package/dist/modules/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
  456. package/dist/modules/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
  457. package/dist/modules/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
  458. package/dist/modules/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
  459. package/dist/modules/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
  460. package/dist/modules/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
  461. package/dist/modules/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
  462. package/dist/modules/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
  463. package/dist/modules/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
  464. package/dist/modules/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
  465. package/dist/modules/src/builtin/modules/number-theory/sequences/index.d.ts +27 -0
  466. package/dist/modules/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
  467. package/dist/modules/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
  468. package/dist/modules/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
  469. package/dist/modules/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
  470. package/dist/modules/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
  471. package/dist/modules/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
  472. package/dist/modules/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
  473. package/dist/modules/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
  474. package/dist/modules/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
  475. package/dist/modules/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
  476. package/dist/modules/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
  477. package/dist/modules/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
  478. package/dist/modules/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
  479. package/dist/modules/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
  480. package/dist/modules/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
  481. package/dist/modules/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
  482. package/dist/modules/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
  483. package/dist/modules/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
  484. package/dist/modules/src/builtin/modules/random/docs.d.ts +2 -0
  485. package/dist/modules/src/builtin/modules/random/index.d.ts +2 -0
  486. package/dist/modules/src/builtin/modules/sequence/index.d.ts +2 -0
  487. package/dist/modules/src/builtin/modules/string/index.d.ts +2 -0
  488. package/dist/modules/src/builtin/modules/vector/bincount.d.ts +9 -0
  489. package/dist/modules/src/builtin/modules/vector/calcMad.d.ts +1 -0
  490. package/dist/modules/src/builtin/modules/vector/calcMean.d.ts +1 -0
  491. package/dist/modules/src/builtin/modules/vector/calcMedad.d.ts +1 -0
  492. package/dist/modules/src/builtin/modules/vector/calcMedian.d.ts +1 -0
  493. package/dist/modules/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
  494. package/dist/modules/src/builtin/modules/vector/calcVariance.d.ts +2 -0
  495. package/dist/modules/src/builtin/modules/vector/docs.d.ts +2 -0
  496. package/dist/modules/src/builtin/modules/vector/entropy.d.ts +8 -0
  497. package/dist/modules/src/builtin/modules/vector/histogram.d.ts +9 -0
  498. package/dist/modules/src/builtin/modules/vector/index.d.ts +2 -0
  499. package/dist/modules/src/builtin/modules/vector/mode.d.ts +6 -0
  500. package/dist/modules/src/builtin/modules/vector/outliers.d.ts +7 -0
  501. package/dist/modules/src/builtin/modules/vector/percentile.d.ts +7 -0
  502. package/dist/modules/src/builtin/modules/vector/quartiles.d.ts +1 -0
  503. package/dist/modules/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
  504. package/dist/modules/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
  505. package/dist/modules/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
  506. package/dist/modules/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
  507. package/dist/modules/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
  508. package/dist/modules/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
  509. package/dist/modules/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
  510. package/dist/modules/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
  511. package/dist/modules/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
  512. package/dist/modules/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
  513. package/dist/modules/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
  514. package/dist/modules/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
  515. package/dist/modules/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
  516. package/dist/modules/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
  517. package/dist/modules/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
  518. package/dist/modules/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
  519. package/dist/modules/src/builtin/normalExpressions/index.d.ts +8 -0
  520. package/dist/modules/src/builtin/specialExpressionTypes.d.ts +26 -0
  521. package/dist/modules/src/builtin/specialExpressions/and.d.ts +6 -0
  522. package/dist/modules/src/builtin/specialExpressions/array.d.ts +6 -0
  523. package/dist/modules/src/builtin/specialExpressions/block.d.ts +6 -0
  524. package/dist/modules/src/builtin/specialExpressions/cond.d.ts +6 -0
  525. package/dist/modules/src/builtin/specialExpressions/defined.d.ts +5 -0
  526. package/dist/modules/src/builtin/specialExpressions/effect.d.ts +5 -0
  527. package/dist/modules/src/builtin/specialExpressions/functions.d.ts +6 -0
  528. package/dist/modules/src/builtin/specialExpressions/if.d.ts +6 -0
  529. package/dist/modules/src/builtin/specialExpressions/import.d.ts +6 -0
  530. package/dist/modules/src/builtin/specialExpressions/let.d.ts +6 -0
  531. package/dist/modules/src/builtin/specialExpressions/loop.d.ts +6 -0
  532. package/dist/modules/src/builtin/specialExpressions/loops.d.ts +9 -0
  533. package/dist/modules/src/builtin/specialExpressions/match.d.ts +7 -0
  534. package/dist/modules/src/builtin/specialExpressions/object.d.ts +6 -0
  535. package/dist/modules/src/builtin/specialExpressions/or.d.ts +6 -0
  536. package/dist/modules/src/builtin/specialExpressions/parallel.d.ts +6 -0
  537. package/dist/modules/src/builtin/specialExpressions/perform.d.ts +6 -0
  538. package/dist/modules/src/builtin/specialExpressions/qq.d.ts +6 -0
  539. package/dist/modules/src/builtin/specialExpressions/race.d.ts +6 -0
  540. package/dist/modules/src/builtin/specialExpressions/recur.d.ts +5 -0
  541. package/dist/modules/src/builtin/specialExpressions/throw.d.ts +5 -0
  542. package/dist/modules/src/builtin/specialExpressions/try.d.ts +7 -0
  543. package/dist/modules/src/builtin/specialExpressions/unless.d.ts +6 -0
  544. package/dist/modules/src/builtin/utils.d.ts +6 -0
  545. package/dist/modules/src/bundler/index.d.ts +9 -0
  546. package/dist/modules/src/bundler/interface.d.ts +15 -0
  547. package/dist/modules/src/bundler.d.ts +3 -0
  548. package/dist/modules/src/constants/constants.d.ts +19 -0
  549. package/dist/modules/src/debug.d.ts +115 -0
  550. package/dist/modules/src/effects.d.ts +106 -0
  551. package/dist/modules/src/errors.d.ts +24 -0
  552. package/dist/modules/src/evaluator/ContextStack.d.ts +65 -0
  553. package/dist/modules/src/evaluator/effectRef.d.ts +27 -0
  554. package/dist/modules/src/evaluator/effectTypes.d.ts +79 -0
  555. package/dist/modules/src/evaluator/frames.d.ts +525 -0
  556. package/dist/modules/src/evaluator/interface.d.ts +14 -0
  557. package/dist/modules/src/evaluator/serialization.d.ts +45 -0
  558. package/dist/modules/src/evaluator/standardEffects.d.ts +35 -0
  559. package/dist/modules/src/evaluator/step.d.ts +159 -0
  560. package/dist/modules/src/evaluator/suspension.d.ts +53 -0
  561. package/dist/modules/src/evaluator/trampoline.d.ts +119 -0
  562. package/dist/modules/src/full.d.ts +17 -0
  563. package/dist/modules/src/getUndefinedSymbols/index.d.ts +7 -0
  564. package/dist/modules/src/index.d.ts +18 -0
  565. package/dist/modules/src/initReferenceData.d.ts +1 -0
  566. package/dist/modules/src/interface.d.ts +7 -0
  567. package/dist/modules/src/modules/assertion.d.ts +2 -0
  568. package/dist/modules/src/modules/bitwise.d.ts +2 -0
  569. package/dist/modules/src/modules/collection.d.ts +2 -0
  570. package/dist/modules/src/modules/convert.d.ts +2 -0
  571. package/dist/modules/src/modules/functional.d.ts +2 -0
  572. package/dist/modules/src/modules/grid.d.ts +2 -0
  573. package/dist/modules/src/modules/linear-algebra.d.ts +2 -0
  574. package/dist/modules/src/modules/math.d.ts +2 -0
  575. package/dist/modules/src/modules/matrix.d.ts +2 -0
  576. package/dist/modules/src/modules/number-theory.d.ts +2 -0
  577. package/dist/modules/src/modules/random.d.ts +2 -0
  578. package/dist/modules/src/modules/sequence.d.ts +2 -0
  579. package/dist/modules/src/modules/string.d.ts +2 -0
  580. package/dist/modules/src/modules/vector.d.ts +2 -0
  581. package/dist/modules/src/parser/ParserContext.d.ts +20 -0
  582. package/dist/modules/src/parser/getPrecedence.d.ts +3 -0
  583. package/dist/modules/src/parser/helpers.d.ts +19 -0
  584. package/dist/modules/src/parser/index.d.ts +5 -0
  585. package/dist/modules/src/parser/subParsers/parseArray.d.ts +3 -0
  586. package/dist/modules/src/parser/subParsers/parseBindingTarget.d.ts +8 -0
  587. package/dist/modules/src/parser/subParsers/parseCond.d.ts +4 -0
  588. package/dist/modules/src/parser/subParsers/parseDo.d.ts +3 -0
  589. package/dist/modules/src/parser/subParsers/parseExpression.d.ts +5 -0
  590. package/dist/modules/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
  591. package/dist/modules/src/parser/subParsers/parseFunction.d.ts +4 -0
  592. package/dist/modules/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
  593. package/dist/modules/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
  594. package/dist/modules/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
  595. package/dist/modules/src/parser/subParsers/parseLet.d.ts +4 -0
  596. package/dist/modules/src/parser/subParsers/parseLoop.d.ts +4 -0
  597. package/dist/modules/src/parser/subParsers/parseMatch.d.ts +4 -0
  598. package/dist/modules/src/parser/subParsers/parseNumber.d.ts +3 -0
  599. package/dist/modules/src/parser/subParsers/parseObject.d.ts +3 -0
  600. package/dist/modules/src/parser/subParsers/parseOperand.d.ts +3 -0
  601. package/dist/modules/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
  602. package/dist/modules/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
  603. package/dist/modules/src/parser/subParsers/parseString.d.ts +4 -0
  604. package/dist/modules/src/parser/subParsers/parseSymbol.d.ts +3 -0
  605. package/dist/modules/src/parser/subParsers/parseTry.d.ts +4 -0
  606. package/dist/modules/src/parser/types.d.ts +129 -0
  607. package/dist/modules/src/symbolPatterns.d.ts +2 -0
  608. package/dist/modules/src/testFramework/index.d.ts +15 -0
  609. package/dist/modules/src/tokenizer/minifyTokenStream.d.ts +4 -0
  610. package/dist/modules/src/tokenizer/operators.d.ts +12 -0
  611. package/dist/modules/src/tokenizer/reservedNames.d.ts +66 -0
  612. package/dist/modules/src/tokenizer/token.d.ts +84 -0
  613. package/dist/modules/src/tokenizer/tokenize.d.ts +8 -0
  614. package/dist/modules/src/tokenizer/tokenizers.d.ts +14 -0
  615. package/dist/modules/src/transformer/index.d.ts +2 -0
  616. package/dist/modules/src/typeGuards/annotatedArrays.d.ts +16 -0
  617. package/dist/modules/src/typeGuards/array.d.ts +9 -0
  618. package/dist/modules/src/typeGuards/astNode.d.ts +19 -0
  619. package/dist/modules/src/typeGuards/dvala.d.ts +26 -0
  620. package/dist/modules/src/typeGuards/dvalaFunction.d.ts +12 -0
  621. package/dist/modules/src/typeGuards/index.d.ts +7 -0
  622. package/dist/modules/src/typeGuards/number.d.ts +66 -0
  623. package/dist/modules/src/typeGuards/string.d.ts +15 -0
  624. package/dist/modules/src/untokenizer/index.d.ts +2 -0
  625. package/dist/modules/src/utils/arity.d.ts +10 -0
  626. package/dist/modules/src/utils/debug/debugTools.d.ts +1 -0
  627. package/dist/modules/src/utils/debug/getCodeMarker.d.ts +2 -0
  628. package/dist/modules/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
  629. package/dist/modules/src/utils/docString/generateDocString.d.ts +2 -0
  630. package/dist/modules/src/utils/getAssertionError.d.ts +3 -0
  631. package/dist/modules/src/utils/index.d.ts +14 -0
  632. package/dist/modules/src/utils/maybePromise.d.ts +54 -0
  633. package/dist/modules/src/utils/symbols.d.ts +3 -0
  634. package/dist/modules/string.esm.js +2 -0
  635. package/dist/modules/string.esm.js.map +1 -0
  636. package/dist/modules/string.js +2 -0
  637. package/dist/modules/string.js.map +1 -0
  638. package/dist/modules/vector.esm.js +2 -0
  639. package/dist/modules/vector.esm.js.map +1 -0
  640. package/dist/modules/vector.js +2 -0
  641. package/dist/modules/vector.js.map +1 -0
  642. package/dist/reference/api.d.ts +75 -0
  643. package/dist/reference/datatype.d.ts +3 -0
  644. package/dist/reference/effect.d.ts +3 -0
  645. package/dist/reference/index.d.ts +191 -0
  646. package/dist/reference/shorthand.d.ts +3 -0
  647. package/dist/src/AutoCompleter/AutoCompleter.d.ts +25 -0
  648. package/dist/src/Dvala/Cache.d.ts +16 -0
  649. package/dist/src/Dvala/Dvala.d.ts +68 -0
  650. package/dist/src/allModules.d.ts +2 -0
  651. package/dist/src/builtin/bindingNode.d.ts +11 -0
  652. package/dist/src/builtin/core/array.d.ts +2 -0
  653. package/dist/src/builtin/core/assertion.d.ts +2 -0
  654. package/dist/src/builtin/core/bitwise.d.ts +2 -0
  655. package/dist/src/builtin/core/collection.d.ts +2 -0
  656. package/dist/src/builtin/core/functional.d.ts +2 -0
  657. package/dist/src/builtin/core/math.d.ts +2 -0
  658. package/dist/src/builtin/core/meta.d.ts +3 -0
  659. package/dist/src/builtin/core/misc.d.ts +2 -0
  660. package/dist/src/builtin/core/object.d.ts +2 -0
  661. package/dist/src/builtin/core/predicates.d.ts +2 -0
  662. package/dist/src/builtin/core/regexp.d.ts +2 -0
  663. package/dist/src/builtin/core/sequence.d.ts +2 -0
  664. package/dist/src/builtin/core/string.d.ts +2 -0
  665. package/dist/src/builtin/core/vector.d.ts +2 -0
  666. package/dist/src/builtin/index.d.ts +13 -0
  667. package/dist/src/builtin/interface.d.ts +113 -0
  668. package/dist/src/builtin/modules/assertion/docs.d.ts +2 -0
  669. package/dist/src/builtin/modules/assertion/index.d.ts +2 -0
  670. package/dist/src/builtin/modules/bitwise/index.d.ts +2 -0
  671. package/dist/src/builtin/modules/collection/index.d.ts +2 -0
  672. package/dist/src/builtin/modules/convert/index.d.ts +2 -0
  673. package/dist/src/builtin/modules/functional/index.d.ts +2 -0
  674. package/dist/src/builtin/modules/grid/docs.d.ts +2 -0
  675. package/dist/src/builtin/modules/grid/fromArray.d.ts +8 -0
  676. package/dist/src/builtin/modules/grid/index.d.ts +2 -0
  677. package/dist/src/builtin/modules/grid/transpose.d.ts +2 -0
  678. package/dist/src/builtin/modules/interface.d.ts +11 -0
  679. package/dist/src/builtin/modules/linear-algebra/docs.d.ts +2 -0
  680. package/dist/src/builtin/modules/linear-algebra/helpers/calcFractionalRanks.d.ts +1 -0
  681. package/dist/src/builtin/modules/linear-algebra/helpers/collinear.d.ts +2 -0
  682. package/dist/src/builtin/modules/linear-algebra/helpers/corrleation.d.ts +8 -0
  683. package/dist/src/builtin/modules/linear-algebra/helpers/covariance.d.ts +4 -0
  684. package/dist/src/builtin/modules/linear-algebra/helpers/dot.d.ts +1 -0
  685. package/dist/src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.d.ts +7 -0
  686. package/dist/src/builtin/modules/linear-algebra/helpers/getUnit.d.ts +2 -0
  687. package/dist/src/builtin/modules/linear-algebra/helpers/isZeroVector.d.ts +1 -0
  688. package/dist/src/builtin/modules/linear-algebra/helpers/kendallTau.d.ts +10 -0
  689. package/dist/src/builtin/modules/linear-algebra/helpers/length.d.ts +1 -0
  690. package/dist/src/builtin/modules/linear-algebra/helpers/pearsonCorr.d.ts +1 -0
  691. package/dist/src/builtin/modules/linear-algebra/helpers/scale.d.ts +1 -0
  692. package/dist/src/builtin/modules/linear-algebra/helpers/solve.d.ts +8 -0
  693. package/dist/src/builtin/modules/linear-algebra/helpers/subtract.d.ts +1 -0
  694. package/dist/src/builtin/modules/linear-algebra/index.d.ts +4 -0
  695. package/dist/src/builtin/modules/math/index.d.ts +2 -0
  696. package/dist/src/builtin/modules/matrix/docs.d.ts +2 -0
  697. package/dist/src/builtin/modules/matrix/helpers/adjugate.d.ts +1 -0
  698. package/dist/src/builtin/modules/matrix/helpers/band.d.ts +9 -0
  699. package/dist/src/builtin/modules/matrix/helpers/cofactor.d.ts +1 -0
  700. package/dist/src/builtin/modules/matrix/helpers/determinant.d.ts +6 -0
  701. package/dist/src/builtin/modules/matrix/helpers/diagonal.d.ts +1 -0
  702. package/dist/src/builtin/modules/matrix/helpers/inverse.d.ts +6 -0
  703. package/dist/src/builtin/modules/matrix/helpers/isBanded.d.ts +11 -0
  704. package/dist/src/builtin/modules/matrix/helpers/isDiagonal.d.ts +10 -0
  705. package/dist/src/builtin/modules/matrix/helpers/isIdentity.d.ts +1 -0
  706. package/dist/src/builtin/modules/matrix/helpers/isOrthogonal.d.ts +1 -0
  707. package/dist/src/builtin/modules/matrix/helpers/isSquare.d.ts +1 -0
  708. package/dist/src/builtin/modules/matrix/helpers/isSymetric.d.ts +8 -0
  709. package/dist/src/builtin/modules/matrix/helpers/isTriangular.d.ts +13 -0
  710. package/dist/src/builtin/modules/matrix/helpers/matrixMultiply.d.ts +7 -0
  711. package/dist/src/builtin/modules/matrix/helpers/minor.d.ts +1 -0
  712. package/dist/src/builtin/modules/matrix/helpers/norm1.d.ts +1 -0
  713. package/dist/src/builtin/modules/matrix/helpers/trace.d.ts +8 -0
  714. package/dist/src/builtin/modules/matrix/index.d.ts +4 -0
  715. package/dist/src/builtin/modules/number-theory/binomialCefficient.d.ts +1 -0
  716. package/dist/src/builtin/modules/number-theory/combinations.d.ts +2 -0
  717. package/dist/src/builtin/modules/number-theory/derangements.d.ts +2 -0
  718. package/dist/src/builtin/modules/number-theory/divisors.d.ts +4 -0
  719. package/dist/src/builtin/modules/number-theory/docs.d.ts +2 -0
  720. package/dist/src/builtin/modules/number-theory/factorial.d.ts +3 -0
  721. package/dist/src/builtin/modules/number-theory/index.d.ts +4 -0
  722. package/dist/src/builtin/modules/number-theory/partitions.d.ts +2 -0
  723. package/dist/src/builtin/modules/number-theory/permutations.d.ts +2 -0
  724. package/dist/src/builtin/modules/number-theory/powerSet.d.ts +2 -0
  725. package/dist/src/builtin/modules/number-theory/primeFactors.d.ts +11 -0
  726. package/dist/src/builtin/modules/number-theory/sequences/abundant.d.ts +2 -0
  727. package/dist/src/builtin/modules/number-theory/sequences/arithmetic.d.ts +2 -0
  728. package/dist/src/builtin/modules/number-theory/sequences/bell.d.ts +1 -0
  729. package/dist/src/builtin/modules/number-theory/sequences/bernoulli.d.ts +2 -0
  730. package/dist/src/builtin/modules/number-theory/sequences/catalan.d.ts +1 -0
  731. package/dist/src/builtin/modules/number-theory/sequences/collatz.d.ts +2 -0
  732. package/dist/src/builtin/modules/number-theory/sequences/composite.d.ts +3 -0
  733. package/dist/src/builtin/modules/number-theory/sequences/deficient.d.ts +2 -0
  734. package/dist/src/builtin/modules/number-theory/sequences/factorial.d.ts +1 -0
  735. package/dist/src/builtin/modules/number-theory/sequences/fibonacci.d.ts +1 -0
  736. package/dist/src/builtin/modules/number-theory/sequences/geometric.d.ts +2 -0
  737. package/dist/src/builtin/modules/number-theory/sequences/golomb.d.ts +2 -0
  738. package/dist/src/builtin/modules/number-theory/sequences/happy.d.ts +2 -0
  739. package/dist/src/builtin/modules/number-theory/sequences/index.d.ts +27 -0
  740. package/dist/src/builtin/modules/number-theory/sequences/juggler.d.ts +2 -0
  741. package/dist/src/builtin/modules/number-theory/sequences/lookAndSay.d.ts +2 -0
  742. package/dist/src/builtin/modules/number-theory/sequences/lucas.d.ts +1 -0
  743. package/dist/src/builtin/modules/number-theory/sequences/lucky.d.ts +2 -0
  744. package/dist/src/builtin/modules/number-theory/sequences/mersenne.d.ts +1 -0
  745. package/dist/src/builtin/modules/number-theory/sequences/padovan.d.ts +2 -0
  746. package/dist/src/builtin/modules/number-theory/sequences/partition.d.ts +1 -0
  747. package/dist/src/builtin/modules/number-theory/sequences/pell.d.ts +1 -0
  748. package/dist/src/builtin/modules/number-theory/sequences/perfect.d.ts +1 -0
  749. package/dist/src/builtin/modules/number-theory/sequences/perfectCube.d.ts +2 -0
  750. package/dist/src/builtin/modules/number-theory/sequences/perfectPower.d.ts +10 -0
  751. package/dist/src/builtin/modules/number-theory/sequences/perfectSquare.d.ts +2 -0
  752. package/dist/src/builtin/modules/number-theory/sequences/poligonal.d.ts +2 -0
  753. package/dist/src/builtin/modules/number-theory/sequences/prime.d.ts +3 -0
  754. package/dist/src/builtin/modules/number-theory/sequences/recaman.d.ts +9 -0
  755. package/dist/src/builtin/modules/number-theory/sequences/sylvester.d.ts +1 -0
  756. package/dist/src/builtin/modules/number-theory/sequences/thueMorse.d.ts +2 -0
  757. package/dist/src/builtin/modules/number-theory/sequences/tribonacci.d.ts +1 -0
  758. package/dist/src/builtin/modules/random/docs.d.ts +2 -0
  759. package/dist/src/builtin/modules/random/index.d.ts +2 -0
  760. package/dist/src/builtin/modules/sequence/index.d.ts +2 -0
  761. package/dist/src/builtin/modules/string/index.d.ts +2 -0
  762. package/dist/src/builtin/modules/vector/bincount.d.ts +9 -0
  763. package/dist/src/builtin/modules/vector/calcMad.d.ts +1 -0
  764. package/dist/src/builtin/modules/vector/calcMean.d.ts +1 -0
  765. package/dist/src/builtin/modules/vector/calcMedad.d.ts +1 -0
  766. package/dist/src/builtin/modules/vector/calcMedian.d.ts +1 -0
  767. package/dist/src/builtin/modules/vector/calcStdDev.d.ts +2 -0
  768. package/dist/src/builtin/modules/vector/calcVariance.d.ts +2 -0
  769. package/dist/src/builtin/modules/vector/docs.d.ts +2 -0
  770. package/dist/src/builtin/modules/vector/entropy.d.ts +8 -0
  771. package/dist/src/builtin/modules/vector/histogram.d.ts +9 -0
  772. package/dist/src/builtin/modules/vector/index.d.ts +2 -0
  773. package/dist/src/builtin/modules/vector/mode.d.ts +6 -0
  774. package/dist/src/builtin/modules/vector/outliers.d.ts +7 -0
  775. package/dist/src/builtin/modules/vector/percentile.d.ts +7 -0
  776. package/dist/src/builtin/modules/vector/quartiles.d.ts +1 -0
  777. package/dist/src/builtin/modules/vector/reductionFunctions/entropy.d.ts +2 -0
  778. package/dist/src/builtin/modules/vector/reductionFunctions/giniCoefficient.d.ts +2 -0
  779. package/dist/src/builtin/modules/vector/reductionFunctions/index.d.ts +13 -0
  780. package/dist/src/builtin/modules/vector/reductionFunctions/iqr.d.ts +2 -0
  781. package/dist/src/builtin/modules/vector/reductionFunctions/kurtosis.d.ts +5 -0
  782. package/dist/src/builtin/modules/vector/reductionFunctions/mad.d.ts +2 -0
  783. package/dist/src/builtin/modules/vector/reductionFunctions/mean.d.ts +4 -0
  784. package/dist/src/builtin/modules/vector/reductionFunctions/medad.d.ts +2 -0
  785. package/dist/src/builtin/modules/vector/reductionFunctions/median.d.ts +2 -0
  786. package/dist/src/builtin/modules/vector/reductionFunctions/prod.d.ts +2 -0
  787. package/dist/src/builtin/modules/vector/reductionFunctions/rms.d.ts +2 -0
  788. package/dist/src/builtin/modules/vector/reductionFunctions/skewness.d.ts +3 -0
  789. package/dist/src/builtin/modules/vector/reductionFunctions/span.d.ts +2 -0
  790. package/dist/src/builtin/modules/vector/reductionFunctions/standardDeviation.d.ts +3 -0
  791. package/dist/src/builtin/modules/vector/reductionFunctions/sum.d.ts +2 -0
  792. package/dist/src/builtin/modules/vector/reductionFunctions/variance.d.ts +3 -0
  793. package/dist/src/builtin/normalExpressions/index.d.ts +8 -0
  794. package/dist/src/builtin/specialExpressionTypes.d.ts +26 -0
  795. package/dist/src/builtin/specialExpressions/and.d.ts +6 -0
  796. package/dist/src/builtin/specialExpressions/array.d.ts +6 -0
  797. package/dist/src/builtin/specialExpressions/block.d.ts +6 -0
  798. package/dist/src/builtin/specialExpressions/cond.d.ts +6 -0
  799. package/dist/src/builtin/specialExpressions/defined.d.ts +5 -0
  800. package/dist/src/builtin/specialExpressions/effect.d.ts +5 -0
  801. package/dist/src/builtin/specialExpressions/functions.d.ts +6 -0
  802. package/dist/src/builtin/specialExpressions/if.d.ts +6 -0
  803. package/dist/src/builtin/specialExpressions/import.d.ts +6 -0
  804. package/dist/src/builtin/specialExpressions/let.d.ts +6 -0
  805. package/dist/src/builtin/specialExpressions/loop.d.ts +6 -0
  806. package/dist/src/builtin/specialExpressions/loops.d.ts +9 -0
  807. package/dist/src/builtin/specialExpressions/match.d.ts +7 -0
  808. package/dist/src/builtin/specialExpressions/object.d.ts +6 -0
  809. package/dist/src/builtin/specialExpressions/or.d.ts +6 -0
  810. package/dist/src/builtin/specialExpressions/parallel.d.ts +6 -0
  811. package/dist/src/builtin/specialExpressions/perform.d.ts +6 -0
  812. package/dist/src/builtin/specialExpressions/qq.d.ts +6 -0
  813. package/dist/src/builtin/specialExpressions/race.d.ts +6 -0
  814. package/dist/src/builtin/specialExpressions/recur.d.ts +5 -0
  815. package/dist/src/builtin/specialExpressions/throw.d.ts +5 -0
  816. package/dist/src/builtin/specialExpressions/try.d.ts +7 -0
  817. package/dist/src/builtin/specialExpressions/unless.d.ts +6 -0
  818. package/dist/src/builtin/utils.d.ts +6 -0
  819. package/dist/src/bundler/index.d.ts +9 -0
  820. package/dist/src/bundler/interface.d.ts +15 -0
  821. package/dist/src/bundler.d.ts +3 -0
  822. package/dist/src/constants/constants.d.ts +19 -0
  823. package/dist/src/debug.d.ts +115 -0
  824. package/dist/src/effects.d.ts +106 -0
  825. package/dist/src/errors.d.ts +24 -0
  826. package/dist/src/evaluator/ContextStack.d.ts +65 -0
  827. package/dist/src/evaluator/effectRef.d.ts +27 -0
  828. package/dist/src/evaluator/effectTypes.d.ts +79 -0
  829. package/dist/src/evaluator/frames.d.ts +525 -0
  830. package/dist/src/evaluator/interface.d.ts +14 -0
  831. package/dist/src/evaluator/serialization.d.ts +45 -0
  832. package/dist/src/evaluator/standardEffects.d.ts +35 -0
  833. package/dist/src/evaluator/step.d.ts +159 -0
  834. package/dist/src/evaluator/suspension.d.ts +53 -0
  835. package/dist/src/evaluator/trampoline.d.ts +119 -0
  836. package/dist/src/full.d.ts +17 -0
  837. package/dist/src/getUndefinedSymbols/index.d.ts +7 -0
  838. package/dist/src/index.d.ts +18 -0
  839. package/dist/src/initReferenceData.d.ts +1 -0
  840. package/dist/src/interface.d.ts +7 -0
  841. package/dist/src/modules/assertion.d.ts +2 -0
  842. package/dist/src/modules/bitwise.d.ts +2 -0
  843. package/dist/src/modules/collection.d.ts +2 -0
  844. package/dist/src/modules/convert.d.ts +2 -0
  845. package/dist/src/modules/functional.d.ts +2 -0
  846. package/dist/src/modules/grid.d.ts +2 -0
  847. package/dist/src/modules/linear-algebra.d.ts +2 -0
  848. package/dist/src/modules/math.d.ts +2 -0
  849. package/dist/src/modules/matrix.d.ts +2 -0
  850. package/dist/src/modules/number-theory.d.ts +2 -0
  851. package/dist/src/modules/random.d.ts +2 -0
  852. package/dist/src/modules/sequence.d.ts +2 -0
  853. package/dist/src/modules/string.d.ts +2 -0
  854. package/dist/src/modules/vector.d.ts +2 -0
  855. package/dist/src/parser/ParserContext.d.ts +20 -0
  856. package/dist/src/parser/getPrecedence.d.ts +3 -0
  857. package/dist/src/parser/helpers.d.ts +19 -0
  858. package/dist/src/parser/index.d.ts +5 -0
  859. package/dist/src/parser/subParsers/parseArray.d.ts +3 -0
  860. package/dist/src/parser/subParsers/parseBindingTarget.d.ts +8 -0
  861. package/dist/src/parser/subParsers/parseCond.d.ts +4 -0
  862. package/dist/src/parser/subParsers/parseDo.d.ts +3 -0
  863. package/dist/src/parser/subParsers/parseExpression.d.ts +5 -0
  864. package/dist/src/parser/subParsers/parseForOrDoseq.d.ts +4 -0
  865. package/dist/src/parser/subParsers/parseFunction.d.ts +4 -0
  866. package/dist/src/parser/subParsers/parseFunctionCall.d.ts +3 -0
  867. package/dist/src/parser/subParsers/parseIfOrUnless.d.ts +5 -0
  868. package/dist/src/parser/subParsers/parseImplicitBlock.d.ts +5 -0
  869. package/dist/src/parser/subParsers/parseLet.d.ts +4 -0
  870. package/dist/src/parser/subParsers/parseLoop.d.ts +4 -0
  871. package/dist/src/parser/subParsers/parseMatch.d.ts +4 -0
  872. package/dist/src/parser/subParsers/parseNumber.d.ts +3 -0
  873. package/dist/src/parser/subParsers/parseObject.d.ts +3 -0
  874. package/dist/src/parser/subParsers/parseOperand.d.ts +3 -0
  875. package/dist/src/parser/subParsers/parseRegexpShorthand.d.ts +3 -0
  876. package/dist/src/parser/subParsers/parseReservedSymbol.d.ts +3 -0
  877. package/dist/src/parser/subParsers/parseString.d.ts +4 -0
  878. package/dist/src/parser/subParsers/parseSymbol.d.ts +3 -0
  879. package/dist/src/parser/subParsers/parseTry.d.ts +4 -0
  880. package/dist/src/parser/types.d.ts +129 -0
  881. package/dist/src/symbolPatterns.d.ts +2 -0
  882. package/dist/src/testFramework/index.d.ts +15 -0
  883. package/dist/src/tokenizer/minifyTokenStream.d.ts +4 -0
  884. package/dist/src/tokenizer/operators.d.ts +12 -0
  885. package/dist/src/tokenizer/reservedNames.d.ts +66 -0
  886. package/dist/src/tokenizer/token.d.ts +84 -0
  887. package/dist/src/tokenizer/tokenize.d.ts +8 -0
  888. package/dist/src/tokenizer/tokenizers.d.ts +14 -0
  889. package/dist/src/transformer/index.d.ts +2 -0
  890. package/dist/src/typeGuards/annotatedArrays.d.ts +16 -0
  891. package/dist/src/typeGuards/array.d.ts +9 -0
  892. package/dist/src/typeGuards/astNode.d.ts +19 -0
  893. package/dist/src/typeGuards/dvala.d.ts +26 -0
  894. package/dist/src/typeGuards/dvalaFunction.d.ts +12 -0
  895. package/dist/src/typeGuards/index.d.ts +7 -0
  896. package/dist/src/typeGuards/number.d.ts +66 -0
  897. package/dist/src/typeGuards/string.d.ts +15 -0
  898. package/dist/src/untokenizer/index.d.ts +2 -0
  899. package/dist/src/utils/arity.d.ts +10 -0
  900. package/dist/src/utils/debug/debugTools.d.ts +1 -0
  901. package/dist/src/utils/debug/getCodeMarker.d.ts +2 -0
  902. package/dist/src/utils/debug/getSourceCodeInfo.d.ts +2 -0
  903. package/dist/src/utils/docString/generateDocString.d.ts +2 -0
  904. package/dist/src/utils/getAssertionError.d.ts +3 -0
  905. package/dist/src/utils/index.d.ts +14 -0
  906. package/dist/src/utils/maybePromise.d.ts +54 -0
  907. package/dist/src/utils/symbols.d.ts +3 -0
  908. package/dist/testFramework.esm.js +2 -0
  909. package/dist/testFramework.esm.js.map +1 -0
  910. package/dist/testFramework.js +2 -0
  911. package/dist/testFramework.js.map +1 -0
  912. package/package.json +144 -16
  913. package/dist/index.d.ts +0 -2
  914. package/dist/index.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.js","sources":["../../src/utils/debug/getCodeMarker.ts","../../src/errors.ts","../../src/constants/constants.ts","../../src/typeGuards/number.ts","../../src/typeGuards/annotatedArrays.ts","../../src/utils/arity.ts","../../src/builtin/modules/math/index.ts"],"sourcesContent":["import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string {\n if (!sourceCodeInfo.position || !sourceCodeInfo.code)\n return ''\n\n const leftPadding = sourceCodeInfo.position.column - 1\n const rightPadding = sourceCodeInfo.code.length - leftPadding - 1\n return `${' '.repeat(Math.max(leftPadding, 0))}^${' '.repeat(Math.max(rightPadding, 0))}`\n}\n","import { getCodeMarker } from '../src/utils/debug/getCodeMarker'\nimport type { Arr } from './interface'\nimport type { SourceCodeInfo } from './tokenizer/token'\n\nfunction getDvalaErrorMessage(message: string, sourceCodeInfo?: SourceCodeInfo) {\n if (!sourceCodeInfo) {\n return message\n }\n const location = `${sourceCodeInfo.position.line}:${sourceCodeInfo.position.column}`\n const filePathLine = sourceCodeInfo.filePath\n ? `\\n${sourceCodeInfo.filePath}:${location}`\n : `\\nLocation ${location}`\n const codeLine = `\\n${sourceCodeInfo.code}`\n const codeMarker = `\\n${getCodeMarker(sourceCodeInfo)}`\n return `${message}${filePathLine}${codeLine}${codeMarker}`\n}\n\nexport class RecurSignal extends Error {\n public params: Arr\n constructor(params: Arr) {\n super(`recur, params: ${params}`)\n Object.setPrototypeOf(this, RecurSignal.prototype)\n this.name = 'RecurSignal'\n this.params = params\n }\n}\n\nexport class DvalaError extends Error {\n public readonly sourceCodeInfo?: SourceCodeInfo\n public readonly shortMessage: string\n constructor(err: unknown, sourceCodeInfo: SourceCodeInfo | undefined) {\n const message = err instanceof Error\n ? err.message\n : `${err}`\n\n super(getDvalaErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, DvalaError.prototype)\n this.name = 'DvalaError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends DvalaError {\n public userMessage: string\n constructor(message: string, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n this.userMessage = message\n Object.setPrototypeOf(this, UserDefinedError.prototype)\n this.name = 'UserDefinedError'\n }\n}\n\nexport class AssertionError extends DvalaError {\n constructor(message: string | Error, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n Object.setPrototypeOf(this, AssertionError.prototype)\n this.name = 'AssertionError'\n }\n}\n\nexport class UndefinedSymbolError extends DvalaError {\n public symbol: string\n constructor(symbolName: string, sourceCodeInfo?: SourceCodeInfo) {\n const message = `Undefined symbol '${symbolName}'.`\n super(message, sourceCodeInfo)\n this.symbol = symbolName\n Object.setPrototypeOf(this, UndefinedSymbolError.prototype)\n this.name = 'UndefinedSymbolError'\n }\n}\n\nexport function isDvalaError(error: unknown): error is DvalaError {\n return error instanceof DvalaError\n}\n","export const NodeTypes = {\n Number: 1,\n String: 2,\n NormalExpression: 3,\n SpecialExpression: 4,\n UserDefinedSymbol: 5,\n NormalBuiltinSymbol: 6,\n SpecialBuiltinSymbol: 7,\n ReservedSymbol: 8,\n Binding: 9,\n Spread: 10,\n} as const\n\nconst NodeTypesSet = new Set(Object.values(NodeTypes))\n\nexport type NodeType = typeof NodeTypes[keyof typeof NodeTypes]\n\nexport function getNodeTypeName(type: NodeType): keyof typeof NodeTypes {\n return Object.keys(NodeTypes).find(key => NodeTypes[key as keyof typeof NodeTypes] === type) as keyof typeof NodeTypes\n}\n\n// TODO, is this needed?\nexport function isNodeType(type: unknown): type is NodeType {\n return typeof type === 'number' && NodeTypesSet.has(type as NodeType)\n}\n\nconst functionTypes = [\n 'UserDefined',\n 'Partial',\n 'Comp',\n 'Constantly',\n 'Juxt',\n 'Complement',\n 'EveryPred',\n 'SomePred',\n 'Fnull',\n 'Builtin',\n 'SpecialBuiltin',\n 'NativeJsFunction',\n 'Module',\n] as const\n\nconst functionTypeSet = new Set(functionTypes)\n\nexport type FunctionType = typeof functionTypes[number]\n\nexport function isFunctionType(type: unknown): type is FunctionType {\n return typeof type === 'string' && functionTypeSet.has(type as FunctionType)\n}\n","import { DvalaError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new DvalaError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import { DvalaError } from '../errors'\nimport type { Any } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isNumber } from './number'\n\nconst annotatedArrays = new WeakSet<unknown[]>()\nconst vectors = new WeakSet<unknown[]>()\nconst notVectors = new WeakSet<unknown[]>()\nconst matrices = new WeakSet<unknown[]>()\nconst notMatrices = new WeakSet<unknown[]>()\nconst grids = new WeakSet<unknown[]>()\nconst notGrids = new WeakSet<unknown[]>()\n\nexport function annotate<T>(value: T): T {\n if (!Array.isArray(value)) {\n return value\n }\n if (annotatedArrays.has(value)) {\n return value\n }\n isVector(value)\n if (!isMatrix(value)) {\n isGrid(value)\n }\n\n return value\n}\nexport function isVector(vector: unknown): vector is number[] {\n if (!Array.isArray(vector)) {\n return false\n }\n\n if (vectors.has(vector)) {\n return true\n }\n if (notVectors.has(vector)) {\n return false\n }\n\n if (vector.every(elem => isNumber(elem))) {\n annotatedArrays.add(vector)\n vectors.add(vector)\n return true\n }\n notVectors.add(vector)\n return false\n}\n\nexport function assertVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n if (!isVector(vector)) {\n throw new DvalaError(`Expected a vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is2dVector(vector: unknown): vector is [number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 2\n}\nexport function assert2dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number] {\n if (!is2dVector(vector)) {\n throw new DvalaError(`Expected a 2d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is3dVector(vector: unknown): vector is [number, number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 3\n}\nexport function assert3dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number, number] {\n if (!is3dVector(vector)) {\n throw new DvalaError(`Expected a 3d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function assertNonEmptyVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n assertVector(vector, sourceCodeInfo)\n if (vector.length === 0) {\n throw new DvalaError(`Expected a non empty vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function isGrid(grid: unknown): grid is unknown[][] {\n if (!Array.isArray(grid)) {\n return false\n }\n if (grids.has(grid)) {\n return true\n }\n if (notGrids.has(grid)) {\n return false\n }\n if (grid.length === 0) {\n notGrids.add(grid)\n return false\n }\n if (!Array.isArray(grid[0])) {\n notGrids.add(grid)\n return false\n }\n const nbrOfCols = grid[0].length\n for (const row of grid.slice(1)) {\n if (!Array.isArray(row)) {\n notGrids.add(grid)\n return false\n }\n if (row.length !== nbrOfCols) {\n notGrids.add(grid)\n return false\n }\n }\n annotatedArrays.add(grid)\n grids.add(grid)\n return true\n}\n\nexport function assertGrid(grid: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts grid is Any[][] {\n if (!isGrid(grid)) {\n throw new DvalaError(`Expected a grid, but got ${grid}`, sourceCodeInfo)\n }\n}\n\nexport function isMatrix(matrix: unknown): matrix is number[][] {\n if (!Array.isArray(matrix)) {\n return false\n }\n if (matrices.has(matrix)) {\n return true\n }\n if (notMatrices.has(matrix)) {\n return false\n }\n if (matrix.length === 0) {\n notMatrices.add(matrix)\n return false\n }\n if (!Array.isArray(matrix[0]) || matrix[0].length === 0) {\n notMatrices.add(matrix)\n return false\n }\n const nbrOfCols = matrix[0].length\n for (const row of matrix) {\n if (!Array.isArray(row) || row.length !== nbrOfCols || row.some(cell => !isNumber(cell))) {\n notMatrices.add(matrix)\n return false\n }\n }\n annotatedArrays.add(matrix)\n grids.add(matrix)\n matrices.add(matrix)\n return true\n}\n\nexport function assertMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new DvalaError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n}\n\nexport function assertSquareMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new DvalaError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n if (matrix.length !== matrix[0]!.length) {\n throw new DvalaError(`Expected square matrix, but got ${matrix.length} and ${matrix[0]!.length}`, sourceCodeInfo)\n }\n}\n\nexport function isSquareMatrix(matrix: unknown): matrix is number[][] {\n if (!isMatrix(matrix)) {\n return false\n }\n if (matrix.length !== matrix[0]!.length) {\n return false\n }\n return true\n}\n","import type { Arity } from '../builtin/interface'\nimport { DvalaError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/dvala'\nimport { valueToString } from './debug/debugTools'\n\nexport function arityAccepts(arity: Arity, nbrOfParams: number): boolean {\n const { min, max } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n if (typeof max === 'number' && nbrOfParams > max) {\n return false\n }\n return true\n}\n\nexport function arityAcceptsMin(arity: Arity, nbrOfParams: number): boolean {\n const { min } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n return true\n}\n\nexport function getCommonArityFromFunctions(params: FunctionLike[]): Arity | null {\n return params.reduce((acc: Arity | null, param): Arity | null => {\n if (acc === null) {\n return null\n }\n const arity: Arity = (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n const { min: aMin, max: aMax } = arity\n const { min: bMin, max: bMax } = acc\n const min = typeof aMin === 'number' && typeof bMin === 'number'\n ? Math.max(aMin, bMin)\n : typeof aMin === 'number' ? aMin : typeof bMin === 'number' ? bMin : undefined\n const max = typeof aMax === 'number' && typeof bMax === 'number'\n ? Math.min(aMax, bMax)\n : typeof aMax === 'number' ? aMax : typeof bMax === 'number' ? bMax : undefined\n\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n return null\n }\n\n return { min, max }\n }, {})\n}\n\nexport function getArityFromFunction(param: FunctionLike): Arity {\n return (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n}\n\nexport function assertNumberOfParams(arity: Arity, length: number, sourceCodeInfo: SourceCodeInfo | undefined): void {\n const { min, max } = arity\n if (typeof min === 'number' && length < min) {\n throw new DvalaError(\n `Wrong number of arguments, expected at least ${min}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n\n if (typeof max === 'number' && length > max) {\n throw new DvalaError(\n `Wrong number of arguments, expected at most ${max}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n}\n\nexport function canBeOperator(count: Arity): boolean {\n if (typeof count.max === 'number' && count.max < 2) {\n return false\n }\n\n if (typeof count.min === 'number' && count.min > 2) {\n return false\n }\n\n return true\n}\n\nexport function toFixedArity(arity: number): Arity {\n return { min: arity, max: arity }\n}\n","import type { SourceCodeInfo } from '../../../tokenizer/token'\nimport { isMatrix, isVector } from '../../../typeGuards/annotatedArrays'\nimport { isNumber } from '../../../typeGuards/number'\nimport { toFixedArity } from '../../../utils/arity'\nimport { DvalaError } from '../../../errors'\nimport type { BuiltinNormalExpressions } from '../../interface'\nimport type { DvalaModule } from '../interface'\n\ntype NumberVectorOrMatrix = number | number[] | number[][]\n\nfunction getNumberVectorOrMatrixOperation(\n param: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n):\n | ['number', number]\n | ['vector', number[]]\n | ['matrix', number[][]] {\n if (isVector(param)) {\n return ['vector', param]\n }\n if (isMatrix(param)) {\n return ['matrix', param]\n }\n if (!isNumber(param)) {\n throw new DvalaError(`Invalid parameter type: ${typeof param}`, sourceCodeInfo)\n }\n return ['number', param]\n}\n\nfunction unaryMathOp(\n fn: (val: number) => number,\n): (params: unknown[], sourceCodeInfo: SourceCodeInfo | undefined) => NumberVectorOrMatrix {\n return ([param], sourceCodeInfo) => {\n const [operation, operand] = getNumberVectorOrMatrixOperation(param, sourceCodeInfo)\n if (operation === 'number') {\n return fn(operand)\n }\n else if (operation === 'vector') {\n return operand.map(val => fn(val))\n }\n else {\n return operand.map(row => row.map(val => fn(val)))\n }\n }\n}\n\nconst mathUtilsFunctions: BuiltinNormalExpressions = {\n 'sin': {\n evaluate: unaryMathOp(val => Math.sin(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sin` function computes the sine of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the sine of each element while preserving the original structure.',\n seeAlso: ['math.asin', 'math.sinh', 'math.cos', 'math.tan', 'math.to-rad'],\n examples: [\n `let { sin } = import(math);\nsin(0)`,\n `let { sin } = import(math);\nsin(1)`,\n `let { sin } = import(math);\nsin(PI)`,\n `let { sin } = import(math);\nsin(-0.5)`,\n `let { sin } = import(math);\nsin([1, 2, 3])`,\n `let { sin } = import(math);\nsin([[1, 2], [3, 4]])`,\n ],\n },\n },\n 'asin': {\n evaluate: unaryMathOp(val => Math.asin(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `asin` function computes the arcsine (inverse sine) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arcsine of each element while preserving the original structure.',\n seeAlso: ['math.sin', 'math.asinh', 'math.acos', 'math.atan'],\n examples: [\n `let { asin } = import(math);\nasin(0)`,\n `let { asin } = import(math);\nasin(1)`,\n `let { asin } = import(math);\nasin(-0.5)`,\n `let { asin } = import(math);\nasin([1, 2, 3])`,\n `let { asin } = import(math);\nasin([[1, 2], [3, 4]])`,\n ],\n },\n },\n 'sinh': {\n evaluate: unaryMathOp(val => Math.sinh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `sinh` function computes the hyperbolic sine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic sine of each element while preserving the original structure.',\n seeAlso: ['math.asinh', 'math.sin', 'math.cosh', 'math.tanh'],\n examples: [\n `let { sinh } = import(math);\nsinh(0)`,\n `let { sinh } = import(math);\nsinh(1)`,\n `let { sinh } = import(math);\nsinh(-0.5)`,\n `let { sinh } = import(math);\nsinh([0.1, 0.2, 0.3])`,\n `let { sinh } = import(math);\nsinh([[0.1, 0.2], [0.3, 0.4]])`,\n ],\n },\n },\n 'asinh': {\n evaluate: unaryMathOp(val => Math.asinh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `asinh` function computes the inverse hyperbolic sine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic sine of each element while preserving the original structure.',\n seeAlso: ['math.sinh', 'math.asin', 'math.acosh', 'math.atanh'],\n examples: [\n `let { asinh } = import(math);\nasinh(10)`,\n `let { asinh } = import(math);\nasinh(90)`,\n `let { asinh } = import(math);\nasinh(50)`,\n `let { asinh } = import(math);\nasinh([10, 20, 30])`,\n `let { asinh } = import(math);\nasinh([[10, 20], [30, 40]])`,\n ],\n },\n },\n 'cos': {\n evaluate: unaryMathOp(val => Math.cos(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `cos` function computes the cosine of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the cosine of each element while preserving the original structure.',\n seeAlso: ['math.acos', 'math.cosh', 'math.sin', 'math.tan', 'math.to-rad'],\n examples: [\n `let { cos } = import(math);\ncos(0)`,\n `let { cos } = import(math);\ncos(1)`,\n `let { cos } = import(math);\ncos(PI)`,\n `let { cos } = import(math);\ncos(-0.5)`,\n `let { cos } = import(math);\ncos([1, 2, 3])`,\n `let { cos } = import(math);\ncos([[1, 2], [3, 4]])`,\n ],\n },\n },\n 'acos': {\n evaluate: unaryMathOp(val => Math.acos(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `acos` function computes the arccosine (inverse cosine) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arccosine of each element while preserving the original structure.',\n seeAlso: ['math.cos', 'math.acosh', 'math.asin', 'math.atan'],\n examples: [\n `let { acos } = import(math);\nacos(0)`,\n `let { acos } = import(math);\nacos(1)`,\n `let { acos } = import(math);\nacos(-0.5)`,\n `let { acos } = import(math);\nacos([0.1, 0.2, 0.3])`,\n `let { acos } = import(math);\nacos([[0.1, 0.2], [0.3, 0.4]])`,\n ],\n },\n },\n 'cosh': {\n evaluate: unaryMathOp(val => Math.cosh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `cosh` function computes the hyperbolic cosine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic cosine of each element while preserving the original structure.',\n seeAlso: ['math.acosh', 'math.cos', 'math.sinh', 'math.tanh'],\n examples: [\n `let { cosh } = import(math);\ncosh(0)`,\n `let { cosh } = import(math);\ncosh(1)`,\n `let { cosh } = import(math);\ncosh(-0.5)`,\n `let { cosh } = import(math);\ncosh([0.1, 0.2, 0.3])`,\n `let { cosh } = import(math);\ncosh([[0.1, 0.2], [0.3, 0.4]])`,\n ],\n },\n },\n 'acosh': {\n evaluate: unaryMathOp(val => Math.acosh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `acosh` function computes the inverse hyperbolic cosine of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic cosine of each element while preserving the original structure.',\n seeAlso: ['math.cosh', 'math.acos', 'math.asinh', 'math.atanh'],\n examples: [\n `let { acosh } = import(math);\nacosh(1)`,\n `let { acosh } = import(math);\nacosh(2)`,\n `let { acosh } = import(math);\nacosh(100)`,\n `let { acosh } = import(math);\nacosh(50)`,\n `let { acosh } = import(math);\nacosh([1, 2, 3])`,\n `let { acosh } = import(math);\nacosh([[1, 2], [3, 4]])`,\n ],\n },\n },\n 'tan': {\n evaluate: unaryMathOp(val => Math.tan(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `tan` function computes the tangent of an angle (in radians), working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the tangent of each element while preserving the original structure.',\n seeAlso: ['math.atan', 'math.tanh', 'math.sin', 'math.cos', 'math.to-rad'],\n examples: [\n `let { tan } = import(math);\ntan(0)`,\n `let { tan } = import(math);\ntan(1)`,\n `let { tan } = import(math);\ntan(PI)`,\n `let { tan } = import(math);\ntan(-0.5)`,\n `let { tan } = import(math);\ntan([1, 2, 3])`,\n `let { tan } = import(math);\ntan([[1, 2], [3, 4]])`,\n ],\n },\n },\n 'atan': {\n evaluate: unaryMathOp(val => Math.atan(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `atan` function computes the arctangent (inverse tangent) of a `number` in radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the arctangent of each element while preserving the original structure.',\n seeAlso: ['math.tan', 'math.atanh', 'math.asin', 'math.acos'],\n examples: [\n `let { atan } = import(math);\natan(0)`,\n `let { atan } = import(math);\natan(1)`,\n `let { atan } = import(math);\natan(-0.5)`,\n `let { atan } = import(math);\natan([0.1, 0.2, 0.3])`,\n `let { atan } = import(math);\natan([[0.1, 0.2], [0.3, 0.4]])`,\n ],\n },\n },\n 'tanh': {\n evaluate: unaryMathOp(val => Math.tanh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `tanh` function computes the hyperbolic tangent of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the hyperbolic tangent of each element while preserving the original structure.',\n seeAlso: ['math.atanh', 'math.tan', 'math.sinh', 'math.cosh'],\n examples: [\n `let { tanh } = import(math);\ntanh(0)`,\n `let { tanh } = import(math);\ntanh(1)`,\n `let { tanh } = import(math);\ntanh(-0.5)`,\n `let { tanh } = import(math);\ntanh(50)`,\n ],\n },\n },\n 'atanh': {\n evaluate: unaryMathOp(val => Math.atanh(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `atanh` function computes the inverse hyperbolic tangent of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the inverse hyperbolic tangent of each element while preserving the original structure.',\n seeAlso: ['math.tanh', 'math.atan', 'math.asinh', 'math.acosh'],\n examples: [\n `let { atanh } = import(math);\natanh(0)`,\n `let { atanh } = import(math);\natanh(0.9)`,\n `let { atanh } = import(math);\natanh(-0.5)`,\n `let { atanh } = import(math);\natanh([0.1, 0.2, 0.3])`,\n `let { atanh } = import(math);\natanh([[0.1, 0.2], [0.3, 0.4]])`,\n ],\n },\n },\n 'ln': {\n evaluate: unaryMathOp(val => Math.log(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `ln` function computes the natural logarithm (base `e`) of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the natural logarithm of each element while preserving the original structure.',\n seeAlso: ['math.log2', 'math.log10', '^'],\n examples: [\n `let { ln } = import(math);\nln(0.01)`,\n `let { ln } = import(math);\nln(2.5)`,\n `let { ln } = import(math);\nln(E)`,\n `let { ln } = import(math);\nln([1, 2, 3])`,\n `let { ln } = import(math);\nln([[1, 2], [3, 4]])`,\n ],\n },\n },\n 'log2': {\n evaluate: unaryMathOp(val => Math.log2(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `log2` function computes the base `2` logarithm of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the base-2 logarithm of each element while preserving the original structure.',\n seeAlso: ['math.ln', 'math.log10'],\n examples: [\n `let { log2 } = import(math);\nlog2(0.01)`,\n `let { log2 } = import(math);\nlog2(2 ^ 12)`,\n `let { log2 } = import(math);\nlog2(2.5)`,\n `let { log2 } = import(math);\nlog2([1, 2, 3])`,\n `let { log2 } = import(math);\nlog2([[1, 2], [3, 4]])`,\n ],\n },\n },\n 'log10': {\n evaluate: unaryMathOp(val => Math.log10(val)),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `log10` function computes the base `10` logarithm of a `number`, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it returns the base-10 logarithm of each element while preserving the original structure.',\n seeAlso: ['math.ln', 'math.log2'],\n examples: [\n `let { log10 } = import(math);\nlog10(0.01)`,\n `let { log10 } = import(math);\nlog10(10 ^ 12)`,\n `let { log10 } = import(math);\nlog10(2.5)`,\n `let { log10 } = import(math);\nlog10([1, 2, 3])`,\n `let { log10 } = import(math);\nlog10([[1, 2], [3, 4]])`,\n ],\n },\n },\n 'to-rad': {\n evaluate: unaryMathOp(val => (val * Math.PI) / 180),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `to-rad` function converts an angle from degrees to radians, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it converts each element while preserving the original structure.',\n seeAlso: ['math.to-deg', 'math.sin', 'math.cos', 'math.tan'],\n examples: [\n `let { to-rad } = import(math);\nto-rad(0)`,\n `let { to-rad } = import(math);\nto-rad(90)`,\n `let { to-rad } = import(math);\nto-rad(180)`,\n `let { to-rad } = import(math);\nto-rad(360)`,\n `let { to-rad } = import(math);\nto-rad([0, 90, 180])`,\n `let { to-rad } = import(math);\nto-rad([[0, 90], [180, 360]])`,\n ],\n },\n },\n 'to-deg': {\n evaluate: unaryMathOp(val => (val * 180) / Math.PI),\n arity: toFixedArity(1),\n docs: {\n category: 'math',\n returns: { type: ['number', 'vector', 'matrix'] },\n args: {\n x: { type: ['number', 'vector', 'matrix'] },\n },\n variants: [{ argumentNames: ['x'] }],\n description: 'The `to-deg` function converts an angle from radians to degrees, working on `numbers` and element-wise on `vectors` and `matrices`. When applied to collections, it converts each element while preserving the original structure.',\n seeAlso: ['math.to-rad'],\n examples: [\n `let { to-deg } = import(math);\nto-deg(0)`,\n `let { to-deg } = import(math);\nto-deg(PI)`,\n `let { to-deg } = import(math);\nto-deg(PI / 2)`,\n `let { to-deg } = import(math);\nto-deg(3 * PI / 2)`,\n `let { to-deg } = import(math);\nto-deg([0, PI, PI / 2])`,\n `let { to-deg } = import(math);\nto-deg([[0, PI], [PI / 2, 3 * PI / 2]])`,\n ],\n },\n },\n}\n\nexport const mathUtilsModule: DvalaModule = {\n name: 'math',\n functions: mathUtilsFunctions,\n}\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","DvalaError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getDvalaErrorMessage","this","Object","setPrototypeOf","prototype","name","Set","values","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","isNumber","value","options","isNaN","integer","isInteger","finite","isFinite","zero","nonZero","positive","negative","nonPositive","nonNegative","gt","gte","lt","lte","annotatedArrays","WeakSet","vectors","notVectors","matrices","notMatrices","grids","toFixedArity","arity","min","getNumberVectorOrMatrixOperation","param","vector","Array","isArray","has","every","elem","add","matrix","nbrOfCols","row","some","cell","isMatrix","unaryMathOp","fn","operation","operand","map","val","mathUtilsModule","functions","sin","evaluate","docs","category","returns","type","args","x","variants","argumentNames","description","seeAlso","examples","asin","sinh","asinh","cos","acos","cosh","acosh","tan","atan","tanh","atanh","ln","log","log2","log10","PI"],"mappings":"aAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAAeE,KAC9C,MAAO,GAET,MAAMC,EAAcH,EAAeC,SAASG,OAAS,EAC/CC,EAAeL,EAAeE,KAAKI,OAASH,EAAc,EAChE,MAAO,GAAG,IAAII,OAAOC,KAAKC,IAAIN,EAAa,OAAO,IAAII,OAAOC,KAAKC,IAAIJ,EAAc,KACtF,CCkBM,MAAOK,UAAmBC,MACdX,eACAY,aAChB,WAAAC,CAAYC,EAAcd,GACxB,MAAMe,EAAUD,aAAeH,MAC3BG,EAAIC,QACJ,GAAGD,IAEPE,MA/BJ,SAA8BD,EAAiBf,GAC7C,IAAKA,EACH,OAAOe,EAET,MAAME,EAAW,GAAGjB,EAAeC,SAASiB,QAAQlB,EAAeC,SAASG,SAM5E,MAAO,GAAGW,IALWf,EAAemB,SAChC,KAAKnB,EAAemB,YAAYF,IAChC,cAAcA,QACIjB,EAAeE,SACbH,EAAcC,IAExC,CAoBUoB,CAAqBL,EAASf,IACpCqB,KAAKT,aAAeG,EACpBM,KAAKrB,eAAiBA,EACtBsB,OAAOC,eAAeF,KAAMX,EAAWc,WACvCH,KAAKI,KAAO,YACb,CAEM,aAAA1B,GACL,OAAOsB,KAAKrB,gBAAkBD,EAAcsB,KAAKrB,eAClD,EC/BkB,IAAI0B,IAAIJ,OAAOK,OAbX,CACvBC,OAAQ,EACRC,OAAQ,EACRC,iBAAkB,EAClBC,kBAAmB,EACnBC,kBAAmB,EACnBC,oBAAqB,EACrBC,qBAAsB,EACtBC,eAAgB,EAChBC,QAAS,EACTC,OAAQ,eCoHMC,EAASC,EAAgBC,EAAyB,IAChE,MAAqB,iBAAVD,KAGPX,OAAOa,MAAMF,OAGbC,EAAQE,UAAYd,OAAOe,UAAUJ,QAGrCC,EAAQI,SAAWhB,OAAOiB,SAASN,QAGn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BC,YAAa,qOACbC,QAAS,CAAC,cAAe,WAAY,WAAY,YACjDC,SAAU,CACR,4CAEA,6CAEA,8CAEA,8CAEA,uDAEA,mEAKN,SAAU,CACRX,SAAUT,EAAYK,GAAc,IAANA,EAAa9E,KAAK6G,IAChDrD,MAAOD,EAAa,GACpB4B,KAAM,CACJC,SAAU,OACVC,QAAS,CAAEC,KAAM,CAAC,SAAU,SAAU,WACtCC,KAAM,CACJC,EAAG,CAAEF,KAAM,CAAC,SAAU,SAAU,YAElCG,SAAU,CAAC,CAAEC,cAAe,CAAC,OAC7BC,YAAa,qOACbC,QAAS,CAAC,eACVC,SAAU,CACR,4CAEA,6CAEA,iDAEA,qDAEA,0DAEA"}
@@ -0,0 +1,2 @@
1
+ function t(t){if(!t.position||!t.code)return"";const e=t.position.column-1,r=t.code.length-e-1;return`${" ".repeat(Math.max(e,0))}^${" ".repeat(Math.max(r,0))}`}class e extends Error{sourceCodeInfo;shortMessage;constructor(r,a){const n=r instanceof Error?r.message:`${r}`;super(function(e,r){if(!r)return e;const a=`${r.position.line}:${r.position.column}`;return`${e}${r.filePath?`\n${r.filePath}:${a}`:`\nLocation ${a}`}\n${r.code}\n${t(r)}`}(n,a)),this.shortMessage=n,this.sourceCodeInfo=a,Object.setPrototypeOf(this,e.prototype),this.name="DvalaError"}getCodeMarker(){return this.sourceCodeInfo&&t(this.sourceCodeInfo)}}const r={Number:1,String:2,NormalExpression:3,SpecialExpression:4,UserDefinedSymbol:5,NormalBuiltinSymbol:6,SpecialBuiltinSymbol:7,ReservedSymbol:8,Binding:9,Spread:10},a=new Set(Object.values(r));const n=new Set(["UserDefined","Partial","Comp","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","Builtin","SpecialBuiltin","NativeJsFunction","Module"]);function i(t){return null!==t&&"object"==typeof t&&("^^fn^^"in t&&"functionType"in t&&("string"==typeof(e=t.functionType)&&n.has(e)));var e}function o(t){return!(!Array.isArray(t)||t.length<2)&&("number"==typeof(e=t[0])&&a.has(e));var e}function m(t){return i(t)?`<function ${t.name||"λ"}>`:o(t)?`${e=t[0],Object.keys(r).find(t=>r[t]===e)}-node`:null===t?"null":"object"==typeof t&&t instanceof RegExp?`${t}`:"object"==typeof t&&t instanceof Error?t.toString():JSON.stringify(t);var e}function l(t,e={}){return"number"==typeof t&&(!Number.isNaN(t)&&(!(e.integer&&!Number.isInteger(t))&&(!(e.finite&&!Number.isFinite(t))&&((!e.zero||0===t)&&((!e.nonZero||0!==t)&&(!(e.positive&&t<=0)&&(!(e.negative&&t>=0)&&(!(e.nonPositive&&t>0)&&(!(e.nonNegative&&t<0)&&(!("number"==typeof e.gt&&t<=e.gt)&&(!("number"==typeof e.gte&&t<e.gte)&&(!("number"==typeof e.lt&&t>=e.lt)&&!("number"==typeof e.lte&&t>e.lte)))))))))))))}function s(t,r,a={}){if(!l(t,a))throw new e(`Expected ${function(t){if(t.zero)return"zero";const e=function(t){return t.positive?"positive":t.negative?"negative":t.nonNegative?"non negative":t.nonPositive?"non positive":t.nonZero?"non zero":""}(t),r=t.integer?"integer":"number",a=t.finite?"finite":"",n=function(t){return"number"!=typeof t.gt&&"number"!=typeof t.gte||"number"!=typeof t.lt&&"number"!=typeof t.lte?"number"==typeof t.gt||"number"==typeof t.gte?"number"==typeof t.gt?`n > ${t.gt}`:`n >= ${t.gte}`:"number"==typeof t.lt||"number"==typeof t.lte?"number"==typeof t.lt?`n < ${t.lt}`:`n <= ${t.lte}`:"":`${"number"==typeof t.gt?`${t.gt} < n `:`${t.gte} <= n `}${"number"==typeof t.lt?`< ${t.lt}`:`<= ${t.lte}`}`}(t);return[e,a,r,n].filter(t=>!!t).join(" ")}(a)}, got ${m(t)}.`,function(t,e){return t?.sourceCodeInfo??e}(t,r))}const u=new WeakSet,c=new WeakSet,x=new WeakSet,p=new WeakSet,f=new WeakSet,d=new WeakSet;function g(t,r){if(!function(t){return!(!Array.isArray(t)||!c.has(t)&&(x.has(t)||(t.every(t=>l(t))?(u.add(t),c.add(t),0):(x.add(t),1))))}(t))throw new e(`Expected a vector, but got ${t}`,r)}function h(t){if(!Array.isArray(t))return!1;if(p.has(t))return!0;if(f.has(t))return!1;if(0===t.length)return f.add(t),!1;if(!Array.isArray(t[0])||0===t[0].length)return f.add(t),!1;const e=t[0].length;for(const r of t)if(!Array.isArray(r)||r.length!==e||r.some(t=>!l(t)))return f.add(t),!1;return u.add(t),d.add(t),p.add(t),!0}function y(t,r){if(!h(t))throw new e(`Expected a matrix, but got ${t}`,r)}function b(t,r){if(!h(t))throw new e(`Expected a matrix, but got ${t}`,r);if(t.length!==t[0].length)throw new e(`Expected square matrix, but got ${t.length} and ${t[0].length}`,r)}function v(t,e,r=1e-10){if(t===e)return!0;const a=Math.abs(t-e);if(0===t||0===e||a<r)return a<r;return a/(Math.abs(t)+Math.abs(e))<r}function w(t){return Math.abs(t)<1e-10}function N(t){return{min:t,max:t}}const k={mul:{category:"matrix",description:"Multiplies two `matrices` using standard `matrix` multiplication based on **dot products** of rows and columns.",returns:{type:"matrix"},args:{a:{type:"matrix"},b:{type:"matrix"}},variants:[{argumentNames:["a","b"]}],examples:["let { mul } = import(matrix);\nmul([[1, 2], [3, 4]], [[5, 6], [7, 8]])","let { mul } = import(matrix);\nmul([[1, 2, 3], [4, 5, 6]], [[7, 8], [9, 10], [11, 12]])"],seeAlso:["matrix.det","matrix.inv"]},det:{category:"matrix",description:"Calculates the **determinant** of a square matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the determinant of."}},variants:[{argumentNames:["m"]}],examples:["let { det } = import(matrix);\ndet([[1, 2], [3, 4]])","let { det } = import(matrix);\ndet([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.inv","matrix.cofactor","matrix.adj","matrix.trace","matrix.rank","matrix.invertible?","matrix.mul","matrix.minor"]},inv:{category:"matrix",description:"Calculates the **inverse** of a square matrix.",returns:{type:"matrix"},args:{m:{type:"matrix",description:"The `matrix` to calculate the inverse of."}},variants:[{argumentNames:["m"]}],examples:["let { inv } = import(matrix);\ninv([[1, 2], [3, 4]])","let { inv } = import(matrix);\ninv([[1, 2, 3], [4, 5, 7], [7, 8, 10]])"],seeAlso:["matrix.det","matrix.adj","matrix.invertible?","linear-algebra.solve","matrix.mul","matrix.orthogonal-matrix?"]},adj:{category:"matrix",description:"Calculates the **adjugate** of a square matrix.",returns:{type:"matrix"},args:{m:{type:"matrix",description:"The `matrix` to calculate the adjugate of."}},variants:[{argumentNames:["m"]}],examples:["let { adj } = import(matrix);\nadj([[1, 2], [3, 4]])","let { adj } = import(matrix);\nadj([[1, 2, 3], [4, 5, 6], [7, 8, 9]])","let { adj } = import(matrix);\nadj([[1, 2, 3], [7, 8, 9], [4, 5, 6]])"],seeAlso:["matrix.cofactor","matrix.det","matrix.inv"]},cofactor:{category:"matrix",description:"Calculates the **cofactor** of a square matrix.",returns:{type:"matrix"},args:{m:{type:"matrix",description:"The `matrix` to calculate the cofactor of."}},variants:[{argumentNames:["m"]}],examples:["let { cofactor } = import(matrix);\ncofactor([[1, 2], [3, 4]])","let { cofactor } = import(matrix);\ncofactor([[1, 2, 3], [4, 5, 6], [7, 8, 9]])","let { cofactor } = import(matrix);\ncofactor([[1, 2, 3], [7, 8, 9], [4, 5, 6]])"],seeAlso:["matrix.adj","matrix.minor","matrix.det"]},minor:{category:"matrix",description:"Calculates the **minor** of a square matrix.",returns:{type:"matrix"},args:{m:{type:"matrix",description:"The `matrix` to calculate the minor of."},row:{type:"integer",description:"The row index of the element to calculate the minor for."},col:{type:"integer",description:"The column index of the element to calculate the minor for."}},variants:[{argumentNames:["m","row","col"]}],examples:["let { minor } = import(matrix);\nminor([[1, 2], [3, 4]], 0, 1)","let { minor } = import(matrix);\nminor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1)"],seeAlso:["matrix.cofactor","matrix.det"]},trace:{category:"matrix",description:"Calculates the **trace** of a square matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the trace of."}},variants:[{argumentNames:["m"]}],examples:["let { trace } = import(matrix);\ntrace([[1, 2], [3, 4]])","let { trace } = import(matrix);\ntrace([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.det","matrix.diagonal?"]},"symmetric?":{category:"matrix",description:"Checks if a `matrix` is **symmetric**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for symmetry."}},variants:[{argumentNames:["m"]}],examples:["let { symmetric? } = import(matrix);\nsymmetric?([[1, 2], [2, 1]])","let { symmetric? } = import(matrix);\nsymmetric?([[1, 2, 3], [2, 1, 4], [3, 4, 1]])"],seeAlso:["matrix.orthogonal-matrix?","matrix.diagonal?","matrix.square?","matrix.hilbert"]},"triangular?":{category:"matrix",description:"Checks if a `matrix` is **triangular**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for triangularity."}},variants:[{argumentNames:["m"]}],examples:["let { triangular? } = import(matrix);\ntriangular?([[2, 0], [0, 1]])","let { triangular? } = import(matrix);\ntriangular?([[1, 2, 3], [0, 4, 5], [0, 0, 6]])"],seeAlso:["matrix.upper-triangular?","matrix.lower-triangular?","matrix.diagonal?","matrix.banded?"]},"upper-triangular?":{category:"matrix",description:"Checks if a `matrix` is **upper triangular**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for upper triangularity."}},variants:[{argumentNames:["m"]}],examples:["let { upper-triangular? } = import(matrix);\nupper-triangular?([[1, 2], [0, 3]])","let { upper-triangular? } = import(matrix);\nupper-triangular?([[1, 2, 3], [0, 4, 5], [0, 0, 6]])"],seeAlso:["matrix.lower-triangular?","matrix.triangular?","matrix.diagonal?"]},"lower-triangular?":{category:"matrix",description:"Checks if a `matrix` is **lower triangular**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for lower triangularity."}},variants:[{argumentNames:["m"]}],examples:["let { lower-triangular? } = import(matrix);\nlower-triangular?([[1, 0], [2, 3]])","let { lower-triangular? } = import(matrix);\nlower-triangular?([[1, 0, 0], [2, 3, 0], [4, 5, 6]])"],seeAlso:["matrix.upper-triangular?","matrix.triangular?","matrix.diagonal?"]},"diagonal?":{category:"matrix",description:"Checks if a `matrix` is **diagonal**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for diagonal property."}},variants:[{argumentNames:["m"]}],examples:["let { diagonal? } = import(matrix);\ndiagonal?([[1, 0], [0, 2]])","let { diagonal? } = import(matrix);\ndiagonal?([[1, 0, 0], [0, 2, 0], [0, 0, 3]])","let { diagonal? } = import(matrix);\ndiagonal?([[1, 0, 0], [2, 2, 2], [0, 0, 3]])"],seeAlso:["matrix.identity?","matrix.symmetric?","matrix.triangular?","matrix.trace","matrix.upper-triangular?","matrix.lower-triangular?","matrix.band","matrix.banded?"]},"square?":{category:"matrix",description:"Checks if a `matrix` is **square**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for square property."}},variants:[{argumentNames:["m"]}],examples:["let { square? } = import(matrix);\nsquare?([[1, 2], [3, 4]])","let { square? } = import(matrix);\nsquare?([[1, 2, 3], [4, 5, 6], [7, 8, 9]])","let { square? } = import(matrix);\nsquare?([[1, 2, 3], [4, 5, 6]])"],seeAlso:["matrix.symmetric?","matrix.identity?","matrix.invertible?"]},"orthogonal-matrix?":{category:"matrix",description:"Checks if a `matrix` is **orthogonal**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for **orthogonality**."}},variants:[{argumentNames:["m"]}],examples:["let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 0], [0, 1]])","let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 0], [0, -1]])","let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 2], [3, 4]])"],seeAlso:["matrix.symmetric?","matrix.inv","matrix.identity?","linear-algebra.orthogonal?"]},"identity?":{category:"matrix",description:"Checks if a `matrix` is an **identity matrix**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for identity property."}},variants:[{argumentNames:["m"]}],examples:["let { identity? } = import(matrix);\nidentity?([[1, 0], [0, 1]])","let { identity? } = import(matrix);\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 1]])","let { identity? } = import(matrix);\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 0]])"],seeAlso:["matrix.diagonal?","matrix.square?","matrix.orthogonal-matrix?"]},"invertible?":{category:"matrix",description:"Checks if a `matrix` is **invertible**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for invertibility."}},variants:[{argumentNames:["m"]}],examples:["let { invertible? } = import(matrix);\ninvertible?([[1, 2], [3, 4]])","let { invertible? } = import(matrix);\ninvertible?([[1, 2, 3], [4, 5, 6], [7, 8, 9]])","let { invertible? } = import(matrix);\ninvertible?([[1, 2], [2, 4]])"],seeAlso:["matrix.det","matrix.inv","matrix.rank","matrix.square?"]},hilbert:{category:"matrix",description:"Generates a **Hilbert matrix** of size `n`.",returns:{type:"matrix"},args:{n:{type:"integer",description:"The size of the Hilbert matrix."}},variants:[{argumentNames:["n"]}],examples:["let { hilbert } = import(matrix);\nhilbert(3)","let { hilbert } = import(matrix);\nhilbert(4)"],seeAlso:["matrix.vandermonde","matrix.symmetric?"]},vandermonde:{category:"matrix",description:"Generates a **Vandermonde matrix** from a vector.",returns:{type:"matrix"},args:{v:{type:"vector",description:"The vector to generate the Vandermonde matrix from."}},variants:[{argumentNames:["v"]}],examples:["let { vandermonde } = import(matrix);\nvandermonde([1, 2, 3])","let { vandermonde } = import(matrix);\nvandermonde([1, 0, 1])"],seeAlso:["matrix.hilbert","matrix.band"]},band:{category:"matrix",description:"Generates a **banded matrix** of size `n` with lower band index `lband` and upper band index `uband`.",returns:{type:"matrix"},args:{n:{type:"integer",description:"The size of the banded matrix."},lband:{type:"integer",description:"The lower band index."},uband:{type:"integer",description:"The upper band index."}},variants:[{argumentNames:["n","lband","uband"]}],examples:["let { band } = import(matrix);\nband(3, 1, 1)","let { band } = import(matrix);\nband(4, 1, 2)"],seeAlso:["matrix.banded?","matrix.diagonal?","matrix.vandermonde"]},"banded?":{category:"matrix",description:"Checks if a `matrix` is **banded** with lower band index `lband` and upper band index `uband`.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for **banded** property."},lband:{type:"integer",description:"The lower band index."},uband:{type:"integer",description:"The upper band index."}},variants:[{argumentNames:["m","lband","uband"]}],examples:["let { banded? } = import(matrix);\nbanded?([\n [1, 1, 1, 0],\n [1, 1, 1, 1],\n [1, 1, 1, 1],\n [0, 1, 1, 1],\n], 2, 2)","let { banded? } = import(matrix);\nbanded?([\n [1, 1, 1, 0],\n [1, 1, 1, 1],\n [1, 1, 1, 1],\n [0, 1, 1, 1],\n], 1, 1)"],seeAlso:["matrix.band","matrix.triangular?","matrix.diagonal?"]},rank:{category:"matrix",description:"Calculates the **rank** of a matrix using **Gaussian elimination**.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the rank of."}},variants:[{argumentNames:["m"]}],examples:["let { rank } = import(matrix);\nrank([[1, 0, 0], [0, 1, 0], [0, 0, 1]])","let { rank } = import(matrix);\nrank([[1, 2, 3], [4, 5, 6], [7, 8, 9]])","let { rank } = import(matrix);\nrank([[2, 4, 6], [3, 6, 9], [4, 8, 12]])"],seeAlso:["matrix.det","matrix.invertible?","linear-algebra.rref"]},"frobenius-norm":{category:"matrix",description:"Calculates the **Frobenius norm** of a matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the Frobenius norm of."}},variants:[{argumentNames:["m"]}],examples:["let { frobenius-norm } = import(matrix);\nfrobenius-norm([[1, 2], [3, 4]])","let { frobenius-norm } = import(matrix);\nfrobenius-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.one-norm","matrix.inf-norm","matrix.max-norm"]},"one-norm":{category:"matrix",description:"Calculates the **one-norm** (column norm) of a matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the one-norm of."}},variants:[{argumentNames:["m"]}],examples:["let { one-norm } = import(matrix);\none-norm([[1, 2], [3, 4]])","let { one-norm } = import(matrix);\none-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.frobenius-norm","matrix.inf-norm","matrix.max-norm"]},"inf-norm":{category:"matrix",description:"Calculates the **infinity norm** of a matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the infinity norm of."}},variants:[{argumentNames:["m"]}],examples:["let { inf-norm } = import(matrix);\ninf-norm([[1, 2], [3, 4]])","let { inf-norm } = import(matrix);\ninf-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.frobenius-norm","matrix.one-norm","matrix.max-norm"]},"max-norm":{category:"matrix",description:"Calculates the **max norm** of a matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the max norm of."}},variants:[{argumentNames:["m"]}],examples:["let { max-norm } = import(matrix);\nmax-norm([[1, 2], [3, 4]])","let { max-norm } = import(matrix);\nmax-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.frobenius-norm","matrix.one-norm","matrix.inf-norm"]}};function A(t){const e=t.length,r=[];for(let a=0;a<e;a++)r[a]=[...t[a]];if(1===e)return r[0][0];if(2===e)return r[0][0]*r[1][1]-r[0][1]*r[1][0];let a=1;for(let t=0;t<e-1;t+=1){let n=t;for(let a=t+1;a<e;a+=1)Math.abs(r[a][t])>Math.abs(r[n][t])&&(n=a);if(w(r[n][t]))return 0;n!==t&&([r[t],r[n]]=[r[n],r[t]],a=-a);for(let a=t+1;a<e;a+=1){const n=r[a][t]/r[t][t];for(let i=t;i<e;i++)r[a][i]-=n*r[t][i]}}let n=a;for(let t=0;t<e;t++)n*=r[t][t];return n}function T(t,e,r){const a=t.length,n=[];for(let i=0;i<a;i++)if(i!==e){const e=[];for(let n=0;n<a;n++)n!==r&&e.push(t[i][n]);n.push(e)}return n}function $(t){const e=t.length,r=[];for(let a=0;a<e;a++){r[a]=[];for(let n=0;n<e;n++){const e=(-1)**(a+n)*A(T(t,n,a));r[a][n]=e}}return r}function C(t){return t.length===t[0].length}function M(t){if(!C(t))return!1;const e=t.length;for(let r=0;r<e;r++)for(let a=0;a<e;a++)if(r===a){if(!v(t[r][a],1))return!1}else if(!w(t[r][a]))return!1;return!0}function q(t,e){if(0===t.length||0===e.length||t[0].length!==e.length)throw new Error("Matrix dimensions do not match for multiplication");const r=t.length,a=t[0].length,n=e[0].length,i=Array(r).fill(0).map(()=>Array(n).fill(0));for(let o=0;o<r;o++)for(let r=0;r<a;r++){const a=t[o][r];for(let t=0;t<n;t++)i[o][t]+=a*e[r][t]}return i}const j={mul:{evaluate:([t,r],a)=>{y(t,a),y(r,a);try{return q(t,r)}catch(n){throw new e(`The number of columns in the first matrix must be equal to the number of rows in the second matrix, but got ${t[0].length} and ${r.length}`,a)}},arity:N(2)},det:{evaluate:([t],e)=>(b(t,e),A(t)),arity:N(1)},inv:{evaluate:([t],r)=>{b(t,r);const a=function(t){const e=t.length;if(1===e){const e=t[0][0];return w(e)?null:[[1/e]]}const r=A(t);if(w(r))return null;const a=$(t),n=[];for(let t=0;t<e;t++){n[t]=[];for(let i=0;i<e;i++)n[t][i]=a[t][i]/r}return n}(t);if(null===a)throw new e("The matrix must be invertible",r);return a},arity:N(1)},adj:{evaluate:([t],e)=>(b(t,e),$(t)),arity:N(1)},cofactor:{evaluate:([t],e)=>(b(t,e),function(t){const e=t.length,r=[];for(let a=0;a<e;a++){r[a]=[];for(let n=0;n<e;n++){const e=T(t,a,n),i=(-1)**(a+n);r[a][n]=i*A(e)}}return r}(t)),arity:N(1)},minor:{evaluate:([t,e,r],a)=>(y(t,a),s(e,a,{integer:!0,nonNegative:!0,lte:t.length}),s(r,a,{integer:!0,nonNegative:!0,lte:t[0].length}),T(t,e,r)),arity:N(3)},trace:{evaluate:([t],e)=>(b(t,e),function(t){return t.reduce((t,e,r)=>t+e[r],0)}(t)),arity:N(1)},"symmetric?":{evaluate:([t],e)=>(y(t,e),function(t){const e=t.length;if(!C(t))return!1;for(let r=0;r<e;r+=1)for(let e=0;e<r;e+=1)if(t[r][e]!==t[e][r])return!1;return!0}(t)),arity:N(1)},"triangular?":{evaluate:([t],e)=>(y(t,e),function(t){if(!C(t))return!1;const e=t.length;let r=!0,a=!0;for(let n=0;n<e;n++)for(let i=0;i<e;i++){if(n>i&&0!==t[n][i]&&(r=!1,!a))return!1;n<i&&0!==t[n][i]&&(a=!1)}return r||a}(t)),arity:N(1)},"upper-triangular?":{evaluate:([t],e)=>(y(t,e),function(t){if(!C(t))return!1;const e=t.length;for(let r=0;r<e;r++)for(let e=0;e<r;e++)if(0!==t[r][e])return!1;return!0}(t)),arity:N(1)},"lower-triangular?":{evaluate:([t],e)=>(y(t,e),function(t){if(!C(t))return!1;const e=t.length;if(!t.every(t=>t.length===e))return!1;for(let r=0;r<e;r++)for(let a=r+1;a<e;a++)if(0!==t[r][a])return!1;return!0}(t)),arity:N(1)},"diagonal?":{evaluate:([t],e)=>(y(t,e),function(t){if(!C(t))return!1;const e=t.length;for(let r=0;r<e;r+=1)for(let a=0;a<e;a+=1)if(r!==a&&0!==t[r][a])return!1;return!0}(t)),arity:N(1)},"square?":{evaluate:([t],e)=>(y(t,e),C(t)),arity:N(1)},"orthogonal-matrix?":{evaluate:([t],e)=>(y(t,e),function(t){return!!C(t)&&M(q(t,function(t){const e=[];for(let r=0;r<t[0].length;r+=1){const a=[];for(let e=0;e<t.length;e+=1)a.push(t[e][r]);e.push(a)}return e}(t)))}(t)),arity:N(1)},"identity?":{evaluate:([t],e)=>(y(t,e),M(t)),arity:N(1)},"invertible?":{evaluate:([t],e)=>(y(t,e),!!function(t){return!!h(t)&&t.length===t[0].length}(t)&&!w(A(t))),arity:N(1)},hilbert:{evaluate:([t],e)=>{s(t,e,{integer:!0,positive:!0});const r=[];for(let e=0;e<t;e+=1){const a=[];for(let r=0;r<t;r+=1)a.push(1/(e+r+1));r.push(a)}return r},arity:N(1)},vandermonde:{evaluate:([t],e)=>{g(t,e);const r=[];for(let e=0;e<t.length;e+=1){const a=[];for(let r=0;r<t.length;r+=1)a.push(t[e]**r);r.push(a)}return r},arity:N(1)},band:{evaluate:([t,e,r],a)=>(s(t,a,{integer:!0,positive:!0}),s(e,a,{integer:!0,nonNegative:!0,lt:t}),s(r,a,{integer:!0,nonNegative:!0,lte:t}),function(t,e,r){const a=Array.from({length:t},()=>Array.from({length:t},()=>0));for(let n=0;n<t;n++)for(let i=Math.max(0,n-e);i<=Math.min(t-1,n+r);i++)a[n][i]=1;return a}(t,e,r)),arity:N(3)},"banded?":{evaluate:([t,e,r],a)=>{y(t,a);const n=Math.max(t.length,t[0].length);return s(e,a,{integer:!0,nonNegative:!0,lt:n}),s(r,a,{integer:!0,nonNegative:!0,lt:n}),function(t,e,r){const a=t.length,n=t[0].length;for(let i=0;i<a;i++)for(let a=0;a<n;a++)if(0!==t[i][a]&&(i-a>e||a-i>r))return!1;return!0}(t,e,r)},arity:N(3)},rank:{evaluate:([t],e)=>{y(t,e);const[,r]=function(t){const e=t.map(t=>[...t]),r=e.length,a=e[0].length;let n=0,i=0;for(let t=0;t<a;t++){let o=-1;for(let a=i;a<r;a++)if(!w(e[a][t])){o=a;break}if(-1===o)continue;n+=1,o!==i&&([e[o],e[i]]=[e[i],e[o]]);const m=e[i][t];for(let r=t;r<a;r++)e[i][r]/=m;for(let n=0;n<r;n++)if(n!==i&&!w(e[n][t])){const r=e[n][t];for(let o=t;o<a;o++)e[n][o]-=r*e[i][o]}if(i++,i===r)break}return[e,n]}(t);return r},arity:N(1)},"frobenius-norm":{evaluate:([t],e)=>(y(t,e),Math.sqrt(t.reduce((t,e)=>t+e.reduce((t,e)=>t+e*e,0),0))),arity:N(1)},"one-norm":{evaluate:([t],e)=>(y(t,e),function(t){const e=t.length,r=t[0].length;let a=0;for(let n=0;n<r;n+=1){let r=0;for(let a=0;a<e;a+=1)r+=Math.abs(t[a][n]);a=Math.max(a,r)}return a}(t)),arity:N(1)},"inf-norm":{evaluate:([t],e)=>(y(t,e),t.reduce((t,e)=>Math.max(t,e.reduce((t,e)=>t+Math.abs(e),0)),0)),arity:N(1)},"max-norm":{evaluate:([t],e)=>(y(t,e),t.reduce((t,e)=>{const r=e.reduce((t,e)=>Math.max(t,Math.abs(e)),0);return Math.max(t,r)},0)),arity:N(1)}};for(const[t,e]of Object.entries(k))j[t]&&(j[t].docs=e);const S={name:"matrix",functions:j};export{S as matrixModule};
2
+ //# sourceMappingURL=matrix.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrix.esm.js","sources":["../../src/utils/debug/getCodeMarker.ts","../../src/errors.ts","../../src/constants/constants.ts","../../src/utils/debug/debugTools.ts","../../src/utils/symbols.ts","../../src/typeGuards/number.ts","../../src/utils/debug/getSourceCodeInfo.ts","../../src/typeGuards/annotatedArrays.ts","../../src/utils/index.ts","../../src/utils/arity.ts","../../src/builtin/modules/matrix/docs.ts","../../src/builtin/modules/matrix/helpers/determinant.ts","../../src/builtin/modules/matrix/helpers/minor.ts","../../src/builtin/modules/matrix/helpers/adjugate.ts","../../src/builtin/modules/matrix/helpers/isSquare.ts","../../src/builtin/modules/matrix/helpers/isIdentity.ts","../../src/builtin/modules/matrix/helpers/matrixMultiply.ts","../../src/builtin/modules/matrix/index.ts","../../src/builtin/modules/matrix/helpers/inverse.ts","../../src/builtin/modules/matrix/helpers/cofactor.ts","../../src/builtin/modules/matrix/helpers/trace.ts","../../src/builtin/modules/matrix/helpers/isSymetric.ts","../../src/builtin/modules/matrix/helpers/isTriangular.ts","../../src/builtin/modules/matrix/helpers/isDiagonal.ts","../../src/builtin/modules/matrix/helpers/isOrthogonal.ts","../../src/builtin/modules/grid/transpose.ts","../../src/builtin/modules/matrix/helpers/band.ts","../../src/builtin/modules/matrix/helpers/isBanded.ts","../../src/builtin/modules/linear-algebra/helpers/gaussJordanElimination.ts","../../src/builtin/modules/matrix/helpers/norm1.ts"],"sourcesContent":["import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getCodeMarker(sourceCodeInfo: SourceCodeInfo): string {\n if (!sourceCodeInfo.position || !sourceCodeInfo.code)\n return ''\n\n const leftPadding = sourceCodeInfo.position.column - 1\n const rightPadding = sourceCodeInfo.code.length - leftPadding - 1\n return `${' '.repeat(Math.max(leftPadding, 0))}^${' '.repeat(Math.max(rightPadding, 0))}`\n}\n","import { getCodeMarker } from '../src/utils/debug/getCodeMarker'\nimport type { Arr } from './interface'\nimport type { SourceCodeInfo } from './tokenizer/token'\n\nfunction getDvalaErrorMessage(message: string, sourceCodeInfo?: SourceCodeInfo) {\n if (!sourceCodeInfo) {\n return message\n }\n const location = `${sourceCodeInfo.position.line}:${sourceCodeInfo.position.column}`\n const filePathLine = sourceCodeInfo.filePath\n ? `\\n${sourceCodeInfo.filePath}:${location}`\n : `\\nLocation ${location}`\n const codeLine = `\\n${sourceCodeInfo.code}`\n const codeMarker = `\\n${getCodeMarker(sourceCodeInfo)}`\n return `${message}${filePathLine}${codeLine}${codeMarker}`\n}\n\nexport class RecurSignal extends Error {\n public params: Arr\n constructor(params: Arr) {\n super(`recur, params: ${params}`)\n Object.setPrototypeOf(this, RecurSignal.prototype)\n this.name = 'RecurSignal'\n this.params = params\n }\n}\n\nexport class DvalaError extends Error {\n public readonly sourceCodeInfo?: SourceCodeInfo\n public readonly shortMessage: string\n constructor(err: unknown, sourceCodeInfo: SourceCodeInfo | undefined) {\n const message = err instanceof Error\n ? err.message\n : `${err}`\n\n super(getDvalaErrorMessage(message, sourceCodeInfo))\n this.shortMessage = message\n this.sourceCodeInfo = sourceCodeInfo\n Object.setPrototypeOf(this, DvalaError.prototype)\n this.name = 'DvalaError'\n }\n\n public getCodeMarker(): string | undefined {\n return this.sourceCodeInfo && getCodeMarker(this.sourceCodeInfo)\n }\n}\n\nexport class UserDefinedError extends DvalaError {\n public userMessage: string\n constructor(message: string, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n this.userMessage = message\n Object.setPrototypeOf(this, UserDefinedError.prototype)\n this.name = 'UserDefinedError'\n }\n}\n\nexport class AssertionError extends DvalaError {\n constructor(message: string | Error, sourceCodeInfo?: SourceCodeInfo) {\n super(message, sourceCodeInfo)\n Object.setPrototypeOf(this, AssertionError.prototype)\n this.name = 'AssertionError'\n }\n}\n\nexport class UndefinedSymbolError extends DvalaError {\n public symbol: string\n constructor(symbolName: string, sourceCodeInfo?: SourceCodeInfo) {\n const message = `Undefined symbol '${symbolName}'.`\n super(message, sourceCodeInfo)\n this.symbol = symbolName\n Object.setPrototypeOf(this, UndefinedSymbolError.prototype)\n this.name = 'UndefinedSymbolError'\n }\n}\n\nexport function isDvalaError(error: unknown): error is DvalaError {\n return error instanceof DvalaError\n}\n","export const NodeTypes = {\n Number: 1,\n String: 2,\n NormalExpression: 3,\n SpecialExpression: 4,\n UserDefinedSymbol: 5,\n NormalBuiltinSymbol: 6,\n SpecialBuiltinSymbol: 7,\n ReservedSymbol: 8,\n Binding: 9,\n Spread: 10,\n} as const\n\nconst NodeTypesSet = new Set(Object.values(NodeTypes))\n\nexport type NodeType = typeof NodeTypes[keyof typeof NodeTypes]\n\nexport function getNodeTypeName(type: NodeType): keyof typeof NodeTypes {\n return Object.keys(NodeTypes).find(key => NodeTypes[key as keyof typeof NodeTypes] === type) as keyof typeof NodeTypes\n}\n\n// TODO, is this needed?\nexport function isNodeType(type: unknown): type is NodeType {\n return typeof type === 'number' && NodeTypesSet.has(type as NodeType)\n}\n\nconst functionTypes = [\n 'UserDefined',\n 'Partial',\n 'Comp',\n 'Constantly',\n 'Juxt',\n 'Complement',\n 'EveryPred',\n 'SomePred',\n 'Fnull',\n 'Builtin',\n 'SpecialBuiltin',\n 'NativeJsFunction',\n 'Module',\n] as const\n\nconst functionTypeSet = new Set(functionTypes)\n\nexport type FunctionType = typeof functionTypes[number]\n\nexport function isFunctionType(type: unknown): type is FunctionType {\n return typeof type === 'string' && functionTypeSet.has(type as FunctionType)\n}\n","import { getNodeTypeName, isFunctionType, isNodeType } from '../../constants/constants'\nimport type { AstNode, DvalaFunction } from '../../parser/types'\nimport { FUNCTION_SYMBOL } from '../symbols'\n\nfunction isDvalaFunction(func: unknown): func is DvalaFunction {\n if (func === null || typeof func !== 'object')\n return false\n\n return FUNCTION_SYMBOL in func && 'functionType' in func && isFunctionType(func.functionType)\n}\n\nfunction isNode(value: unknown): value is AstNode {\n if (!Array.isArray(value) || value.length < 2)\n return false\n return isNodeType(value[0])\n}\n\nexport function valueToString(value: unknown): string {\n if (isDvalaFunction(value))\n // eslint-disable-next-line ts/no-unsafe-member-access\n return `<function ${(value as any).name || '\\u03BB'}>`\n\n if (isNode(value))\n return `${getNodeTypeName(value[0])}-node`\n\n if (value === null)\n return 'null'\n\n if (typeof value === 'object' && value instanceof RegExp)\n return `${value}`\n\n if (typeof value === 'object' && value instanceof Error)\n return value.toString()\n\n return JSON.stringify(value)\n}\n","export const FUNCTION_SYMBOL = '^^fn^^'\nexport const REGEXP_SYMBOL = '^^re^^'\nexport const EFFECT_SYMBOL = '^^ef^^'\n","import { DvalaError } from '../errors'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { valueToString } from '../utils/debug/debugTools'\nimport { getSourceCodeInfo } from '../utils/debug/getSourceCodeInfo'\n\ntype SignOptions =\n | {\n positive?: true\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: true\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: true\n nonNegative?: never\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: true\n zero?: never\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: true\n nonZero?: never\n }\n | {\n positive?: never\n negative?: never\n nonPositive?: never\n nonNegative?: never\n zero?: never\n nonZero?: true\n }\n\ntype GtOptions =\n | {\n gt?: number\n gte?: never\n }\n | {\n gt?: never\n gte?: number\n }\n\ntype LtOptions =\n | {\n lt?: number\n lte?: never\n }\n | {\n lt?: never\n lte?: number\n }\n\ntype NumberOptions = {\n integer?: true\n finite?: true\n} & SignOptions &\nGtOptions &\nLtOptions\n\nfunction getRangeString(options: NumberOptions): string {\n const hasUpperAndLowerBound\n = (typeof options.gt === 'number' || typeof options.gte === 'number')\n && (typeof options.lt === 'number' || typeof options.lte === 'number')\n if (hasUpperAndLowerBound) {\n return `${typeof options.gt === 'number' ? `${options.gt} < n ` : `${options.gte} <= n `}${\n typeof options.lt === 'number' ? `< ${options.lt}` : `<= ${options.lte}`\n }`\n }\n else if (typeof options.gt === 'number' || typeof options.gte === 'number') {\n return `${typeof options.gt === 'number' ? `n > ${options.gt}` : `n >= ${options.gte}`}`\n }\n else if (typeof options.lt === 'number' || typeof options.lte === 'number') {\n return `${typeof options.lt === 'number' ? `n < ${options.lt}` : `n <= ${options.lte}`}`\n }\n else { return '' }\n}\n\nfunction getSignString(options: NumberOptions): string {\n return options.positive\n ? 'positive'\n : options.negative\n ? 'negative'\n : options.nonNegative\n ? 'non negative'\n : options.nonPositive\n ? 'non positive'\n : options.nonZero\n ? 'non zero'\n : ''\n}\n\nfunction getNumberTypeName(options: NumberOptions): string {\n if (options.zero)\n return 'zero'\n\n const sign = getSignString(options)\n const numberType = options.integer ? 'integer' : 'number'\n const finite = options.finite ? 'finite' : ''\n const range = getRangeString(options)\n\n return [sign, finite, numberType, range].filter(x => !!x).join(' ')\n}\n\nexport function isNumber(value: unknown, options: NumberOptions = {}): value is number {\n if (typeof value !== 'number')\n return false\n\n if (Number.isNaN(value))\n return false\n\n if (options.integer && !Number.isInteger(value))\n return false\n\n if (options.finite && !Number.isFinite(value))\n return false\n\n if (options.zero && value !== 0)\n return false\n\n if (options.nonZero && value === 0)\n return false\n\n if (options.positive && value <= 0)\n return false\n\n if (options.negative && value >= 0)\n return false\n\n if (options.nonPositive && value > 0)\n return false\n\n if (options.nonNegative && value < 0)\n return false\n\n if (typeof options.gt === 'number' && value <= options.gt)\n return false\n\n if (typeof options.gte === 'number' && value < options.gte)\n return false\n\n if (typeof options.lt === 'number' && value >= options.lt)\n return false\n\n if (typeof options.lte === 'number' && value > options.lte)\n return false\n\n return true\n}\n\nexport function assertNumber(\n value: unknown,\n sourceCodeInfo?: SourceCodeInfo,\n options: NumberOptions = {},\n): asserts value is number {\n if (!isNumber(value, options)) {\n throw new DvalaError(\n `Expected ${getNumberTypeName(options)}, got ${valueToString(value)}.`,\n getSourceCodeInfo(value, sourceCodeInfo),\n )\n }\n}\n\nexport function asNumber(\n value: unknown,\n sourceCodeInfo: SourceCodeInfo | undefined,\n options: NumberOptions = {},\n): number {\n assertNumber(value, sourceCodeInfo, options)\n return value\n}\n","import type { SourceCodeInfo } from '../../tokenizer/token'\n\nexport function getSourceCodeInfo(anyValue: any, sourceCodeInfo: SourceCodeInfo | undefined): SourceCodeInfo | undefined {\n // eslint-disable-next-line ts/no-unsafe-return, ts/no-unsafe-member-access\n return anyValue?.sourceCodeInfo ?? sourceCodeInfo\n}\n","import { DvalaError } from '../errors'\nimport type { Any } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isNumber } from './number'\n\nconst annotatedArrays = new WeakSet<unknown[]>()\nconst vectors = new WeakSet<unknown[]>()\nconst notVectors = new WeakSet<unknown[]>()\nconst matrices = new WeakSet<unknown[]>()\nconst notMatrices = new WeakSet<unknown[]>()\nconst grids = new WeakSet<unknown[]>()\nconst notGrids = new WeakSet<unknown[]>()\n\nexport function annotate<T>(value: T): T {\n if (!Array.isArray(value)) {\n return value\n }\n if (annotatedArrays.has(value)) {\n return value\n }\n isVector(value)\n if (!isMatrix(value)) {\n isGrid(value)\n }\n\n return value\n}\nexport function isVector(vector: unknown): vector is number[] {\n if (!Array.isArray(vector)) {\n return false\n }\n\n if (vectors.has(vector)) {\n return true\n }\n if (notVectors.has(vector)) {\n return false\n }\n\n if (vector.every(elem => isNumber(elem))) {\n annotatedArrays.add(vector)\n vectors.add(vector)\n return true\n }\n notVectors.add(vector)\n return false\n}\n\nexport function assertVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n if (!isVector(vector)) {\n throw new DvalaError(`Expected a vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is2dVector(vector: unknown): vector is [number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 2\n}\nexport function assert2dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number] {\n if (!is2dVector(vector)) {\n throw new DvalaError(`Expected a 2d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function is3dVector(vector: unknown): vector is [number, number, number] {\n if (!isVector(vector)) {\n return false\n }\n return vector.length === 3\n}\nexport function assert3dVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is [number, number, number] {\n if (!is3dVector(vector)) {\n throw new DvalaError(`Expected a 3d vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function assertNonEmptyVector(vector: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts vector is number[] {\n assertVector(vector, sourceCodeInfo)\n if (vector.length === 0) {\n throw new DvalaError(`Expected a non empty vector, but got ${vector}`, sourceCodeInfo)\n }\n}\n\nexport function isGrid(grid: unknown): grid is unknown[][] {\n if (!Array.isArray(grid)) {\n return false\n }\n if (grids.has(grid)) {\n return true\n }\n if (notGrids.has(grid)) {\n return false\n }\n if (grid.length === 0) {\n notGrids.add(grid)\n return false\n }\n if (!Array.isArray(grid[0])) {\n notGrids.add(grid)\n return false\n }\n const nbrOfCols = grid[0].length\n for (const row of grid.slice(1)) {\n if (!Array.isArray(row)) {\n notGrids.add(grid)\n return false\n }\n if (row.length !== nbrOfCols) {\n notGrids.add(grid)\n return false\n }\n }\n annotatedArrays.add(grid)\n grids.add(grid)\n return true\n}\n\nexport function assertGrid(grid: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts grid is Any[][] {\n if (!isGrid(grid)) {\n throw new DvalaError(`Expected a grid, but got ${grid}`, sourceCodeInfo)\n }\n}\n\nexport function isMatrix(matrix: unknown): matrix is number[][] {\n if (!Array.isArray(matrix)) {\n return false\n }\n if (matrices.has(matrix)) {\n return true\n }\n if (notMatrices.has(matrix)) {\n return false\n }\n if (matrix.length === 0) {\n notMatrices.add(matrix)\n return false\n }\n if (!Array.isArray(matrix[0]) || matrix[0].length === 0) {\n notMatrices.add(matrix)\n return false\n }\n const nbrOfCols = matrix[0].length\n for (const row of matrix) {\n if (!Array.isArray(row) || row.length !== nbrOfCols || row.some(cell => !isNumber(cell))) {\n notMatrices.add(matrix)\n return false\n }\n }\n annotatedArrays.add(matrix)\n grids.add(matrix)\n matrices.add(matrix)\n return true\n}\n\nexport function assertMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new DvalaError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n}\n\nexport function assertSquareMatrix(matrix: unknown, sourceCodeInfo: SourceCodeInfo | undefined): asserts matrix is number[][] {\n if (!isMatrix(matrix)) {\n throw new DvalaError(`Expected a matrix, but got ${matrix}`, sourceCodeInfo)\n }\n if (matrix.length !== matrix[0]!.length) {\n throw new DvalaError(`Expected square matrix, but got ${matrix.length} and ${matrix[0]!.length}`, sourceCodeInfo)\n }\n}\n\nexport function isSquareMatrix(matrix: unknown): matrix is number[][] {\n if (!isMatrix(matrix)) {\n return false\n }\n if (matrix.length !== matrix[0]!.length) {\n return false\n }\n return true\n}\n","import type { Any, Coll, Obj } from '../interface'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { asAny, isColl, isObj, isRegularExpression } from '../typeGuards/dvala'\nimport { isNumber } from '../typeGuards/number'\nimport { asString, assertStringOrNumber } from '../typeGuards/string'\nimport { isUnknownRecord } from '../typeGuards'\nimport { DvalaError } from '../errors'\n\nexport function collHasKey(coll: unknown, key: string | number): boolean {\n if (!isColl(coll))\n return false\n\n if (typeof coll === 'string' || Array.isArray(coll)) {\n if (!isNumber(key, { integer: true }))\n return false\n\n return key >= 0 && key < coll.length\n }\n return !!Object.getOwnPropertyDescriptor(coll, key)\n}\n\nexport function compare<T extends string | number>(a: T, b: T, sourceCodeInfo: SourceCodeInfo | undefined): number {\n assertStringOrNumber(a, sourceCodeInfo)\n assertStringOrNumber(b, sourceCodeInfo)\n\n if (typeof a === 'string' && typeof b === 'string') {\n return a < b ? -1 : a > b ? 1 : 0\n }\n if (typeof a === 'number' && typeof b === 'number') {\n return Math.sign((a) - (b))\n }\n throw new DvalaError(`Cannot compare values of different types: ${typeof a} and ${typeof b}`, sourceCodeInfo)\n}\n\nexport function deepEqual(a: unknown, b: unknown, sourceCodeInfo?: SourceCodeInfo): boolean {\n if (a === b)\n return true\n\n if (typeof a === 'number' && typeof b === 'number')\n return approxEqual(a, b)\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length)\n return false\n\n for (let i = 0; i < a.length; i += 1) {\n if (!deepEqual(asAny(a[i], sourceCodeInfo), asAny(b[i], sourceCodeInfo), sourceCodeInfo))\n return false\n }\n return true\n }\n if (isRegularExpression(a) && isRegularExpression(b))\n return a.s === b.s && a.f === b.f\n\n if (isUnknownRecord(a) && isUnknownRecord(b)) {\n const aKeys = Object.keys(a)\n const bKeys = Object.keys(b)\n if (aKeys.length !== bKeys.length)\n return false\n\n for (let i = 0; i < aKeys.length; i += 1) {\n const key = asString(aKeys[i], sourceCodeInfo)\n if (!deepEqual(a[key], b[key], sourceCodeInfo))\n return false\n }\n return true\n }\n return false\n}\n\nexport function toNonNegativeInteger(num: number): number {\n return Math.max(0, Math.ceil(num))\n}\n\nexport function toAny(value: unknown): Any {\n return (value ?? null) as Any\n}\n\nfunction clone<T>(value: T): T {\n if (isObj(value)) {\n return Object.entries(value).reduce((result: Obj, entry) => {\n const [key, val] = entry\n result[key] = clone(val)\n return result\n }, {}) as T\n }\n if (Array.isArray(value))\n // eslint-disable-next-line ts/no-unsafe-return\n return value.map(item => clone(item)) as unknown as T\n\n return value\n}\n\nexport function cloneColl<T extends Coll>(value: T): T {\n return clone(value)\n}\n\nexport function joinSets<T>(...results: Set<T>[]): Set<T> {\n const result = new Set<T>()\n for (const symbols of results)\n symbols.forEach(symbol => result.add(symbol))\n\n return result\n}\n\nexport function addToSet<T>(target: Set<T>, source: Set<T>): void {\n source.forEach(symbol => target.add(symbol))\n}\n\nexport const EPSILON = 1e-10\n\nexport function approxEqual(a: number, b: number, epsilon: number = EPSILON): boolean {\n if (a === b) {\n return true\n }\n\n const diff = Math.abs(a - b)\n\n if (a === 0 || b === 0 || diff < epsilon) {\n // Use absolute error for values near zero\n return diff < epsilon\n }\n const absA = Math.abs(a)\n const absB = Math.abs(b)\n\n // Use relative error for larger values\n return diff / (absA + absB) < epsilon\n}\n\nexport function approxZero(value: number): boolean {\n return Math.abs(value) < EPSILON\n}\n\nexport function smartTrim(str: string, minIndent = 0): string {\n const lines = str.split('\\n')\n while (lines[0]?.match(/^\\s*$/)) {\n lines.shift() // Remove leading empty lines\n }\n while (lines[lines.length - 1]?.match(/^\\s*$/)) {\n lines.pop() // Remove trailing empty lines\n }\n const indent = lines.reduce((acc, line) => {\n if (line.match(/^\\s*$/))\n return acc // Skip empty lines\n const lineIndent = line.match(/^\\s*/)![0].length\n return Math.min(acc, lineIndent)\n }, Infinity)\n return lines.map(line => ' '.repeat(minIndent) + line.slice(indent)).join('\\n').trimEnd()\n}\n","import type { Arity } from '../builtin/interface'\nimport { DvalaError } from '../errors'\nimport type { FunctionLike } from '../parser/types'\nimport type { SourceCodeInfo } from '../tokenizer/token'\nimport { isColl } from '../typeGuards/dvala'\nimport { valueToString } from './debug/debugTools'\n\nexport function arityAccepts(arity: Arity, nbrOfParams: number): boolean {\n const { min, max } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n if (typeof max === 'number' && nbrOfParams > max) {\n return false\n }\n return true\n}\n\nexport function arityAcceptsMin(arity: Arity, nbrOfParams: number): boolean {\n const { min } = arity\n if (typeof min === 'number' && nbrOfParams < min) {\n return false\n }\n return true\n}\n\nexport function getCommonArityFromFunctions(params: FunctionLike[]): Arity | null {\n return params.reduce((acc: Arity | null, param): Arity | null => {\n if (acc === null) {\n return null\n }\n const arity: Arity = (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n const { min: aMin, max: aMax } = arity\n const { min: bMin, max: bMax } = acc\n const min = typeof aMin === 'number' && typeof bMin === 'number'\n ? Math.max(aMin, bMin)\n : typeof aMin === 'number' ? aMin : typeof bMin === 'number' ? bMin : undefined\n const max = typeof aMax === 'number' && typeof bMax === 'number'\n ? Math.min(aMax, bMax)\n : typeof aMax === 'number' ? aMax : typeof bMax === 'number' ? bMax : undefined\n\n if (typeof min === 'number' && typeof max === 'number' && min > max) {\n return null\n }\n\n return { min, max }\n }, {})\n}\n\nexport function getArityFromFunction(param: FunctionLike): Arity {\n return (typeof param === 'number' || isColl(param)) ? toFixedArity(1) : param.arity\n}\n\nexport function assertNumberOfParams(arity: Arity, length: number, sourceCodeInfo: SourceCodeInfo | undefined): void {\n const { min, max } = arity\n if (typeof min === 'number' && length < min) {\n throw new DvalaError(\n `Wrong number of arguments, expected at least ${min}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n\n if (typeof max === 'number' && length > max) {\n throw new DvalaError(\n `Wrong number of arguments, expected at most ${max}, got ${valueToString(length)}.`,\n sourceCodeInfo,\n )\n }\n}\n\nexport function canBeOperator(count: Arity): boolean {\n if (typeof count.max === 'number' && count.max < 2) {\n return false\n }\n\n if (typeof count.min === 'number' && count.min > 2) {\n return false\n }\n\n return true\n}\n\nexport function toFixedArity(arity: number): Arity {\n return { min: arity, max: arity }\n}\n","import type { FunctionDocs } from '../../interface'\n\nexport const moduleDocs: Record<string, FunctionDocs> = {\n 'mul': {\n category: 'matrix',\n description: 'Multiplies two `matrices` using standard `matrix` multiplication based on **dot products** of rows and columns.',\n returns: {\n type: 'matrix',\n },\n args: {\n a: {\n type: 'matrix',\n },\n b: {\n type: 'matrix',\n },\n },\n variants: [\n {\n argumentNames: [\n 'a',\n 'b',\n ],\n },\n ],\n examples: [\n 'let { mul } = import(matrix);\\nmul([[1, 2], [3, 4]], [[5, 6], [7, 8]])',\n 'let { mul } = import(matrix);\\nmul([[1, 2, 3], [4, 5, 6]], [[7, 8], [9, 10], [11, 12]])',\n ],\n seeAlso: ['matrix.det', 'matrix.inv'],\n },\n 'det': {\n category: 'matrix',\n description: 'Calculates the **determinant** of a square matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the determinant of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { det } = import(matrix);\\ndet([[1, 2], [3, 4]])',\n 'let { det } = import(matrix);\\ndet([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.inv', 'matrix.cofactor', 'matrix.adj', 'matrix.trace', 'matrix.rank', 'matrix.invertible?', 'matrix.mul', 'matrix.minor'],\n },\n 'inv': {\n category: 'matrix',\n description: 'Calculates the **inverse** of a square matrix.',\n returns: {\n type: 'matrix',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the inverse of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { inv } = import(matrix);\\ninv([[1, 2], [3, 4]])',\n 'let { inv } = import(matrix);\\ninv([[1, 2, 3], [4, 5, 7], [7, 8, 10]])',\n ],\n seeAlso: ['matrix.det', 'matrix.adj', 'matrix.invertible?', 'linear-algebra.solve', 'matrix.mul', 'matrix.orthogonal-matrix?'],\n },\n 'adj': {\n category: 'matrix',\n description: 'Calculates the **adjugate** of a square matrix.',\n returns: {\n type: 'matrix',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the adjugate of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { adj } = import(matrix);\\nadj([[1, 2], [3, 4]])',\n 'let { adj } = import(matrix);\\nadj([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { adj } = import(matrix);\\nadj([[1, 2, 3], [7, 8, 9], [4, 5, 6]])',\n ],\n seeAlso: ['matrix.cofactor', 'matrix.det', 'matrix.inv'],\n },\n 'cofactor': {\n category: 'matrix',\n description: 'Calculates the **cofactor** of a square matrix.',\n returns: {\n type: 'matrix',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the cofactor of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { cofactor } = import(matrix);\\ncofactor([[1, 2], [3, 4]])',\n 'let { cofactor } = import(matrix);\\ncofactor([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { cofactor } = import(matrix);\\ncofactor([[1, 2, 3], [7, 8, 9], [4, 5, 6]])',\n ],\n seeAlso: ['matrix.adj', 'matrix.minor', 'matrix.det'],\n },\n 'minor': {\n category: 'matrix',\n description: 'Calculates the **minor** of a square matrix.',\n returns: {\n type: 'matrix',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the minor of.',\n },\n row: {\n type: 'integer',\n description: 'The row index of the element to calculate the minor for.',\n },\n col: {\n type: 'integer',\n description: 'The column index of the element to calculate the minor for.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n 'row',\n 'col',\n ],\n },\n ],\n examples: [\n 'let { minor } = import(matrix);\\nminor([[1, 2], [3, 4]], 0, 1)',\n 'let { minor } = import(matrix);\\nminor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1)',\n ],\n seeAlso: ['matrix.cofactor', 'matrix.det'],\n },\n 'trace': {\n category: 'matrix',\n description: 'Calculates the **trace** of a square matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the trace of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { trace } = import(matrix);\\ntrace([[1, 2], [3, 4]])',\n 'let { trace } = import(matrix);\\ntrace([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.det', 'matrix.diagonal?'],\n },\n 'symmetric?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **symmetric**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for symmetry.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { symmetric? } = import(matrix);\\nsymmetric?([[1, 2], [2, 1]])',\n 'let { symmetric? } = import(matrix);\\nsymmetric?([[1, 2, 3], [2, 1, 4], [3, 4, 1]])',\n ],\n seeAlso: ['matrix.orthogonal-matrix?', 'matrix.diagonal?', 'matrix.square?', 'matrix.hilbert'],\n },\n 'triangular?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **triangular**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for triangularity.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { triangular? } = import(matrix);\\ntriangular?([[2, 0], [0, 1]])',\n 'let { triangular? } = import(matrix);\\ntriangular?([[1, 2, 3], [0, 4, 5], [0, 0, 6]])',\n ],\n seeAlso: ['matrix.upper-triangular?', 'matrix.lower-triangular?', 'matrix.diagonal?', 'matrix.banded?'],\n },\n 'upper-triangular?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **upper triangular**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for upper triangularity.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { upper-triangular? } = import(matrix);\\nupper-triangular?([[1, 2], [0, 3]])',\n 'let { upper-triangular? } = import(matrix);\\nupper-triangular?([[1, 2, 3], [0, 4, 5], [0, 0, 6]])',\n ],\n seeAlso: ['matrix.lower-triangular?', 'matrix.triangular?', 'matrix.diagonal?'],\n },\n 'lower-triangular?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **lower triangular**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for lower triangularity.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { lower-triangular? } = import(matrix);\\nlower-triangular?([[1, 0], [2, 3]])',\n 'let { lower-triangular? } = import(matrix);\\nlower-triangular?([[1, 0, 0], [2, 3, 0], [4, 5, 6]])',\n ],\n seeAlso: ['matrix.upper-triangular?', 'matrix.triangular?', 'matrix.diagonal?'],\n },\n 'diagonal?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **diagonal**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for diagonal property.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { diagonal? } = import(matrix);\\ndiagonal?([[1, 0], [0, 2]])',\n 'let { diagonal? } = import(matrix);\\ndiagonal?([[1, 0, 0], [0, 2, 0], [0, 0, 3]])',\n 'let { diagonal? } = import(matrix);\\ndiagonal?([[1, 0, 0], [2, 2, 2], [0, 0, 3]])',\n ],\n seeAlso: ['matrix.identity?', 'matrix.symmetric?', 'matrix.triangular?', 'matrix.trace', 'matrix.upper-triangular?', 'matrix.lower-triangular?', 'matrix.band', 'matrix.banded?'],\n },\n 'square?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **square**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for square property.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { square? } = import(matrix);\\nsquare?([[1, 2], [3, 4]])',\n 'let { square? } = import(matrix);\\nsquare?([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { square? } = import(matrix);\\nsquare?([[1, 2, 3], [4, 5, 6]])',\n ],\n seeAlso: ['matrix.symmetric?', 'matrix.identity?', 'matrix.invertible?'],\n },\n 'orthogonal-matrix?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **orthogonal**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for **orthogonality**.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { orthogonal-matrix? } = import(matrix);\\northogonal-matrix?([[1, 0], [0, 1]])',\n 'let { orthogonal-matrix? } = import(matrix);\\northogonal-matrix?([[1, 0], [0, -1]])',\n 'let { orthogonal-matrix? } = import(matrix);\\northogonal-matrix?([[1, 2], [3, 4]])',\n ],\n seeAlso: ['matrix.symmetric?', 'matrix.inv', 'matrix.identity?', 'linear-algebra.orthogonal?'],\n },\n 'identity?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is an **identity matrix**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for identity property.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { identity? } = import(matrix);\\nidentity?([[1, 0], [0, 1]])',\n 'let { identity? } = import(matrix);\\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 1]])',\n 'let { identity? } = import(matrix);\\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 0]])',\n ],\n seeAlso: ['matrix.diagonal?', 'matrix.square?', 'matrix.orthogonal-matrix?'],\n },\n 'invertible?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **invertible**.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for invertibility.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { invertible? } = import(matrix);\\ninvertible?([[1, 2], [3, 4]])',\n 'let { invertible? } = import(matrix);\\ninvertible?([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { invertible? } = import(matrix);\\ninvertible?([[1, 2], [2, 4]])',\n ],\n seeAlso: ['matrix.det', 'matrix.inv', 'matrix.rank', 'matrix.square?'],\n },\n 'hilbert': {\n category: 'matrix',\n description: 'Generates a **Hilbert matrix** of size `n`.',\n returns: {\n type: 'matrix',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The size of the Hilbert matrix.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n ],\n },\n ],\n examples: [\n 'let { hilbert } = import(matrix);\\nhilbert(3)',\n 'let { hilbert } = import(matrix);\\nhilbert(4)',\n ],\n seeAlso: ['matrix.vandermonde', 'matrix.symmetric?'],\n },\n 'vandermonde': {\n category: 'matrix',\n description: 'Generates a **Vandermonde matrix** from a vector.',\n returns: {\n type: 'matrix',\n },\n args: {\n v: {\n type: 'vector',\n description: 'The vector to generate the Vandermonde matrix from.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'v',\n ],\n },\n ],\n examples: [\n 'let { vandermonde } = import(matrix);\\nvandermonde([1, 2, 3])',\n 'let { vandermonde } = import(matrix);\\nvandermonde([1, 0, 1])',\n ],\n seeAlso: ['matrix.hilbert', 'matrix.band'],\n },\n 'band': {\n category: 'matrix',\n description: 'Generates a **banded matrix** of size `n` with lower band index `lband` and upper band index `uband`.',\n returns: {\n type: 'matrix',\n },\n args: {\n n: {\n type: 'integer',\n description: 'The size of the banded matrix.',\n },\n lband: {\n type: 'integer',\n description: 'The lower band index.',\n },\n uband: {\n type: 'integer',\n description: 'The upper band index.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'n',\n 'lband',\n 'uband',\n ],\n },\n ],\n examples: [\n 'let { band } = import(matrix);\\nband(3, 1, 1)',\n 'let { band } = import(matrix);\\nband(4, 1, 2)',\n ],\n seeAlso: ['matrix.banded?', 'matrix.diagonal?', 'matrix.vandermonde'],\n },\n 'banded?': {\n category: 'matrix',\n description: 'Checks if a `matrix` is **banded** with lower band index `lband` and upper band index `uband`.',\n returns: {\n type: 'boolean',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to check for **banded** property.',\n },\n lband: {\n type: 'integer',\n description: 'The lower band index.',\n },\n uband: {\n type: 'integer',\n description: 'The upper band index.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n 'lband',\n 'uband',\n ],\n },\n ],\n examples: [\n 'let { banded? } = import(matrix);\\nbanded?([\\n [1, 1, 1, 0],\\n [1, 1, 1, 1],\\n [1, 1, 1, 1],\\n [0, 1, 1, 1],\\n], 2, 2)',\n 'let { banded? } = import(matrix);\\nbanded?([\\n [1, 1, 1, 0],\\n [1, 1, 1, 1],\\n [1, 1, 1, 1],\\n [0, 1, 1, 1],\\n], 1, 1)',\n ],\n seeAlso: ['matrix.band', 'matrix.triangular?', 'matrix.diagonal?'],\n },\n 'rank': {\n category: 'matrix',\n description: 'Calculates the **rank** of a matrix using **Gaussian elimination**.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the rank of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { rank } = import(matrix);\\nrank([[1, 0, 0], [0, 1, 0], [0, 0, 1]])',\n 'let { rank } = import(matrix);\\nrank([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n 'let { rank } = import(matrix);\\nrank([[2, 4, 6], [3, 6, 9], [4, 8, 12]])',\n ],\n seeAlso: ['matrix.det', 'matrix.invertible?', 'linear-algebra.rref'],\n },\n 'frobenius-norm': {\n category: 'matrix',\n description: 'Calculates the **Frobenius norm** of a matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the Frobenius norm of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { frobenius-norm } = import(matrix);\\nfrobenius-norm([[1, 2], [3, 4]])',\n 'let { frobenius-norm } = import(matrix);\\nfrobenius-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.one-norm', 'matrix.inf-norm', 'matrix.max-norm'],\n },\n 'one-norm': {\n category: 'matrix',\n description: 'Calculates the **one-norm** (column norm) of a matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the one-norm of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { one-norm } = import(matrix);\\none-norm([[1, 2], [3, 4]])',\n 'let { one-norm } = import(matrix);\\none-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.frobenius-norm', 'matrix.inf-norm', 'matrix.max-norm'],\n },\n 'inf-norm': {\n category: 'matrix',\n description: 'Calculates the **infinity norm** of a matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the infinity norm of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { inf-norm } = import(matrix);\\ninf-norm([[1, 2], [3, 4]])',\n 'let { inf-norm } = import(matrix);\\ninf-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.frobenius-norm', 'matrix.one-norm', 'matrix.max-norm'],\n },\n 'max-norm': {\n category: 'matrix',\n description: 'Calculates the **max norm** of a matrix.',\n returns: {\n type: 'number',\n },\n args: {\n m: {\n type: 'matrix',\n description: 'The `matrix` to calculate the max norm of.',\n },\n },\n variants: [\n {\n argumentNames: [\n 'm',\n ],\n },\n ],\n examples: [\n 'let { max-norm } = import(matrix);\\nmax-norm([[1, 2], [3, 4]])',\n 'let { max-norm } = import(matrix);\\nmax-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])',\n ],\n seeAlso: ['matrix.frobenius-norm', 'matrix.one-norm', 'matrix.inf-norm'],\n },\n}\n","import { approxZero } from '../../../../utils'\n\n/**\n * Calculates the determinant of a matrix using Gaussian Elimination\n * @param matrix A square matrix represented as a 2D array\n * @returns The determinant of the matrix\n */\nexport function determinant(matrix: number[][]): number {\n // First, make a deep copy of the matrix to avoid modifying the original\n const n = matrix.length\n const A: number[][] = []\n\n for (let i = 0; i < n; i++) {\n A[i] = [...matrix[i]!]\n }\n\n // Handle special cases for small matrices\n if (n === 1) {\n return A[0]![0]!\n }\n\n if (n === 2) {\n return A[0]![0]! * A[1]![1]! - A[0]![1]! * A[1]![0]!\n }\n\n // For larger matrices, use Gaussian elimination\n let sign = 1 // Track sign changes from row swaps\n\n // Perform Gaussian elimination to get an upper triangular matrix\n for (let i = 0; i < n - 1; i += 1) {\n // Find pivot (maximum element in current column)\n let maxRow = i\n\n for (let j = i + 1; j < n; j += 1) {\n if (Math.abs(A[j]![i]!) > Math.abs(A[maxRow]![i]!)) {\n maxRow = j\n }\n }\n\n // If the pivot is zero, the determinant is zero\n if (approxZero(A[maxRow]![i]!)) {\n return 0\n }\n\n // Swap rows if necessary\n if (maxRow !== i) {\n [A[i], A[maxRow]] = [A[maxRow]!, A[i]!] // ES6 array destructuring for swap\n sign = -sign // Each row swap changes the sign\n }\n\n // Eliminate entries below the pivot\n for (let j = i + 1; j < n; j += 1) {\n const factor = A[j]![i]! / A[i]![i]!\n\n // Subtract (factor * pivot row) from current row\n for (let k = i; k < n; k++) {\n A[j]![k]! -= factor * A[i]![k]!\n }\n }\n }\n\n // Calculate determinant as the product of diagonal elements\n let det = sign\n for (let i = 0; i < n; i++) {\n det *= A[i]![i]!\n }\n\n return det\n}\n","export function minor(matrix: number[][], row: number, col: number): number[][] {\n const n = matrix.length\n const result: number[][] = []\n\n for (let i = 0; i < n; i++) {\n if (i !== row) {\n const minorRow: number[] = []\n for (let j = 0; j < n; j++) {\n if (j !== col) {\n minorRow.push(matrix[i]![j]!)\n }\n }\n result.push(minorRow)\n }\n }\n\n return result\n}\n","import { determinant } from './determinant'\nimport { minor } from './minor'\n\nexport function adjugate(matrix: number[][]): number[][] {\n const n = matrix.length\n const adj: number[][] = []\n for (let i = 0; i < n; i++) {\n adj[i] = []\n for (let j = 0; j < n; j++) {\n const min = minor(matrix, j, i)\n const sign = (-1) ** (i + j)\n const cofactor = sign * determinant(min)\n adj[i]![j] = cofactor\n }\n }\n return adj\n}\n","export function isSquare(matrix: number[][]): boolean {\n return matrix.length === matrix[0]!.length\n}\n","import { approxEqual, approxZero } from '../../../../utils'\nimport { isSquare } from './isSquare'\n\nexport function isIdentity(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n const n = matrix.length\n\n for (let i = 0; i < n; i++) {\n for (let j = 0; j < n; j++) {\n if (i === j) {\n if (!approxEqual(matrix[i]![j]!, 1)) {\n return false\n }\n }\n else {\n if (!approxZero(matrix[i]![j]!)) {\n return false\n }\n }\n }\n }\n\n return true\n}\n","/**\n * Performs cache-optimized matrix multiplication.\n * @param A The first input matrix (m x n)\n * @param B The second input matrix (n x p)\n * @returns The result matrix C (m x p) where C = A × B\n */\nexport function matrixMultiply(A: number[][], B: number[][]): number[][] {\n // Check if matrices can be multiplied\n if (A.length === 0 || B.length === 0 || A[0]!.length !== B.length) {\n throw new Error('Matrix dimensions do not match for multiplication')\n }\n\n const m = A.length // Number of rows in A\n const n = A[0]!.length // Number of columns in A / Number of rows in B\n const p = B[0]!.length // Number of columns in B\n\n // Initialize result matrix C with zeros\n const C: number[][] = (Array(m).fill(0) as number[]).map(() => Array(p).fill(0) as number[])\n\n // Perform multiplication with cache-optimized loop order (i-k-j)\n for (let i = 0; i < m; i++) {\n for (let k = 0; k < n; k++) {\n const aik = A[i]![k]! // Cache this value to avoid repeated lookups\n for (let j = 0; j < p; j++) {\n C[i]![j]! += aik * B[k]![j]!\n }\n }\n }\n\n return C\n}\n","import { DvalaError } from '../../../errors'\nimport { assertMatrix, assertSquareMatrix, assertVector, isSquareMatrix } from '../../../typeGuards/annotatedArrays'\nimport { assertNumber } from '../../../typeGuards/number'\nimport { approxZero } from '../../../utils'\nimport { toFixedArity } from '../../../utils/arity'\nimport type { BuiltinNormalExpressions } from '../../../builtin/interface'\nimport type { DvalaModule } from '../interface'\nimport { gaussJordanElimination } from '../linear-algebra/helpers/gaussJordanElimination'\nimport { moduleDocs } from './docs'\nimport { adjugate } from './helpers/adjugate'\nimport { band } from './helpers/band'\nimport { cofactor } from './helpers/cofactor'\nimport { determinant } from './helpers/determinant'\nimport { inverse } from './helpers/inverse'\nimport { isBanded } from './helpers/isBanded'\nimport { isDiagonal } from './helpers/isDiagonal'\nimport { isIdentity } from './helpers/isIdentity'\nimport { isOrthogonal } from './helpers/isOrthogonal'\nimport { isSquare } from './helpers/isSquare'\nimport { isSymetric } from './helpers/isSymetric'\nimport { isTriangular, isTriangularLower, isTriangularUpper } from './helpers/isTriangular'\nimport { matrixMultiply } from './helpers/matrixMultiply'\nimport { minor } from './helpers/minor'\nimport { norm1 } from './helpers/norm1'\nimport { trace } from './helpers/trace'\n\nexport const matrixNormalExpression: BuiltinNormalExpressions = {\n 'mul': {\n evaluate: ([matrix1, matrix2], sourceCodeInfo): number[][] => {\n assertMatrix(matrix1, sourceCodeInfo)\n assertMatrix(matrix2, sourceCodeInfo)\n try {\n return matrixMultiply(matrix1, matrix2)\n }\n catch (error) {\n throw new DvalaError(`The number of columns in the first matrix must be equal to the number of rows in the second matrix, but got ${matrix1[0]!.length} and ${matrix2.length}`, sourceCodeInfo)\n }\n },\n arity: toFixedArity(2),\n },\n 'det': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n return determinant(matrix)\n },\n arity: toFixedArity(1),\n },\n 'inv': {\n evaluate: ([matrix], sourceCodeInfo): number[][] => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n const result = inverse(matrix)\n if (result === null) {\n throw new DvalaError('The matrix must be invertible', sourceCodeInfo)\n }\n return result\n },\n arity: toFixedArity(1),\n },\n 'adj': {\n evaluate: ([matrix], sourceCodeInfo): number[][] => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n return adjugate(matrix)\n },\n arity: toFixedArity(1),\n },\n 'cofactor': {\n evaluate: ([matrix], sourceCodeInfo): number[][] => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n return cofactor(matrix)\n },\n arity: toFixedArity(1),\n },\n 'minor': {\n evaluate: ([matrix, row, col], sourceCodeInfo): number[][] => {\n assertMatrix(matrix, sourceCodeInfo)\n assertNumber(row, sourceCodeInfo, { integer: true, nonNegative: true, lte: matrix.length })\n assertNumber(col, sourceCodeInfo, { integer: true, nonNegative: true, lte: matrix[0]!.length })\n\n return minor(matrix, row, col)\n },\n arity: toFixedArity(3),\n },\n 'trace': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertSquareMatrix(matrix, sourceCodeInfo)\n return trace(matrix)\n },\n arity: toFixedArity(1),\n },\n 'symmetric?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isSymetric(matrix)\n },\n arity: toFixedArity(1),\n },\n 'triangular?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isTriangular(matrix)\n },\n arity: toFixedArity(1),\n },\n 'upper-triangular?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isTriangularUpper(matrix)\n },\n arity: toFixedArity(1),\n },\n 'lower-triangular?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isTriangularLower(matrix)\n },\n arity: toFixedArity(1),\n },\n 'diagonal?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isDiagonal(matrix)\n },\n arity: toFixedArity(1),\n },\n 'square?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isSquare(matrix)\n },\n arity: toFixedArity(1),\n },\n 'orthogonal-matrix?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isOrthogonal(matrix)\n },\n arity: toFixedArity(1),\n },\n 'identity?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n return isIdentity(matrix)\n },\n arity: toFixedArity(1),\n },\n 'invertible?': {\n evaluate: ([matrix], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n if (!isSquareMatrix(matrix)) {\n return false\n }\n return !approxZero(determinant(matrix))\n },\n arity: toFixedArity(1),\n },\n 'hilbert': {\n evaluate: ([size], sourceCodeInfo): number[][] => {\n assertNumber(size, sourceCodeInfo, { integer: true, positive: true })\n const result: number[][] = []\n for (let i = 0; i < size; i += 1) {\n const row: number[] = []\n for (let j = 0; j < size; j += 1) {\n row.push(1 / (i + j + 1))\n }\n result.push(row)\n }\n return result\n },\n arity: toFixedArity(1),\n },\n 'vandermonde': {\n evaluate: ([vector], sourceCodeInfo): number[][] => {\n assertVector(vector, sourceCodeInfo)\n const result: number[][] = []\n for (let i = 0; i < vector.length; i += 1) {\n const row: number[] = []\n for (let j = 0; j < vector.length; j += 1) {\n row.push((vector[i]!) ** j)\n }\n result.push(row)\n }\n return result\n },\n arity: toFixedArity(1),\n },\n 'band': {\n evaluate: ([n, lband, uband], sourceCodeInfo): number[][] => {\n assertNumber(n, sourceCodeInfo, { integer: true, positive: true })\n assertNumber(lband, sourceCodeInfo, { integer: true, nonNegative: true, lt: n })\n assertNumber(uband, sourceCodeInfo, { integer: true, nonNegative: true, lte: n })\n return band(n, lband, uband)\n },\n arity: toFixedArity(3),\n },\n 'banded?': {\n evaluate: ([matrix, lband, uband], sourceCodeInfo): boolean => {\n assertMatrix(matrix, sourceCodeInfo)\n const maxBand = Math.max(matrix.length, matrix[0]!.length)\n assertNumber(lband, sourceCodeInfo, { integer: true, nonNegative: true, lt: maxBand })\n assertNumber(uband, sourceCodeInfo, { integer: true, nonNegative: true, lt: maxBand })\n return isBanded(matrix, lband, uband)\n },\n arity: toFixedArity(3),\n },\n 'rank': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertMatrix(matrix, sourceCodeInfo)\n const [, result] = gaussJordanElimination(matrix)\n return result\n },\n arity: toFixedArity(1),\n },\n // Frobenius norm\n 'frobenius-norm': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertMatrix(matrix, sourceCodeInfo)\n return Math.sqrt(matrix.reduce((sum, row) => sum + row.reduce((rowSum, cell) => rowSum + cell * cell, 0), 0))\n },\n arity: toFixedArity(1),\n },\n // one-norm (column norm)\n 'one-norm': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertMatrix(matrix, sourceCodeInfo)\n return norm1(matrix)\n },\n arity: toFixedArity(1),\n },\n // Infinity norm\n 'inf-norm': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertMatrix(matrix, sourceCodeInfo)\n return matrix.reduce((max, row) => Math.max(max, row.reduce((sum, cell) => sum + Math.abs(cell), 0)), 0)\n },\n arity: toFixedArity(1),\n },\n // Max norm\n 'max-norm': {\n evaluate: ([matrix], sourceCodeInfo): number => {\n assertMatrix(matrix, sourceCodeInfo)\n return matrix.reduce((maxVal, row) => {\n const rowMax = row.reduce((max, val) => Math.max(max, Math.abs(val)), 0)\n return Math.max(maxVal, rowMax)\n }, 0)\n },\n arity: toFixedArity(1),\n },\n}\n\nfor (const [key, docs] of Object.entries(moduleDocs)) {\n if (matrixNormalExpression[key])\n matrixNormalExpression[key].docs = docs\n}\n\nexport const matrixModule: DvalaModule = {\n name: 'matrix',\n functions: matrixNormalExpression,\n}\n","/**\n * Calculate the inverse of a matrix using the adjugate method\n * @param matrix The input matrix\n * @returns The inverse matrix or null if the matrix is not invertible\n */\n\nimport { approxZero } from '../../../../utils'\nimport { adjugate } from './adjugate'\nimport { determinant } from './determinant'\n\nexport function inverse(matrix: number[][]): number[][] | null {\n const n = matrix.length\n\n // Special case for 1x1 matrix - handle it directly\n if (n === 1) {\n const element = matrix[0]![0]!\n if (approxZero(element)) {\n return null // Not invertible\n }\n return [[1 / element]]\n }\n\n // Calculate determinant\n const det = determinant(matrix)\n\n // Check if matrix is invertible\n if (approxZero(det)) {\n return null // Matrix is not invertible\n }\n\n // Get the adjugate matrix\n const adj = adjugate(matrix)\n\n // Calculate the inverse: inverse = adjugate / determinant\n const inverseMatrix: number[][] = []\n for (let i = 0; i < n; i++) {\n inverseMatrix[i] = []\n for (let j = 0; j < n; j++) {\n inverseMatrix[i]![j] = adj[i]![j]! / det\n }\n }\n\n return inverseMatrix\n}\n","import { determinant } from './determinant'\nimport { minor } from './minor'\n\nexport function cofactor(matrix: number[][]): number[][] {\n const n = matrix.length\n const cofactors: number[][] = []\n\n // Create a new matrix to store cofactors\n for (let i = 0; i < n; i++) {\n cofactors[i] = []\n for (let j = 0; j < n; j++) {\n // Get the minor by removing row i and column j\n const min = minor(matrix, i, j)\n const sign = (-1) ** (i + j)\n cofactors[i]![j] = sign * determinant(min)\n }\n }\n\n return cofactors\n}\n","/**\n * Calculates the trace of a square matrix.\n * The trace is defined as the sum of the elements on the main diagonal.\n *\n * @param matrix - A 2D array representing a square matrix.\n * @returns The trace of the matrix.\n */\nexport function trace(matrix: number[][]): number {\n return matrix.reduce((sum, row, i) => sum + row[i]!, 0)\n}\n","import { isSquare } from './isSquare'\n\n/**\n * Checks if a given matrix is symmetric.\n * A matrix is symmetric if it is square and its transpose is equal to itself.\n *\n * @param matrix - A 2D array representing the matrix.\n * @returns `true` if the matrix is symmetric, otherwise `false`.\n */\nexport function isSymetric(matrix: number[][]): boolean {\n const rows = matrix.length\n\n // Check if the matrix is square\n if (!isSquare(matrix)) {\n return false\n }\n\n // Check symmetry\n for (let i = 0; i < rows; i += 1) {\n for (let j = 0; j < i; j += 1) {\n if (matrix[i]![j]! !== matrix[j]![i]!) {\n return false\n }\n }\n }\n\n return true\n}\n","import { isSquare } from './isSquare'\n\n/**\n * Determines whether a given matrix is triangular.\n *\n * A triangular matrix is a square matrix where all elements\n * below or above the main diagonal are zero. This function\n * checks if the matrix is square and symmetric.\n *\n * @param matrix - A two-dimensional array of numbers representing the matrix.\n * @returns `true` if the matrix is triangular, otherwise `false`.\n */\nexport function isTriangular(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n\n const rows = matrix.length\n\n let isUpperTriangular = true\n let isLowerTriangular = true\n\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < rows; j++) {\n if (i > j && matrix[i]![j] !== 0) {\n isUpperTriangular = false\n if (!isLowerTriangular) {\n return false\n }\n }\n if (i < j && matrix[i]![j] !== 0) {\n isLowerTriangular = false\n }\n }\n }\n\n return isUpperTriangular || isLowerTriangular\n}\n\nexport function isTriangularUpper(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n const rows = matrix.length\n\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < i; j++) {\n if (matrix[i]![j] !== 0) {\n return false\n }\n }\n }\n\n return true\n}\n\nexport function isTriangularLower(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n const rows = matrix.length\n\n // Check if the matrix is square\n if (!matrix.every(row => row.length === rows)) {\n return false\n }\n\n for (let i = 0; i < rows; i++) {\n for (let j = i + 1; j < rows; j++) {\n if (matrix[i]![j] !== 0) {\n return false\n }\n }\n }\n\n return true\n}\n","import { isSquare } from './isSquare'\n\n/**\n * Checks if a given matrix is diagonal.\n *\n * A matrix is considered diagonal if it is square (i.e., the number of rows equals the number of columns)\n * and all elements outside the main diagonal are zero.\n *\n * @param matrix - A two-dimensional array of numbers representing the matrix to check.\n * @returns `true` if the matrix is diagonal, otherwise `false`.\n */\nexport function isDiagonal(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n const rows = matrix.length\n\n for (let i = 0; i < rows; i += 1) {\n for (let j = 0; j < rows; j += 1) {\n if (i !== j && matrix[i]![j] !== 0) {\n return false\n }\n }\n }\n\n return true\n}\n","import { transpose } from '../../../modules/grid/transpose'\nimport { matrixMultiply } from './matrixMultiply'\nimport { isIdentity } from './isIdentity'\nimport { isSquare } from './isSquare'\n\nexport function isOrthogonal(matrix: number[][]): boolean {\n if (!isSquare(matrix)) {\n return false\n }\n\n // Calculate matrix transpose\n const transposed = transpose(matrix)\n\n // Check if matrix * transpose = Identity\n const product = matrixMultiply(matrix, transposed)\n\n // Check if the product is an identity matrix\n return isIdentity(product)\n}\n","import type { Any } from '../../../interface'\n\nexport function transpose<T extends Any>(grid: T[][]): T[][] {\n const result: T[][] = []\n\n for (let i = 0; i < grid[0]!.length; i += 1) {\n const row: T[] = []\n for (let j = 0; j < grid.length; j += 1) {\n row.push(grid[j]![i]!)\n }\n result.push(row)\n }\n return result\n}\n","/**\n * Creates a band matrix with specified lower and upper bandwidths\n *\n * @param n Size of the square matrix\n * @param lband Lower bandwidth (number of non-zero diagonals below main diagonal)\n * @param uband Upper bandwidth (number of non-zero diagonals above main diagonal)\n * @returns A 2D array representing the band matrix with 1s in the band and 0s elsewhere\n */\nexport function band(n: number, lband: number, uband: number): number[][] {\n // Create an n×n matrix filled with zeros\n const matrix: number[][] = Array.from({ length: n }, () => Array.from({ length: n }, () => 0))\n\n // Fill the band with 1s\n for (let i = 0; i < n; i++) {\n for (let j = Math.max(0, i - lband); j <= Math.min(n - 1, i + uband); j++) {\n matrix[i]![j] = 1\n }\n }\n\n return matrix\n}\n","/**\n * Checks if a matrix is banded with the given lower and upper bandwidth.\n * A matrix is banded if all non-zero elements are within 'lower' diagonals\n * below the main diagonal and 'upper' diagonals above the main diagonal.\n *\n * @param matrix - The matrix to check, represented as a 2D array of numbers\n * @param lower - Number of non-zero diagonals below the main diagonal\n * @param upper - Number of non-zero diagonals above the main diagonal\n * @returns true if the matrix is banded with the given parameters, false otherwise\n */\nexport function isBanded(matrix: number[][], lower: number, upper: number): boolean {\n const rows = matrix.length\n const cols = matrix[0]!.length\n\n // Check each element in the matrix\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < cols; j++) {\n // If we find a non-zero element outside the band, return false\n if (matrix[i]![j] !== 0 && (i - j > lower || j - i > upper)) {\n return false\n }\n }\n }\n\n // All elements outside the band are zero\n return true\n}\n","import { approxZero } from '../../../../utils'\n\n/**\n * Performs Gauss-Jordan elimination on a matrix, transforming it to reduced row echelon form\n *\n * @param matrix - The input matrix\n * @returns A tuple containing the reduced row echelon form matrix and the rank\n */\nexport function gaussJordanElimination(matrix: number[][]): [number[][], number] {\n // Create a copy of the matrix to avoid modifying the original\n const m = matrix.map(row => [...row])\n const rows = m.length\n const cols = m[0]!.length\n\n let rank = 0\n let rowsProcessed = 0\n\n // Row reduction to reduced row echelon form\n for (let col = 0; col < cols; col++) {\n // Find the pivot\n let pivotRow = -1\n\n for (let row = rowsProcessed; row < rows; row++) {\n if (!approxZero(m[row]![col]!)) {\n pivotRow = row\n break\n }\n }\n\n if (pivotRow === -1)\n continue // No pivot in this column\n\n // Increase rank\n rank += 1\n\n // Swap rows\n if (pivotRow !== rowsProcessed) {\n [m[pivotRow], m[rowsProcessed]] = [m[rowsProcessed]!, m[pivotRow]!]\n }\n\n // Get the pivot value\n const pivotValue = m[rowsProcessed]![col]!\n\n // Normalize the pivot row (always, for RREF)\n for (let j = col; j < cols; j++) {\n m[rowsProcessed]![j]! /= pivotValue\n }\n\n // Eliminate above and below (full Gauss-Jordan)\n for (let row = 0; row < rows; row++) {\n if (row !== rowsProcessed && !approxZero(m[row]![col]!)) {\n const factor = m[row]![col]!\n for (let j = col; j < cols; j++) {\n m[row]![j]! -= factor * m[rowsProcessed]![j]!\n }\n }\n }\n\n rowsProcessed++\n if (rowsProcessed === rows)\n break\n }\n\n return [m, rank]\n}\n","// Assuming a matrix is represented as a 2D array\nexport function norm1(matrix: number[][]): number {\n const numRows = matrix.length\n const numCols = matrix[0]!.length\n\n let maxColSum = 0\n\n // Iterate through each column\n for (let j = 0; j < numCols; j += 1) {\n let colSum = 0\n\n // Sum the absolute values of all elements in this column\n for (let i = 0; i < numRows; i += 1) {\n colSum += Math.abs(matrix[i]![j]!)\n }\n\n // Update the maximum column sum if necessary\n maxColSum = Math.max(maxColSum, colSum)\n }\n\n return maxColSum\n}\n"],"names":["getCodeMarker","sourceCodeInfo","position","code","leftPadding","column","rightPadding","length","repeat","Math","max","DvalaError","Error","shortMessage","constructor","err","message","super","location","line","filePath","getDvalaErrorMessage","this","Object","setPrototypeOf","prototype","name","NodeTypes","Number","String","NormalExpression","SpecialExpression","UserDefinedSymbol","NormalBuiltinSymbol","SpecialBuiltinSymbol","ReservedSymbol","Binding","Spread","NodeTypesSet","Set","values","functionTypeSet","isDvalaFunction","func","type","functionType","has","isNode","value","Array","isArray","valueToString","keys","find","key","RegExp","toString","JSON","stringify","isNumber","options","isNaN","integer","isInteger","finite","isFinite","zero","nonZero","positive","negative","nonPositive","nonNegative","gt","gte","lt","lte","assertNumber","sign","getSignString","numberType","range","getRangeString","filter","x","join","getNumberTypeName","anyValue","getSourceCodeInfo","annotatedArrays","WeakSet","vectors","notVectors","matrices","notMatrices","grids","assertVector","vector","every","elem","add","isVector","isMatrix","matrix","nbrOfCols","row","some","cell","assertMatrix","assertSquareMatrix","approxEqual","a","b","epsilon","diff","abs","approxZero","toFixedArity","arity","min","moduleDocs","mul","category","description","returns","args","variants","argumentNames","examples","seeAlso","det","m","inv","adj","cofactor","minor","col","trace","hilbert","n","vandermonde","v","band","lband","uband","rank","determinant","A","i","maxRow","j","factor","k","result","minorRow","push","adjugate","isSquare","isIdentity","matrixMultiply","B","p","C","fill","map","aik","matrixNormalExpression","evaluate","matrix1","matrix2","error","element","inverseMatrix","inverse","cofactors","reduce","sum","rows","isSymetric","isUpperTriangular","isLowerTriangular","isTriangular","isTriangularUpper","isTriangularLower","isDiagonal","grid","transpose","isOrthogonal","isSquareMatrix","size","from","maxBand","lower","upper","cols","isBanded","rowsProcessed","pivotRow","pivotValue","gaussJordanElimination","sqrt","rowSum","numRows","numCols","maxColSum","colSum","norm1","maxVal","rowMax","val","docs","entries","matrixModule","functions"],"mappings":"AAEM,SAAUA,EAAcC,GAC5B,IAAKA,EAAeC,WAAaD,EAAeE,KAC9C,MAAO,GAET,MAAMC,EAAcH,EAAeC,SAASG,OAAS,EAC/CC,EAAeL,EAAeE,KAAKI,OAASH,EAAc,EAChE,MAAO,GAAG,IAAII,OAAOC,KAAKC,IAAIN,EAAa,OAAO,IAAII,OAAOC,KAAKC,IAAIJ,EAAc,KACtF,CCkBM,MAAOK,UAAmBC,MACdX,eACAY,aAChB,WAAAC,CAAYC,EAAcd,GACxB,MAAMe,EAAUD,aAAeH,MAC3BG,EAAIC,QACJ,GAAGD,IAEPE,MA/BJ,SAA8BD,EAAiBf,GAC7C,IAAKA,EACH,OAAOe,EAET,MAAME,EAAW,GAAGjB,EAAeC,SAASiB,QAAQlB,EAAeC,SAASG,SAM5E,MAAO,GAAGW,IALWf,EAAemB,SAChC,KAAKnB,EAAemB,YAAYF,IAChC,cAAcA,QACIjB,EAAeE,SACbH,EAAcC,IAExC,CAoBUoB,CAAqBL,EAASf,IACpCqB,KAAKT,aAAeG,EACpBM,KAAKrB,eAAiBA,EACtBsB,OAAOC,eAAeF,KAAMX,EAAWc,WACvCH,KAAKI,KAAO,YACb,CAEM,aAAA1B,GACL,OAAOsB,KAAKrB,gBAAkBD,EAAcsB,KAAKrB,eAClD,EC5CI,MAAM0B,EAAY,CACvBC,OAAQ,EACRC,OAAQ,EACRC,iBAAkB,EAClBC,kBAAmB,EACnBC,kBAAmB,EACnBC,oBAAqB,EACrBC,qBAAsB,EACtBC,eAAgB,EAChBC,QAAS,EACTC,OAAQ,IAGJC,EAAe,IAAIC,IAAIhB,OAAOiB,OAAOb,IAa3C,MAgBMc,EAAkB,IAAIF,IAhBN,CACpB,cACA,UACA,OACA,aACA,OACA,aACA,YACA,WACA,QAC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AG1B,MAAAE,EAA4B,CACvCzL,KAAM,SACN0L,UAAW/C"}
@@ -0,0 +1,2 @@
1
+ "use strict";function t(t){if(!t.position||!t.code)return"";const e=t.position.column-1,r=t.code.length-e-1;return`${" ".repeat(Math.max(e,0))}^${" ".repeat(Math.max(r,0))}`}class e extends Error{sourceCodeInfo;shortMessage;constructor(r,a){const n=r instanceof Error?r.message:`${r}`;super(function(e,r){if(!r)return e;const a=`${r.position.line}:${r.position.column}`;return`${e}${r.filePath?`\n${r.filePath}:${a}`:`\nLocation ${a}`}\n${r.code}\n${t(r)}`}(n,a)),this.shortMessage=n,this.sourceCodeInfo=a,Object.setPrototypeOf(this,e.prototype),this.name="DvalaError"}getCodeMarker(){return this.sourceCodeInfo&&t(this.sourceCodeInfo)}}const r={Number:1,String:2,NormalExpression:3,SpecialExpression:4,UserDefinedSymbol:5,NormalBuiltinSymbol:6,SpecialBuiltinSymbol:7,ReservedSymbol:8,Binding:9,Spread:10},a=new Set(Object.values(r));const n=new Set(["UserDefined","Partial","Comp","Constantly","Juxt","Complement","EveryPred","SomePred","Fnull","Builtin","SpecialBuiltin","NativeJsFunction","Module"]);function i(t){return null!==t&&"object"==typeof t&&("^^fn^^"in t&&"functionType"in t&&("string"==typeof(e=t.functionType)&&n.has(e)));var e}function o(t){return!(!Array.isArray(t)||t.length<2)&&("number"==typeof(e=t[0])&&a.has(e));var e}function m(t){return i(t)?`<function ${t.name||"λ"}>`:o(t)?`${e=t[0],Object.keys(r).find(t=>r[t]===e)}-node`:null===t?"null":"object"==typeof t&&t instanceof RegExp?`${t}`:"object"==typeof t&&t instanceof Error?t.toString():JSON.stringify(t);var e}function l(t,e={}){return"number"==typeof t&&(!Number.isNaN(t)&&(!(e.integer&&!Number.isInteger(t))&&(!(e.finite&&!Number.isFinite(t))&&((!e.zero||0===t)&&((!e.nonZero||0!==t)&&(!(e.positive&&t<=0)&&(!(e.negative&&t>=0)&&(!(e.nonPositive&&t>0)&&(!(e.nonNegative&&t<0)&&(!("number"==typeof e.gt&&t<=e.gt)&&(!("number"==typeof e.gte&&t<e.gte)&&(!("number"==typeof e.lt&&t>=e.lt)&&!("number"==typeof e.lte&&t>e.lte)))))))))))))}function s(t,r,a={}){if(!l(t,a))throw new e(`Expected ${function(t){if(t.zero)return"zero";const e=function(t){return t.positive?"positive":t.negative?"negative":t.nonNegative?"non negative":t.nonPositive?"non positive":t.nonZero?"non zero":""}(t),r=t.integer?"integer":"number",a=t.finite?"finite":"",n=function(t){return"number"!=typeof t.gt&&"number"!=typeof t.gte||"number"!=typeof t.lt&&"number"!=typeof t.lte?"number"==typeof t.gt||"number"==typeof t.gte?"number"==typeof t.gt?`n > ${t.gt}`:`n >= ${t.gte}`:"number"==typeof t.lt||"number"==typeof t.lte?"number"==typeof t.lt?`n < ${t.lt}`:`n <= ${t.lte}`:"":`${"number"==typeof t.gt?`${t.gt} < n `:`${t.gte} <= n `}${"number"==typeof t.lt?`< ${t.lt}`:`<= ${t.lte}`}`}(t);return[e,a,r,n].filter(t=>!!t).join(" ")}(a)}, got ${m(t)}.`,function(t,e){return t?.sourceCodeInfo??e}(t,r))}const u=new WeakSet,c=new WeakSet,x=new WeakSet,p=new WeakSet,f=new WeakSet,d=new WeakSet;function g(t,r){if(!function(t){return!(!Array.isArray(t)||!c.has(t)&&(x.has(t)||(t.every(t=>l(t))?(u.add(t),c.add(t),0):(x.add(t),1))))}(t))throw new e(`Expected a vector, but got ${t}`,r)}function h(t){if(!Array.isArray(t))return!1;if(p.has(t))return!0;if(f.has(t))return!1;if(0===t.length)return f.add(t),!1;if(!Array.isArray(t[0])||0===t[0].length)return f.add(t),!1;const e=t[0].length;for(const r of t)if(!Array.isArray(r)||r.length!==e||r.some(t=>!l(t)))return f.add(t),!1;return u.add(t),d.add(t),p.add(t),!0}function y(t,r){if(!h(t))throw new e(`Expected a matrix, but got ${t}`,r)}function b(t,r){if(!h(t))throw new e(`Expected a matrix, but got ${t}`,r);if(t.length!==t[0].length)throw new e(`Expected square matrix, but got ${t.length} and ${t[0].length}`,r)}function v(t,e,r=1e-10){if(t===e)return!0;const a=Math.abs(t-e);if(0===t||0===e||a<r)return a<r;return a/(Math.abs(t)+Math.abs(e))<r}function w(t){return Math.abs(t)<1e-10}function N(t){return{min:t,max:t}}const k={mul:{category:"matrix",description:"Multiplies two `matrices` using standard `matrix` multiplication based on **dot products** of rows and columns.",returns:{type:"matrix"},args:{a:{type:"matrix"},b:{type:"matrix"}},variants:[{argumentNames:["a","b"]}],examples:["let { mul } = import(matrix);\nmul([[1, 2], [3, 4]], [[5, 6], [7, 8]])","let { mul } = import(matrix);\nmul([[1, 2, 3], [4, 5, 6]], [[7, 8], [9, 10], [11, 12]])"],seeAlso:["matrix.det","matrix.inv"]},det:{category:"matrix",description:"Calculates the **determinant** of a square matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the determinant of."}},variants:[{argumentNames:["m"]}],examples:["let { det } = import(matrix);\ndet([[1, 2], [3, 4]])","let { det } = import(matrix);\ndet([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.inv","matrix.cofactor","matrix.adj","matrix.trace","matrix.rank","matrix.invertible?","matrix.mul","matrix.minor"]},inv:{category:"matrix",description:"Calculates the **inverse** of a square matrix.",returns:{type:"matrix"},args:{m:{type:"matrix",description:"The `matrix` to calculate the inverse of."}},variants:[{argumentNames:["m"]}],examples:["let { inv } = import(matrix);\ninv([[1, 2], [3, 4]])","let { inv } = import(matrix);\ninv([[1, 2, 3], [4, 5, 7], [7, 8, 10]])"],seeAlso:["matrix.det","matrix.adj","matrix.invertible?","linear-algebra.solve","matrix.mul","matrix.orthogonal-matrix?"]},adj:{category:"matrix",description:"Calculates the **adjugate** of a square matrix.",returns:{type:"matrix"},args:{m:{type:"matrix",description:"The `matrix` to calculate the adjugate of."}},variants:[{argumentNames:["m"]}],examples:["let { adj } = import(matrix);\nadj([[1, 2], [3, 4]])","let { adj } = import(matrix);\nadj([[1, 2, 3], [4, 5, 6], [7, 8, 9]])","let { adj } = import(matrix);\nadj([[1, 2, 3], [7, 8, 9], [4, 5, 6]])"],seeAlso:["matrix.cofactor","matrix.det","matrix.inv"]},cofactor:{category:"matrix",description:"Calculates the **cofactor** of a square matrix.",returns:{type:"matrix"},args:{m:{type:"matrix",description:"The `matrix` to calculate the cofactor of."}},variants:[{argumentNames:["m"]}],examples:["let { cofactor } = import(matrix);\ncofactor([[1, 2], [3, 4]])","let { cofactor } = import(matrix);\ncofactor([[1, 2, 3], [4, 5, 6], [7, 8, 9]])","let { cofactor } = import(matrix);\ncofactor([[1, 2, 3], [7, 8, 9], [4, 5, 6]])"],seeAlso:["matrix.adj","matrix.minor","matrix.det"]},minor:{category:"matrix",description:"Calculates the **minor** of a square matrix.",returns:{type:"matrix"},args:{m:{type:"matrix",description:"The `matrix` to calculate the minor of."},row:{type:"integer",description:"The row index of the element to calculate the minor for."},col:{type:"integer",description:"The column index of the element to calculate the minor for."}},variants:[{argumentNames:["m","row","col"]}],examples:["let { minor } = import(matrix);\nminor([[1, 2], [3, 4]], 0, 1)","let { minor } = import(matrix);\nminor([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1)"],seeAlso:["matrix.cofactor","matrix.det"]},trace:{category:"matrix",description:"Calculates the **trace** of a square matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the trace of."}},variants:[{argumentNames:["m"]}],examples:["let { trace } = import(matrix);\ntrace([[1, 2], [3, 4]])","let { trace } = import(matrix);\ntrace([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.det","matrix.diagonal?"]},"symmetric?":{category:"matrix",description:"Checks if a `matrix` is **symmetric**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for symmetry."}},variants:[{argumentNames:["m"]}],examples:["let { symmetric? } = import(matrix);\nsymmetric?([[1, 2], [2, 1]])","let { symmetric? } = import(matrix);\nsymmetric?([[1, 2, 3], [2, 1, 4], [3, 4, 1]])"],seeAlso:["matrix.orthogonal-matrix?","matrix.diagonal?","matrix.square?","matrix.hilbert"]},"triangular?":{category:"matrix",description:"Checks if a `matrix` is **triangular**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for triangularity."}},variants:[{argumentNames:["m"]}],examples:["let { triangular? } = import(matrix);\ntriangular?([[2, 0], [0, 1]])","let { triangular? } = import(matrix);\ntriangular?([[1, 2, 3], [0, 4, 5], [0, 0, 6]])"],seeAlso:["matrix.upper-triangular?","matrix.lower-triangular?","matrix.diagonal?","matrix.banded?"]},"upper-triangular?":{category:"matrix",description:"Checks if a `matrix` is **upper triangular**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for upper triangularity."}},variants:[{argumentNames:["m"]}],examples:["let { upper-triangular? } = import(matrix);\nupper-triangular?([[1, 2], [0, 3]])","let { upper-triangular? } = import(matrix);\nupper-triangular?([[1, 2, 3], [0, 4, 5], [0, 0, 6]])"],seeAlso:["matrix.lower-triangular?","matrix.triangular?","matrix.diagonal?"]},"lower-triangular?":{category:"matrix",description:"Checks if a `matrix` is **lower triangular**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for lower triangularity."}},variants:[{argumentNames:["m"]}],examples:["let { lower-triangular? } = import(matrix);\nlower-triangular?([[1, 0], [2, 3]])","let { lower-triangular? } = import(matrix);\nlower-triangular?([[1, 0, 0], [2, 3, 0], [4, 5, 6]])"],seeAlso:["matrix.upper-triangular?","matrix.triangular?","matrix.diagonal?"]},"diagonal?":{category:"matrix",description:"Checks if a `matrix` is **diagonal**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for diagonal property."}},variants:[{argumentNames:["m"]}],examples:["let { diagonal? } = import(matrix);\ndiagonal?([[1, 0], [0, 2]])","let { diagonal? } = import(matrix);\ndiagonal?([[1, 0, 0], [0, 2, 0], [0, 0, 3]])","let { diagonal? } = import(matrix);\ndiagonal?([[1, 0, 0], [2, 2, 2], [0, 0, 3]])"],seeAlso:["matrix.identity?","matrix.symmetric?","matrix.triangular?","matrix.trace","matrix.upper-triangular?","matrix.lower-triangular?","matrix.band","matrix.banded?"]},"square?":{category:"matrix",description:"Checks if a `matrix` is **square**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for square property."}},variants:[{argumentNames:["m"]}],examples:["let { square? } = import(matrix);\nsquare?([[1, 2], [3, 4]])","let { square? } = import(matrix);\nsquare?([[1, 2, 3], [4, 5, 6], [7, 8, 9]])","let { square? } = import(matrix);\nsquare?([[1, 2, 3], [4, 5, 6]])"],seeAlso:["matrix.symmetric?","matrix.identity?","matrix.invertible?"]},"orthogonal-matrix?":{category:"matrix",description:"Checks if a `matrix` is **orthogonal**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for **orthogonality**."}},variants:[{argumentNames:["m"]}],examples:["let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 0], [0, 1]])","let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 0], [0, -1]])","let { orthogonal-matrix? } = import(matrix);\northogonal-matrix?([[1, 2], [3, 4]])"],seeAlso:["matrix.symmetric?","matrix.inv","matrix.identity?","linear-algebra.orthogonal?"]},"identity?":{category:"matrix",description:"Checks if a `matrix` is an **identity matrix**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for identity property."}},variants:[{argumentNames:["m"]}],examples:["let { identity? } = import(matrix);\nidentity?([[1, 0], [0, 1]])","let { identity? } = import(matrix);\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 1]])","let { identity? } = import(matrix);\nidentity?([[1, 0, 0], [0, 1, 0], [0, 0, 0]])"],seeAlso:["matrix.diagonal?","matrix.square?","matrix.orthogonal-matrix?"]},"invertible?":{category:"matrix",description:"Checks if a `matrix` is **invertible**.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for invertibility."}},variants:[{argumentNames:["m"]}],examples:["let { invertible? } = import(matrix);\ninvertible?([[1, 2], [3, 4]])","let { invertible? } = import(matrix);\ninvertible?([[1, 2, 3], [4, 5, 6], [7, 8, 9]])","let { invertible? } = import(matrix);\ninvertible?([[1, 2], [2, 4]])"],seeAlso:["matrix.det","matrix.inv","matrix.rank","matrix.square?"]},hilbert:{category:"matrix",description:"Generates a **Hilbert matrix** of size `n`.",returns:{type:"matrix"},args:{n:{type:"integer",description:"The size of the Hilbert matrix."}},variants:[{argumentNames:["n"]}],examples:["let { hilbert } = import(matrix);\nhilbert(3)","let { hilbert } = import(matrix);\nhilbert(4)"],seeAlso:["matrix.vandermonde","matrix.symmetric?"]},vandermonde:{category:"matrix",description:"Generates a **Vandermonde matrix** from a vector.",returns:{type:"matrix"},args:{v:{type:"vector",description:"The vector to generate the Vandermonde matrix from."}},variants:[{argumentNames:["v"]}],examples:["let { vandermonde } = import(matrix);\nvandermonde([1, 2, 3])","let { vandermonde } = import(matrix);\nvandermonde([1, 0, 1])"],seeAlso:["matrix.hilbert","matrix.band"]},band:{category:"matrix",description:"Generates a **banded matrix** of size `n` with lower band index `lband` and upper band index `uband`.",returns:{type:"matrix"},args:{n:{type:"integer",description:"The size of the banded matrix."},lband:{type:"integer",description:"The lower band index."},uband:{type:"integer",description:"The upper band index."}},variants:[{argumentNames:["n","lband","uband"]}],examples:["let { band } = import(matrix);\nband(3, 1, 1)","let { band } = import(matrix);\nband(4, 1, 2)"],seeAlso:["matrix.banded?","matrix.diagonal?","matrix.vandermonde"]},"banded?":{category:"matrix",description:"Checks if a `matrix` is **banded** with lower band index `lband` and upper band index `uband`.",returns:{type:"boolean"},args:{m:{type:"matrix",description:"The `matrix` to check for **banded** property."},lband:{type:"integer",description:"The lower band index."},uband:{type:"integer",description:"The upper band index."}},variants:[{argumentNames:["m","lband","uband"]}],examples:["let { banded? } = import(matrix);\nbanded?([\n [1, 1, 1, 0],\n [1, 1, 1, 1],\n [1, 1, 1, 1],\n [0, 1, 1, 1],\n], 2, 2)","let { banded? } = import(matrix);\nbanded?([\n [1, 1, 1, 0],\n [1, 1, 1, 1],\n [1, 1, 1, 1],\n [0, 1, 1, 1],\n], 1, 1)"],seeAlso:["matrix.band","matrix.triangular?","matrix.diagonal?"]},rank:{category:"matrix",description:"Calculates the **rank** of a matrix using **Gaussian elimination**.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the rank of."}},variants:[{argumentNames:["m"]}],examples:["let { rank } = import(matrix);\nrank([[1, 0, 0], [0, 1, 0], [0, 0, 1]])","let { rank } = import(matrix);\nrank([[1, 2, 3], [4, 5, 6], [7, 8, 9]])","let { rank } = import(matrix);\nrank([[2, 4, 6], [3, 6, 9], [4, 8, 12]])"],seeAlso:["matrix.det","matrix.invertible?","linear-algebra.rref"]},"frobenius-norm":{category:"matrix",description:"Calculates the **Frobenius norm** of a matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the Frobenius norm of."}},variants:[{argumentNames:["m"]}],examples:["let { frobenius-norm } = import(matrix);\nfrobenius-norm([[1, 2], [3, 4]])","let { frobenius-norm } = import(matrix);\nfrobenius-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.one-norm","matrix.inf-norm","matrix.max-norm"]},"one-norm":{category:"matrix",description:"Calculates the **one-norm** (column norm) of a matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the one-norm of."}},variants:[{argumentNames:["m"]}],examples:["let { one-norm } = import(matrix);\none-norm([[1, 2], [3, 4]])","let { one-norm } = import(matrix);\none-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.frobenius-norm","matrix.inf-norm","matrix.max-norm"]},"inf-norm":{category:"matrix",description:"Calculates the **infinity norm** of a matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the infinity norm of."}},variants:[{argumentNames:["m"]}],examples:["let { inf-norm } = import(matrix);\ninf-norm([[1, 2], [3, 4]])","let { inf-norm } = import(matrix);\ninf-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.frobenius-norm","matrix.one-norm","matrix.max-norm"]},"max-norm":{category:"matrix",description:"Calculates the **max norm** of a matrix.",returns:{type:"number"},args:{m:{type:"matrix",description:"The `matrix` to calculate the max norm of."}},variants:[{argumentNames:["m"]}],examples:["let { max-norm } = import(matrix);\nmax-norm([[1, 2], [3, 4]])","let { max-norm } = import(matrix);\nmax-norm([[1, 2, 3], [4, 5, 6], [7, 8, 9]])"],seeAlso:["matrix.frobenius-norm","matrix.one-norm","matrix.inf-norm"]}};function A(t){const e=t.length,r=[];for(let a=0;a<e;a++)r[a]=[...t[a]];if(1===e)return r[0][0];if(2===e)return r[0][0]*r[1][1]-r[0][1]*r[1][0];let a=1;for(let t=0;t<e-1;t+=1){let n=t;for(let a=t+1;a<e;a+=1)Math.abs(r[a][t])>Math.abs(r[n][t])&&(n=a);if(w(r[n][t]))return 0;n!==t&&([r[t],r[n]]=[r[n],r[t]],a=-a);for(let a=t+1;a<e;a+=1){const n=r[a][t]/r[t][t];for(let i=t;i<e;i++)r[a][i]-=n*r[t][i]}}let n=a;for(let t=0;t<e;t++)n*=r[t][t];return n}function T(t,e,r){const a=t.length,n=[];for(let i=0;i<a;i++)if(i!==e){const e=[];for(let n=0;n<a;n++)n!==r&&e.push(t[i][n]);n.push(e)}return n}function $(t){const e=t.length,r=[];for(let a=0;a<e;a++){r[a]=[];for(let n=0;n<e;n++){const e=(-1)**(a+n)*A(T(t,n,a));r[a][n]=e}}return r}function C(t){return t.length===t[0].length}function M(t){if(!C(t))return!1;const e=t.length;for(let r=0;r<e;r++)for(let a=0;a<e;a++)if(r===a){if(!v(t[r][a],1))return!1}else if(!w(t[r][a]))return!1;return!0}function q(t,e){if(0===t.length||0===e.length||t[0].length!==e.length)throw new Error("Matrix dimensions do not match for multiplication");const r=t.length,a=t[0].length,n=e[0].length,i=Array(r).fill(0).map(()=>Array(n).fill(0));for(let o=0;o<r;o++)for(let r=0;r<a;r++){const a=t[o][r];for(let t=0;t<n;t++)i[o][t]+=a*e[r][t]}return i}const j={mul:{evaluate:([t,r],a)=>{y(t,a),y(r,a);try{return q(t,r)}catch(n){throw new e(`The number of columns in the first matrix must be equal to the number of rows in the second matrix, but got ${t[0].length} and ${r.length}`,a)}},arity:N(2)},det:{evaluate:([t],e)=>(b(t,e),A(t)),arity:N(1)},inv:{evaluate:([t],r)=>{b(t,r);const a=function(t){const e=t.length;if(1===e){const e=t[0][0];return w(e)?null:[[1/e]]}const r=A(t);if(w(r))return null;const a=$(t),n=[];for(let t=0;t<e;t++){n[t]=[];for(let i=0;i<e;i++)n[t][i]=a[t][i]/r}return n}(t);if(null===a)throw new e("The matrix must be invertible",r);return a},arity:N(1)},adj:{evaluate:([t],e)=>(b(t,e),$(t)),arity:N(1)},cofactor:{evaluate:([t],e)=>(b(t,e),function(t){const e=t.length,r=[];for(let a=0;a<e;a++){r[a]=[];for(let n=0;n<e;n++){const e=T(t,a,n),i=(-1)**(a+n);r[a][n]=i*A(e)}}return r}(t)),arity:N(1)},minor:{evaluate:([t,e,r],a)=>(y(t,a),s(e,a,{integer:!0,nonNegative:!0,lte:t.length}),s(r,a,{integer:!0,nonNegative:!0,lte:t[0].length}),T(t,e,r)),arity:N(3)},trace:{evaluate:([t],e)=>(b(t,e),function(t){return t.reduce((t,e,r)=>t+e[r],0)}(t)),arity:N(1)},"symmetric?":{evaluate:([t],e)=>(y(t,e),function(t){const e=t.length;if(!C(t))return!1;for(let r=0;r<e;r+=1)for(let e=0;e<r;e+=1)if(t[r][e]!==t[e][r])return!1;return!0}(t)),arity:N(1)},"triangular?":{evaluate:([t],e)=>(y(t,e),function(t){if(!C(t))return!1;const e=t.length;let r=!0,a=!0;for(let n=0;n<e;n++)for(let i=0;i<e;i++){if(n>i&&0!==t[n][i]&&(r=!1,!a))return!1;n<i&&0!==t[n][i]&&(a=!1)}return r||a}(t)),arity:N(1)},"upper-triangular?":{evaluate:([t],e)=>(y(t,e),function(t){if(!C(t))return!1;const e=t.length;for(let r=0;r<e;r++)for(let e=0;e<r;e++)if(0!==t[r][e])return!1;return!0}(t)),arity:N(1)},"lower-triangular?":{evaluate:([t],e)=>(y(t,e),function(t){if(!C(t))return!1;const e=t.length;if(!t.every(t=>t.length===e))return!1;for(let r=0;r<e;r++)for(let a=r+1;a<e;a++)if(0!==t[r][a])return!1;return!0}(t)),arity:N(1)},"diagonal?":{evaluate:([t],e)=>(y(t,e),function(t){if(!C(t))return!1;const e=t.length;for(let r=0;r<e;r+=1)for(let a=0;a<e;a+=1)if(r!==a&&0!==t[r][a])return!1;return!0}(t)),arity:N(1)},"square?":{evaluate:([t],e)=>(y(t,e),C(t)),arity:N(1)},"orthogonal-matrix?":{evaluate:([t],e)=>(y(t,e),function(t){return!!C(t)&&M(q(t,function(t){const e=[];for(let r=0;r<t[0].length;r+=1){const a=[];for(let e=0;e<t.length;e+=1)a.push(t[e][r]);e.push(a)}return e}(t)))}(t)),arity:N(1)},"identity?":{evaluate:([t],e)=>(y(t,e),M(t)),arity:N(1)},"invertible?":{evaluate:([t],e)=>(y(t,e),!!function(t){return!!h(t)&&t.length===t[0].length}(t)&&!w(A(t))),arity:N(1)},hilbert:{evaluate:([t],e)=>{s(t,e,{integer:!0,positive:!0});const r=[];for(let e=0;e<t;e+=1){const a=[];for(let r=0;r<t;r+=1)a.push(1/(e+r+1));r.push(a)}return r},arity:N(1)},vandermonde:{evaluate:([t],e)=>{g(t,e);const r=[];for(let e=0;e<t.length;e+=1){const a=[];for(let r=0;r<t.length;r+=1)a.push(t[e]**r);r.push(a)}return r},arity:N(1)},band:{evaluate:([t,e,r],a)=>(s(t,a,{integer:!0,positive:!0}),s(e,a,{integer:!0,nonNegative:!0,lt:t}),s(r,a,{integer:!0,nonNegative:!0,lte:t}),function(t,e,r){const a=Array.from({length:t},()=>Array.from({length:t},()=>0));for(let n=0;n<t;n++)for(let i=Math.max(0,n-e);i<=Math.min(t-1,n+r);i++)a[n][i]=1;return a}(t,e,r)),arity:N(3)},"banded?":{evaluate:([t,e,r],a)=>{y(t,a);const n=Math.max(t.length,t[0].length);return s(e,a,{integer:!0,nonNegative:!0,lt:n}),s(r,a,{integer:!0,nonNegative:!0,lt:n}),function(t,e,r){const a=t.length,n=t[0].length;for(let i=0;i<a;i++)for(let a=0;a<n;a++)if(0!==t[i][a]&&(i-a>e||a-i>r))return!1;return!0}(t,e,r)},arity:N(3)},rank:{evaluate:([t],e)=>{y(t,e);const[,r]=function(t){const e=t.map(t=>[...t]),r=e.length,a=e[0].length;let n=0,i=0;for(let t=0;t<a;t++){let o=-1;for(let a=i;a<r;a++)if(!w(e[a][t])){o=a;break}if(-1===o)continue;n+=1,o!==i&&([e[o],e[i]]=[e[i],e[o]]);const m=e[i][t];for(let r=t;r<a;r++)e[i][r]/=m;for(let n=0;n<r;n++)if(n!==i&&!w(e[n][t])){const r=e[n][t];for(let o=t;o<a;o++)e[n][o]-=r*e[i][o]}if(i++,i===r)break}return[e,n]}(t);return r},arity:N(1)},"frobenius-norm":{evaluate:([t],e)=>(y(t,e),Math.sqrt(t.reduce((t,e)=>t+e.reduce((t,e)=>t+e*e,0),0))),arity:N(1)},"one-norm":{evaluate:([t],e)=>(y(t,e),function(t){const e=t.length,r=t[0].length;let a=0;for(let n=0;n<r;n+=1){let r=0;for(let a=0;a<e;a+=1)r+=Math.abs(t[a][n]);a=Math.max(a,r)}return a}(t)),arity:N(1)},"inf-norm":{evaluate:([t],e)=>(y(t,e),t.reduce((t,e)=>Math.max(t,e.reduce((t,e)=>t+Math.abs(e),0)),0)),arity:N(1)},"max-norm":{evaluate:([t],e)=>(y(t,e),t.reduce((t,e)=>{const r=e.reduce((t,e)=>Math.max(t,Math.abs(e)),0);return Math.max(t,r)},0)),arity:N(1)}};for(const[t,e]of Object.entries(k))j[t]&&(j[t].docs=e);const S={name:"matrix",functions:j};exports.matrixModule=S;
2
+ //# sourceMappingURL=matrix.js.map