oakscriptjs 0.8.1 → 0.9.0

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 (544) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +31 -9
  3. package/dist/cjs/array/index.d.ts +701 -0
  4. package/dist/cjs/array/index.d.ts.map +1 -0
  5. package/dist/cjs/array/index.js +392 -0
  6. package/dist/cjs/array/index.js.map +7 -0
  7. package/dist/cjs/box/index.d.ts +444 -0
  8. package/dist/cjs/box/index.d.ts.map +1 -0
  9. package/dist/cjs/box/index.js +246 -0
  10. package/dist/cjs/box/index.js.map +7 -0
  11. package/dist/cjs/callsite/index.d.ts +61 -0
  12. package/dist/cjs/callsite/index.d.ts.map +1 -0
  13. package/dist/cjs/callsite/index.js +65 -0
  14. package/dist/cjs/callsite/index.js.map +7 -0
  15. package/dist/cjs/chartpoint/index.d.ts +90 -0
  16. package/dist/cjs/chartpoint/index.d.ts.map +1 -0
  17. package/dist/cjs/chartpoint/index.js +56 -0
  18. package/dist/cjs/chartpoint/index.js.map +7 -0
  19. package/dist/cjs/color/index.d.ts +285 -0
  20. package/dist/cjs/color/index.d.ts.map +1 -0
  21. package/dist/cjs/color/index.js +143 -0
  22. package/dist/cjs/color/index.js.map +7 -0
  23. package/dist/cjs/compare/index.d.ts +26 -0
  24. package/dist/cjs/compare/index.d.ts.map +1 -0
  25. package/dist/cjs/compare/index.js +50 -0
  26. package/dist/cjs/compare/index.js.map +7 -0
  27. package/dist/cjs/drawing/registry.d.ts +42 -0
  28. package/dist/cjs/drawing/registry.d.ts.map +1 -0
  29. package/dist/cjs/drawing/registry.js +87 -0
  30. package/dist/cjs/drawing/registry.js.map +7 -0
  31. package/dist/cjs/index.d.ts +85 -0
  32. package/dist/cjs/index.d.ts.map +1 -0
  33. package/dist/cjs/index.js +184 -0
  34. package/dist/cjs/index.js.map +7 -0
  35. package/dist/cjs/indicator.d.ts +117 -0
  36. package/dist/cjs/indicator.d.ts.map +1 -0
  37. package/dist/cjs/indicator.js +74 -0
  38. package/dist/cjs/indicator.js.map +7 -0
  39. package/dist/cjs/input.d.ts +196 -0
  40. package/dist/cjs/input.d.ts.map +1 -0
  41. package/dist/cjs/input.js +197 -0
  42. package/dist/cjs/input.js.map +7 -0
  43. package/dist/cjs/label/index.d.ts +303 -0
  44. package/dist/cjs/label/index.d.ts.map +1 -0
  45. package/dist/cjs/label/index.js +190 -0
  46. package/dist/cjs/label/index.js.map +7 -0
  47. package/dist/cjs/lib/index.d.ts +8 -0
  48. package/dist/cjs/lib/index.d.ts.map +1 -0
  49. package/dist/cjs/lib/index.js +19 -0
  50. package/dist/cjs/lib/index.js.map +7 -0
  51. package/dist/{lib → cjs/lib}/zigzag/index.d.ts +4 -1
  52. package/dist/cjs/lib/zigzag/index.d.ts.map +1 -0
  53. package/dist/cjs/lib/zigzag/index.js +27 -0
  54. package/dist/cjs/lib/zigzag/index.js.map +7 -0
  55. package/dist/cjs/lib/zigzag/zigzag.d.ts +100 -0
  56. package/dist/cjs/lib/zigzag/zigzag.d.ts.map +1 -0
  57. package/dist/cjs/lib/zigzag/zigzag.js +207 -0
  58. package/dist/cjs/lib/zigzag/zigzag.js.map +7 -0
  59. package/dist/cjs/line/index.d.ts +342 -0
  60. package/dist/cjs/line/index.d.ts.map +1 -0
  61. package/dist/cjs/line/index.js +193 -0
  62. package/dist/cjs/line/index.js.map +7 -0
  63. package/dist/cjs/linefill/index.d.ts +124 -0
  64. package/dist/cjs/linefill/index.d.ts.map +1 -0
  65. package/dist/cjs/linefill/index.js +56 -0
  66. package/dist/cjs/linefill/index.js.map +7 -0
  67. package/dist/cjs/map/index.d.ts +69 -0
  68. package/dist/cjs/map/index.d.ts.map +1 -0
  69. package/dist/cjs/map/index.js +80 -0
  70. package/dist/cjs/map/index.js.map +7 -0
  71. package/dist/cjs/math/index.d.ts +560 -0
  72. package/dist/cjs/math/index.d.ts.map +1 -0
  73. package/dist/cjs/math/index.js +441 -0
  74. package/dist/cjs/math/index.js.map +7 -0
  75. package/dist/cjs/matrix/index.d.ts +1231 -0
  76. package/dist/cjs/matrix/index.d.ts.map +1 -0
  77. package/dist/cjs/matrix/index.js +1200 -0
  78. package/dist/cjs/matrix/index.js.map +7 -0
  79. package/dist/cjs/package.json +1 -0
  80. package/dist/cjs/plot.d.ts +76 -0
  81. package/dist/cjs/plot.d.ts.map +1 -0
  82. package/dist/cjs/plot.js +51 -0
  83. package/dist/cjs/plot.js.map +7 -0
  84. package/dist/cjs/polyline/index.d.ts +115 -0
  85. package/dist/cjs/polyline/index.d.ts.map +1 -0
  86. package/dist/cjs/polyline/index.js +76 -0
  87. package/dist/cjs/polyline/index.js.map +7 -0
  88. package/dist/cjs/runtime/adapters/LightweightChartsAdapter.d.ts +86 -0
  89. package/dist/cjs/runtime/adapters/LightweightChartsAdapter.d.ts.map +1 -0
  90. package/dist/cjs/runtime/adapters/LightweightChartsAdapter.js +141 -0
  91. package/dist/cjs/runtime/adapters/LightweightChartsAdapter.js.map +7 -0
  92. package/dist/cjs/runtime/adapters/SimpleInputAdapter.d.ts +59 -0
  93. package/dist/cjs/runtime/adapters/SimpleInputAdapter.d.ts.map +1 -0
  94. package/dist/cjs/runtime/adapters/SimpleInputAdapter.js +117 -0
  95. package/dist/cjs/runtime/adapters/SimpleInputAdapter.js.map +7 -0
  96. package/dist/{runtime → cjs/runtime}/index.d.ts +12 -5
  97. package/dist/cjs/runtime/index.d.ts.map +1 -0
  98. package/dist/cjs/runtime/index.js +49 -0
  99. package/dist/cjs/runtime/index.js.map +7 -0
  100. package/dist/cjs/runtime/inputs.d.ts +91 -0
  101. package/dist/cjs/runtime/inputs.d.ts.map +1 -0
  102. package/dist/cjs/runtime/inputs.js +262 -0
  103. package/dist/cjs/runtime/inputs.js.map +7 -0
  104. package/dist/cjs/runtime/runtime.d.ts +70 -0
  105. package/dist/cjs/runtime/runtime.d.ts.map +1 -0
  106. package/dist/cjs/runtime/runtime.js +148 -0
  107. package/dist/cjs/runtime/runtime.js.map +7 -0
  108. package/dist/cjs/runtime/series.d.ts +362 -0
  109. package/dist/cjs/runtime/series.d.ts.map +1 -0
  110. package/dist/cjs/runtime/series.js +560 -0
  111. package/dist/cjs/runtime/series.js.map +7 -0
  112. package/dist/cjs/runtime/types.d.ts +282 -0
  113. package/dist/cjs/runtime/types.d.ts.map +1 -0
  114. package/dist/cjs/runtime/types.js +17 -0
  115. package/dist/cjs/runtime/types.js.map +7 -0
  116. package/dist/cjs/script/index.d.ts +987 -0
  117. package/dist/cjs/script/index.d.ts.map +1 -0
  118. package/dist/cjs/script/index.js +1169 -0
  119. package/dist/cjs/script/index.js.map +7 -0
  120. package/dist/cjs/security/resample.d.ts +63 -0
  121. package/dist/cjs/security/resample.d.ts.map +1 -0
  122. package/dist/cjs/security/resample.js +84 -0
  123. package/dist/cjs/security/resample.js.map +7 -0
  124. package/dist/cjs/session/bars.d.ts +80 -0
  125. package/dist/cjs/session/bars.d.ts.map +1 -0
  126. package/dist/cjs/session/bars.js +219 -0
  127. package/dist/cjs/session/bars.js.map +7 -0
  128. package/dist/cjs/session/calendar.d.ts +70 -0
  129. package/dist/cjs/session/calendar.d.ts.map +1 -0
  130. package/dist/cjs/session/calendar.js +164 -0
  131. package/dist/cjs/session/calendar.js.map +7 -0
  132. package/dist/cjs/str/dateformat.d.ts +15 -0
  133. package/dist/cjs/str/dateformat.d.ts.map +1 -0
  134. package/dist/cjs/str/dateformat.js +149 -0
  135. package/dist/cjs/str/dateformat.js.map +7 -0
  136. package/dist/cjs/str/index.d.ts +459 -0
  137. package/dist/cjs/str/index.d.ts.map +1 -0
  138. package/dist/cjs/str/index.js +143 -0
  139. package/dist/cjs/str/index.js.map +7 -0
  140. package/dist/cjs/str/messageformat.d.ts +14 -0
  141. package/dist/cjs/str/messageformat.d.ts.map +1 -0
  142. package/dist/cjs/str/messageformat.js +114 -0
  143. package/dist/cjs/str/messageformat.js.map +7 -0
  144. package/dist/cjs/str/numberformat.d.ts +19 -0
  145. package/dist/cjs/str/numberformat.d.ts.map +1 -0
  146. package/dist/cjs/str/numberformat.js +170 -0
  147. package/dist/cjs/str/numberformat.js.map +7 -0
  148. package/dist/{strategy → cjs/strategy}/index.d.ts +50 -0
  149. package/dist/cjs/strategy/index.d.ts.map +1 -0
  150. package/dist/cjs/strategy/index.js +92 -0
  151. package/dist/cjs/strategy/index.js.map +7 -0
  152. package/dist/cjs/ta/index.d.ts +1397 -0
  153. package/dist/cjs/ta/index.d.ts.map +1 -0
  154. package/dist/cjs/ta/index.js +1715 -0
  155. package/dist/cjs/ta/index.js.map +7 -0
  156. package/dist/cjs/ta/running-sum.d.ts +30 -0
  157. package/dist/cjs/ta/running-sum.d.ts.map +1 -0
  158. package/dist/cjs/ta/running-sum.js +99 -0
  159. package/dist/cjs/ta/running-sum.js.map +7 -0
  160. package/dist/cjs/ta-series.d.ts +558 -0
  161. package/dist/cjs/ta-series.d.ts.map +1 -0
  162. package/dist/cjs/ta-series.js +606 -0
  163. package/dist/cjs/ta-series.js.map +7 -0
  164. package/dist/cjs/text/index.d.ts +14 -0
  165. package/dist/cjs/text/index.d.ts.map +1 -0
  166. package/dist/cjs/text/index.js +29 -0
  167. package/dist/cjs/text/index.js.map +7 -0
  168. package/dist/cjs/time/datestring.d.ts +23 -0
  169. package/dist/cjs/time/datestring.d.ts.map +1 -0
  170. package/dist/cjs/time/datestring.js +106 -0
  171. package/dist/cjs/time/datestring.js.map +7 -0
  172. package/dist/cjs/time/index.d.ts +89 -0
  173. package/dist/cjs/time/index.d.ts.map +1 -0
  174. package/dist/cjs/time/index.js +85 -0
  175. package/dist/cjs/time/index.js.map +7 -0
  176. package/dist/cjs/time/session.d.ts +17 -0
  177. package/dist/cjs/time/session.d.ts.map +1 -0
  178. package/dist/cjs/time/session.js +65 -0
  179. package/dist/cjs/time/session.js.map +7 -0
  180. package/dist/cjs/time/timezone.d.ts +40 -0
  181. package/dist/cjs/time/timezone.d.ts.map +1 -0
  182. package/dist/cjs/time/timezone.js +125 -0
  183. package/dist/cjs/time/timezone.js.map +7 -0
  184. package/dist/cjs/timeframe/index.d.ts +73 -0
  185. package/dist/cjs/timeframe/index.d.ts.map +1 -0
  186. package/dist/cjs/timeframe/index.js +85 -0
  187. package/dist/cjs/timeframe/index.js.map +7 -0
  188. package/dist/cjs/types/index.d.ts +343 -0
  189. package/dist/cjs/types/index.d.ts.map +1 -0
  190. package/dist/cjs/types/index.js +32 -0
  191. package/dist/cjs/types/index.js.map +7 -0
  192. package/dist/cjs/types/metadata.d.ts +300 -0
  193. package/dist/cjs/types/metadata.d.ts.map +1 -0
  194. package/dist/cjs/types/metadata.js +17 -0
  195. package/dist/cjs/types/metadata.js.map +7 -0
  196. package/dist/cjs/utils/index.d.ts +167 -0
  197. package/dist/cjs/utils/index.d.ts.map +1 -0
  198. package/dist/cjs/utils/index.js +209 -0
  199. package/dist/cjs/utils/index.js.map +7 -0
  200. package/dist/esm/array/index.d.ts +701 -0
  201. package/dist/esm/array/index.d.ts.map +1 -0
  202. package/dist/esm/array/index.js +983 -0
  203. package/dist/esm/array/index.js.map +1 -0
  204. package/dist/esm/box/index.d.ts +444 -0
  205. package/dist/esm/box/index.d.ts.map +1 -0
  206. package/dist/esm/box/index.js +602 -0
  207. package/dist/esm/box/index.js.map +1 -0
  208. package/dist/esm/callsite/index.d.ts +61 -0
  209. package/dist/esm/callsite/index.d.ts.map +1 -0
  210. package/dist/esm/callsite/index.js +97 -0
  211. package/dist/esm/callsite/index.js.map +1 -0
  212. package/dist/esm/chartpoint/index.d.ts +90 -0
  213. package/dist/esm/chartpoint/index.d.ts.map +1 -0
  214. package/dist/esm/chartpoint/index.js +113 -0
  215. package/dist/esm/chartpoint/index.js.map +1 -0
  216. package/dist/esm/color/index.d.ts +285 -0
  217. package/dist/esm/color/index.d.ts.map +1 -0
  218. package/dist/esm/color/index.js +373 -0
  219. package/dist/esm/color/index.js.map +1 -0
  220. package/dist/esm/compare/index.d.ts +26 -0
  221. package/dist/esm/compare/index.d.ts.map +1 -0
  222. package/dist/esm/compare/index.js +39 -0
  223. package/dist/esm/compare/index.js.map +1 -0
  224. package/dist/esm/drawing/registry.d.ts +42 -0
  225. package/dist/esm/drawing/registry.d.ts.map +1 -0
  226. package/dist/esm/drawing/registry.js +89 -0
  227. package/dist/esm/drawing/registry.js.map +1 -0
  228. package/dist/esm/index.d.ts +85 -0
  229. package/dist/esm/index.d.ts.map +1 -0
  230. package/dist/esm/index.js +96 -0
  231. package/dist/esm/index.js.map +1 -0
  232. package/dist/esm/indicator.d.ts +117 -0
  233. package/dist/esm/indicator.d.ts.map +1 -0
  234. package/dist/esm/indicator.js +84 -0
  235. package/dist/esm/indicator.js.map +1 -0
  236. package/dist/esm/input.d.ts +196 -0
  237. package/dist/esm/input.d.ts.map +1 -0
  238. package/dist/esm/input.js +183 -0
  239. package/dist/esm/input.js.map +1 -0
  240. package/dist/esm/label/index.d.ts +303 -0
  241. package/dist/esm/label/index.d.ts.map +1 -0
  242. package/dist/esm/label/index.js +417 -0
  243. package/dist/esm/label/index.js.map +1 -0
  244. package/dist/esm/lib/index.d.ts +8 -0
  245. package/dist/esm/lib/index.d.ts.map +1 -0
  246. package/dist/esm/lib/index.js +8 -0
  247. package/dist/esm/lib/index.js.map +1 -0
  248. package/dist/esm/lib/zigzag/index.d.ts +5 -0
  249. package/dist/esm/lib/zigzag/index.d.ts.map +1 -0
  250. package/dist/esm/lib/zigzag/index.js +5 -0
  251. package/dist/esm/lib/zigzag/index.js.map +1 -0
  252. package/dist/esm/lib/zigzag/zigzag.d.ts +100 -0
  253. package/dist/esm/lib/zigzag/zigzag.d.ts.map +1 -0
  254. package/dist/esm/lib/zigzag/zigzag.js +229 -0
  255. package/dist/esm/lib/zigzag/zigzag.js.map +1 -0
  256. package/dist/esm/line/index.d.ts +342 -0
  257. package/dist/esm/line/index.d.ts.map +1 -0
  258. package/dist/esm/line/index.js +470 -0
  259. package/dist/esm/line/index.js.map +1 -0
  260. package/dist/esm/linefill/index.d.ts +124 -0
  261. package/dist/esm/linefill/index.d.ts.map +1 -0
  262. package/dist/esm/linefill/index.js +144 -0
  263. package/dist/esm/linefill/index.js.map +1 -0
  264. package/dist/esm/map/index.d.ts +69 -0
  265. package/dist/esm/map/index.d.ts.map +1 -0
  266. package/dist/esm/map/index.js +106 -0
  267. package/dist/esm/map/index.js.map +1 -0
  268. package/dist/esm/math/index.d.ts +560 -0
  269. package/dist/esm/math/index.d.ts.map +1 -0
  270. package/dist/esm/math/index.js +495 -0
  271. package/dist/esm/math/index.js.map +1 -0
  272. package/dist/esm/matrix/index.d.ts +1231 -0
  273. package/dist/esm/matrix/index.d.ts.map +1 -0
  274. package/dist/esm/matrix/index.js +2450 -0
  275. package/dist/esm/matrix/index.js.map +1 -0
  276. package/dist/esm/plot.d.ts +76 -0
  277. package/dist/esm/plot.d.ts.map +1 -0
  278. package/dist/esm/plot.js +63 -0
  279. package/dist/esm/plot.js.map +1 -0
  280. package/dist/esm/polyline/index.d.ts +115 -0
  281. package/dist/esm/polyline/index.d.ts.map +1 -0
  282. package/dist/esm/polyline/index.js +157 -0
  283. package/dist/esm/polyline/index.js.map +1 -0
  284. package/dist/esm/runtime/adapters/LightweightChartsAdapter.d.ts +86 -0
  285. package/dist/esm/runtime/adapters/LightweightChartsAdapter.d.ts.map +1 -0
  286. package/dist/esm/runtime/adapters/LightweightChartsAdapter.js +140 -0
  287. package/dist/esm/runtime/adapters/LightweightChartsAdapter.js.map +1 -0
  288. package/dist/esm/runtime/adapters/SimpleInputAdapter.d.ts +59 -0
  289. package/dist/esm/runtime/adapters/SimpleInputAdapter.d.ts.map +1 -0
  290. package/dist/esm/runtime/adapters/SimpleInputAdapter.js +115 -0
  291. package/dist/esm/runtime/adapters/SimpleInputAdapter.js.map +1 -0
  292. package/dist/esm/runtime/index.d.ts +13 -0
  293. package/dist/esm/runtime/index.d.ts.map +1 -0
  294. package/dist/esm/runtime/index.js +14 -0
  295. package/dist/esm/runtime/index.js.map +1 -0
  296. package/dist/esm/runtime/inputs.d.ts +91 -0
  297. package/dist/esm/runtime/inputs.d.ts.map +1 -0
  298. package/dist/esm/runtime/inputs.js +334 -0
  299. package/dist/esm/runtime/inputs.js.map +1 -0
  300. package/dist/esm/runtime/runtime.d.ts +70 -0
  301. package/dist/esm/runtime/runtime.d.ts.map +1 -0
  302. package/dist/esm/runtime/runtime.js +193 -0
  303. package/dist/esm/runtime/runtime.js.map +1 -0
  304. package/dist/esm/runtime/series.d.ts +362 -0
  305. package/dist/esm/runtime/series.d.ts.map +1 -0
  306. package/dist/esm/runtime/series.js +583 -0
  307. package/dist/esm/runtime/series.js.map +1 -0
  308. package/dist/esm/runtime/types.d.ts +282 -0
  309. package/dist/esm/runtime/types.d.ts.map +1 -0
  310. package/dist/esm/runtime/types.js +7 -0
  311. package/dist/esm/runtime/types.js.map +1 -0
  312. package/dist/esm/script/index.d.ts +987 -0
  313. package/dist/esm/script/index.d.ts.map +1 -0
  314. package/dist/esm/script/index.js +1289 -0
  315. package/dist/esm/script/index.js.map +1 -0
  316. package/dist/esm/security/resample.d.ts +63 -0
  317. package/dist/esm/security/resample.d.ts.map +1 -0
  318. package/dist/esm/security/resample.js +110 -0
  319. package/dist/esm/security/resample.js.map +1 -0
  320. package/dist/esm/session/bars.d.ts +80 -0
  321. package/dist/esm/session/bars.d.ts.map +1 -0
  322. package/dist/esm/session/bars.js +232 -0
  323. package/dist/esm/session/bars.js.map +1 -0
  324. package/dist/esm/session/calendar.d.ts +70 -0
  325. package/dist/esm/session/calendar.d.ts.map +1 -0
  326. package/dist/esm/session/calendar.js +172 -0
  327. package/dist/esm/session/calendar.js.map +1 -0
  328. package/dist/esm/str/dateformat.d.ts +15 -0
  329. package/dist/esm/str/dateformat.d.ts.map +1 -0
  330. package/dist/esm/str/dateformat.js +136 -0
  331. package/dist/esm/str/dateformat.js.map +1 -0
  332. package/dist/esm/str/index.d.ts +459 -0
  333. package/dist/esm/str/index.d.ts.map +1 -0
  334. package/dist/esm/str/index.js +540 -0
  335. package/dist/esm/str/index.js.map +1 -0
  336. package/dist/esm/str/messageformat.d.ts +14 -0
  337. package/dist/esm/str/messageformat.d.ts.map +1 -0
  338. package/dist/esm/str/messageformat.js +111 -0
  339. package/dist/esm/str/messageformat.js.map +1 -0
  340. package/dist/esm/str/numberformat.d.ts +19 -0
  341. package/dist/esm/str/numberformat.d.ts.map +1 -0
  342. package/dist/esm/str/numberformat.js +189 -0
  343. package/dist/esm/str/numberformat.js.map +1 -0
  344. package/dist/esm/strategy/index.d.ts +245 -0
  345. package/dist/esm/strategy/index.d.ts.map +1 -0
  346. package/dist/esm/strategy/index.js +84 -0
  347. package/dist/esm/strategy/index.js.map +1 -0
  348. package/dist/esm/ta/index.d.ts +1397 -0
  349. package/dist/esm/ta/index.d.ts.map +1 -0
  350. package/dist/esm/ta/index.js +3227 -0
  351. package/dist/esm/ta/index.js.map +1 -0
  352. package/dist/esm/ta/running-sum.d.ts +30 -0
  353. package/dist/esm/ta/running-sum.d.ts.map +1 -0
  354. package/dist/esm/ta/running-sum.js +113 -0
  355. package/dist/esm/ta/running-sum.js.map +1 -0
  356. package/dist/esm/ta-series.d.ts +558 -0
  357. package/dist/esm/ta-series.d.ts.map +1 -0
  358. package/dist/esm/ta-series.js +910 -0
  359. package/dist/esm/ta-series.js.map +1 -0
  360. package/dist/esm/text/index.d.ts +14 -0
  361. package/dist/esm/text/index.d.ts.map +1 -0
  362. package/dist/esm/text/index.js +14 -0
  363. package/dist/esm/text/index.js.map +1 -0
  364. package/dist/esm/time/datestring.d.ts +23 -0
  365. package/dist/esm/time/datestring.d.ts.map +1 -0
  366. package/dist/esm/time/datestring.js +94 -0
  367. package/dist/esm/time/datestring.js.map +1 -0
  368. package/dist/esm/time/index.d.ts +89 -0
  369. package/dist/esm/time/index.d.ts.map +1 -0
  370. package/dist/esm/time/index.js +108 -0
  371. package/dist/esm/time/index.js.map +1 -0
  372. package/dist/esm/time/session.d.ts +17 -0
  373. package/dist/esm/time/session.d.ts.map +1 -0
  374. package/dist/esm/time/session.js +69 -0
  375. package/dist/esm/time/session.js.map +1 -0
  376. package/dist/esm/time/timezone.d.ts +40 -0
  377. package/dist/esm/time/timezone.d.ts.map +1 -0
  378. package/dist/esm/time/timezone.js +144 -0
  379. package/dist/esm/time/timezone.js.map +1 -0
  380. package/dist/esm/timeframe/index.d.ts +73 -0
  381. package/dist/esm/timeframe/index.d.ts.map +1 -0
  382. package/dist/esm/timeframe/index.js +131 -0
  383. package/dist/esm/timeframe/index.js.map +1 -0
  384. package/dist/esm/types/index.d.ts +343 -0
  385. package/dist/esm/types/index.d.ts.map +1 -0
  386. package/dist/esm/types/index.js +17 -0
  387. package/dist/esm/types/index.js.map +1 -0
  388. package/dist/esm/types/metadata.d.ts +300 -0
  389. package/dist/esm/types/metadata.d.ts.map +1 -0
  390. package/dist/esm/types/metadata.js +7 -0
  391. package/dist/esm/types/metadata.js.map +1 -0
  392. package/dist/esm/utils/index.d.ts +167 -0
  393. package/dist/esm/utils/index.d.ts.map +1 -0
  394. package/dist/esm/utils/index.js +295 -0
  395. package/dist/esm/utils/index.js.map +1 -0
  396. package/package.json +53 -23
  397. package/src/array/index.ts +1056 -0
  398. package/src/box/index.ts +680 -0
  399. package/src/callsite/index.ts +104 -0
  400. package/src/chartpoint/index.ts +126 -0
  401. package/src/color/index.ts +411 -0
  402. package/src/compare/index.ts +46 -0
  403. package/src/drawing/registry.ts +106 -0
  404. package/src/index.ts +201 -0
  405. package/src/indicator.ts +185 -0
  406. package/src/input.ts +280 -0
  407. package/src/label/index.ts +490 -0
  408. package/src/lib/index.ts +8 -0
  409. package/src/lib/zigzag/index.ts +13 -0
  410. package/src/lib/zigzag/zigzag.ts +318 -0
  411. package/src/line/index.ts +530 -0
  412. package/src/linefill/index.ts +152 -0
  413. package/src/map/index.ts +115 -0
  414. package/src/math/index.ts +1071 -0
  415. package/src/matrix/index.ts +2697 -0
  416. package/src/plot.ts +121 -0
  417. package/src/polyline/index.ts +184 -0
  418. package/src/runtime/adapters/LightweightChartsAdapter.ts +201 -0
  419. package/src/runtime/adapters/SimpleInputAdapter.ts +132 -0
  420. package/src/runtime/index.ts +52 -0
  421. package/src/runtime/inputs.ts +377 -0
  422. package/src/runtime/runtime.ts +241 -0
  423. package/src/runtime/series.ts +644 -0
  424. package/src/runtime/types.ts +292 -0
  425. package/src/script/index.ts +1865 -0
  426. package/src/security/resample.ts +119 -0
  427. package/src/session/bars.ts +262 -0
  428. package/src/session/calendar.ts +199 -0
  429. package/src/str/dateformat.ts +104 -0
  430. package/src/str/index.ts +557 -0
  431. package/src/str/messageformat.ts +109 -0
  432. package/src/str/numberformat.ts +197 -0
  433. package/src/strategy/index.ts +281 -0
  434. package/src/ta/index.ts +3580 -0
  435. package/src/ta/running-sum.ts +117 -0
  436. package/src/ta-series.ts +1036 -0
  437. package/src/text/index.ts +14 -0
  438. package/src/time/datestring.ts +96 -0
  439. package/src/time/index.ts +161 -0
  440. package/src/time/session.ts +79 -0
  441. package/src/time/timezone.ts +180 -0
  442. package/src/timeframe/index.ts +144 -0
  443. package/src/types/index.ts +398 -0
  444. package/src/types/metadata.ts +334 -0
  445. package/src/utils/index.ts +334 -0
  446. package/dist/array/index.d.ts +0 -57
  447. package/dist/array/index.d.ts.map +0 -1
  448. package/dist/box/index.d.ts +0 -37
  449. package/dist/box/index.d.ts.map +0 -1
  450. package/dist/callsite/index.d.ts +0 -7
  451. package/dist/callsite/index.d.ts.map +0 -1
  452. package/dist/chartpoint/index.d.ts +0 -8
  453. package/dist/chartpoint/index.d.ts.map +0 -1
  454. package/dist/color/index.d.ts +0 -28
  455. package/dist/color/index.d.ts.map +0 -1
  456. package/dist/compare/index.d.ts +0 -8
  457. package/dist/compare/index.d.ts.map +0 -1
  458. package/dist/drawing/registry.d.ts +0 -19
  459. package/dist/drawing/registry.d.ts.map +0 -1
  460. package/dist/index.cjs +0 -7979
  461. package/dist/index.d.ts +0 -64
  462. package/dist/index.d.ts.map +0 -1
  463. package/dist/index.mjs +0 -7962
  464. package/dist/indicator.d.ts +0 -42
  465. package/dist/indicator.d.ts.map +0 -1
  466. package/dist/input.d.ts +0 -47
  467. package/dist/input.d.ts.map +0 -1
  468. package/dist/label/index.d.ts +0 -30
  469. package/dist/label/index.d.ts.map +0 -1
  470. package/dist/lib/index.d.ts +0 -2
  471. package/dist/lib/index.d.ts.map +0 -1
  472. package/dist/lib/zigzag/index.d.ts.map +0 -1
  473. package/dist/lib/zigzag/zigzag.d.ts +0 -47
  474. package/dist/lib/zigzag/zigzag.d.ts.map +0 -1
  475. package/dist/line/index.d.ts +0 -30
  476. package/dist/line/index.d.ts.map +0 -1
  477. package/dist/linefill/index.d.ts +0 -10
  478. package/dist/linefill/index.d.ts.map +0 -1
  479. package/dist/map/index.d.ts +0 -14
  480. package/dist/map/index.d.ts.map +0 -1
  481. package/dist/math/index.d.ts +0 -53
  482. package/dist/math/index.d.ts.map +0 -1
  483. package/dist/matrix/index.d.ts +0 -52
  484. package/dist/matrix/index.d.ts.map +0 -1
  485. package/dist/plot.d.ts +0 -20
  486. package/dist/plot.d.ts.map +0 -1
  487. package/dist/polyline/index.d.ts +0 -11
  488. package/dist/polyline/index.d.ts.map +0 -1
  489. package/dist/runtime/adapters/LightweightChartsAdapter.d.ts +0 -15
  490. package/dist/runtime/adapters/LightweightChartsAdapter.d.ts.map +0 -1
  491. package/dist/runtime/adapters/SimpleInputAdapter.d.ts +0 -16
  492. package/dist/runtime/adapters/SimpleInputAdapter.d.ts.map +0 -1
  493. package/dist/runtime/index.cjs +0 -600
  494. package/dist/runtime/index.d.ts.map +0 -1
  495. package/dist/runtime/index.mjs +0 -577
  496. package/dist/runtime/inputs.d.ts +0 -13
  497. package/dist/runtime/inputs.d.ts.map +0 -1
  498. package/dist/runtime/runtime.d.ts +0 -16
  499. package/dist/runtime/runtime.d.ts.map +0 -1
  500. package/dist/runtime/series.d.ts +0 -60
  501. package/dist/runtime/series.d.ts.map +0 -1
  502. package/dist/runtime/types.d.ts +0 -122
  503. package/dist/runtime/types.d.ts.map +0 -1
  504. package/dist/script/index.cjs +0 -6372
  505. package/dist/script/index.d.ts +0 -709
  506. package/dist/script/index.d.ts.map +0 -1
  507. package/dist/script/index.mjs +0 -6355
  508. package/dist/security/resample.d.ts +0 -13
  509. package/dist/security/resample.d.ts.map +0 -1
  510. package/dist/session/bars.d.ts +0 -34
  511. package/dist/session/bars.d.ts.map +0 -1
  512. package/dist/session/calendar.d.ts +0 -31
  513. package/dist/session/calendar.d.ts.map +0 -1
  514. package/dist/str/dateformat.d.ts +0 -2
  515. package/dist/str/dateformat.d.ts.map +0 -1
  516. package/dist/str/index.d.ts +0 -24
  517. package/dist/str/index.d.ts.map +0 -1
  518. package/dist/str/messageformat.d.ts +0 -2
  519. package/dist/str/messageformat.d.ts.map +0 -1
  520. package/dist/str/numberformat.d.ts +0 -3
  521. package/dist/str/numberformat.d.ts.map +0 -1
  522. package/dist/strategy/index.d.ts.map +0 -1
  523. package/dist/ta/index.d.ts +0 -72
  524. package/dist/ta/index.d.ts.map +0 -1
  525. package/dist/ta-series.d.ts +0 -143
  526. package/dist/ta-series.d.ts.map +0 -1
  527. package/dist/text/index.d.ts +0 -4
  528. package/dist/text/index.d.ts.map +0 -1
  529. package/dist/time/datestring.d.ts +0 -2
  530. package/dist/time/datestring.d.ts.map +0 -1
  531. package/dist/time/index.d.ts +0 -15
  532. package/dist/time/index.d.ts.map +0 -1
  533. package/dist/time/session.d.ts +0 -2
  534. package/dist/time/session.d.ts.map +0 -1
  535. package/dist/time/timezone.d.ts +0 -13
  536. package/dist/time/timezone.d.ts.map +0 -1
  537. package/dist/timeframe/index.d.ts +0 -17
  538. package/dist/timeframe/index.d.ts.map +0 -1
  539. package/dist/types/index.d.ts +0 -181
  540. package/dist/types/index.d.ts.map +0 -1
  541. package/dist/types/metadata.d.ts +0 -131
  542. package/dist/types/metadata.d.ts.map +0 -1
  543. package/dist/utils/index.d.ts +0 -26
  544. package/dist/utils/index.d.ts.map +0 -1
@@ -0,0 +1,1231 @@
1
+ /**
2
+ * Matrix namespace
3
+ * Mirrors PineScript's matrix.* functions
4
+ */
5
+ import type { PineMatrix, PineArray, simple_int, int, bool, float } from '../types/index.js';
6
+ /**
7
+ * Creates a new matrix
8
+ *
9
+ * @param rows - Number of rows
10
+ * @param columns - Number of columns
11
+ * @param initial_value - Initial value for all elements
12
+ * @returns A new matrix object
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * // Create a 2x3 matrix filled with zeros
17
+ * const m = matrix.new_matrix(2, 3, 0);
18
+ *
19
+ * // Create a 3x3 identity-like matrix
20
+ * const m2 = matrix.new_matrix(3, 3, 1);
21
+ * ```
22
+ */
23
+ export declare function new_matrix<T>(rows: simple_int, columns: simple_int, initial_value?: T): PineMatrix<T>;
24
+ /**
25
+ * Get element at position
26
+ *
27
+ * The function returns the element with the specified index of the matrix.
28
+ *
29
+ * @param id - A matrix object
30
+ * @param row - Index of the required row
31
+ * @param column - Index of the required column
32
+ * @returns The value of the element at the row and column index
33
+ *
34
+ * @remarks
35
+ * Indexing of the rows and columns starts at zero.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * // Create a 2x3 matrix with value 5
40
+ * const m = matrix.new_matrix(2, 3, 5);
41
+ *
42
+ * // Get element at row 0, column 0
43
+ * const x = matrix.get(m, 0, 0); // Returns: 5
44
+ * ```
45
+ */
46
+ export declare function get<T>(id: PineMatrix<T>, row: simple_int, column: simple_int): T;
47
+ /**
48
+ * Set element at position
49
+ *
50
+ * The function assigns value to the element at the row and column of the matrix.
51
+ *
52
+ * @param id - A matrix object
53
+ * @param row - The row index of the element to be modified
54
+ * @param column - The column index of the element to be modified
55
+ * @param value - The new value to be set
56
+ *
57
+ * @remarks
58
+ * Indexing of the rows and columns starts at zero.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * // Create a 2x3 matrix with value 4
63
+ * const m = matrix.new_matrix(2, 3, 4);
64
+ *
65
+ * // Replace value at row 0, column 1 with 3
66
+ * matrix.set(m, 0, 1, 3);
67
+ *
68
+ * // Now m[0][1] === 3
69
+ * ```
70
+ */
71
+ export declare function set<T>(id: PineMatrix<T>, row: simple_int, column: simple_int, value: T): void;
72
+ /**
73
+ * Get number of rows
74
+ *
75
+ * The function returns the number of rows in the matrix.
76
+ *
77
+ * @param id - A matrix object
78
+ * @returns The number of rows in the matrix
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * // Create a 2x6 matrix
83
+ * const m = matrix.new_matrix(2, 6, 0);
84
+ *
85
+ * // Get the quantity of rows
86
+ * const x = matrix.rows(m); // Returns: 2
87
+ * ```
88
+ */
89
+ export declare function rows<T>(id: PineMatrix<T>): int;
90
+ /**
91
+ * Get number of columns
92
+ *
93
+ * The function returns the number of columns in the matrix.
94
+ *
95
+ * @param id - A matrix object
96
+ * @returns The number of columns in the matrix
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * // Create a 2x6 matrix
101
+ * const m = matrix.new_matrix(2, 6, 0);
102
+ *
103
+ * // Get the quantity of columns
104
+ * const x = matrix.columns(m); // Returns: 6
105
+ * ```
106
+ */
107
+ export declare function columns<T>(id: PineMatrix<T>): int;
108
+ /**
109
+ * Get total number of elements
110
+ *
111
+ * The function returns the total number of all matrix elements.
112
+ *
113
+ * @param id - A matrix object
114
+ * @returns The total number of elements (rows * columns)
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * // Create a 3x4 matrix
119
+ * const m = matrix.new_matrix(3, 4, 0);
120
+ *
121
+ * // Get total element count
122
+ * const count = matrix.elements_count(m); // Returns: 12
123
+ * ```
124
+ */
125
+ export declare function elements_count<T>(id: PineMatrix<T>): int;
126
+ /**
127
+ * Get row as array
128
+ *
129
+ * The function creates a one-dimensional array from the elements of a matrix row.
130
+ *
131
+ * @param id - A matrix object
132
+ * @param row_index - Index of the required row
133
+ * @returns An array containing the values of the specified row
134
+ *
135
+ * @remarks
136
+ * Indexing of rows starts at 0.
137
+ * Returns a copy of the row data.
138
+ *
139
+ * @example
140
+ * ```typescript
141
+ * // Create a 2x3 matrix
142
+ * const m = matrix.new_matrix(2, 3, 5);
143
+ * matrix.set(m, 0, 0, 1);
144
+ * matrix.set(m, 0, 1, 2);
145
+ * matrix.set(m, 0, 2, 3);
146
+ *
147
+ * // Get the first row as an array
148
+ * const a = matrix.row(m, 0); // Returns: [1, 2, 3]
149
+ * ```
150
+ */
151
+ export declare function row<T>(id: PineMatrix<T>, row_index: simple_int): PineArray<T>;
152
+ /**
153
+ * Get column as array
154
+ *
155
+ * The function creates a one-dimensional array from the elements of a matrix column.
156
+ *
157
+ * @param id - A matrix object
158
+ * @param column_index - Index of the required column
159
+ * @returns An array containing the values of the specified column
160
+ *
161
+ * @remarks
162
+ * Indexing of columns starts at 0.
163
+ * Returns a copy of the column data.
164
+ *
165
+ * @example
166
+ * ```typescript
167
+ * // Create a 3x2 matrix
168
+ * const m = matrix.new_matrix(3, 2, 0);
169
+ * matrix.set(m, 0, 0, 1);
170
+ * matrix.set(m, 1, 0, 2);
171
+ * matrix.set(m, 2, 0, 3);
172
+ *
173
+ * // Get the first column as an array
174
+ * const a = matrix.col(m, 0); // Returns: [1, 2, 3]
175
+ * ```
176
+ */
177
+ export declare function col<T>(id: PineMatrix<T>, column_index: simple_int): PineArray<T>;
178
+ /**
179
+ * Create a deep copy of a matrix
180
+ *
181
+ * The function creates a new matrix which is a copy of the original.
182
+ *
183
+ * @param id - A matrix object to copy
184
+ * @returns A new matrix object that is a deep copy of the original
185
+ *
186
+ * @remarks
187
+ * Unlike a simple assignment operation which would only copy the reference,
188
+ * this function creates an actual copy of the matrix data.
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * // Create a 2x3 matrix with value 1
193
+ * const m1 = matrix.new_matrix(2, 3, 1);
194
+ *
195
+ * // Copy the matrix
196
+ * const m2 = matrix.copy(m1);
197
+ *
198
+ * // Modifying m2 will not affect m1
199
+ * matrix.set(m2, 0, 0, 99);
200
+ * // m1[0][0] is still 1
201
+ * // m2[0][0] is now 99
202
+ * ```
203
+ */
204
+ export declare function copy<T>(id: PineMatrix<T>): PineMatrix<T>;
205
+ /**
206
+ * Fill matrix with value
207
+ *
208
+ * The function fills a rectangular area of the matrix defined by the indices
209
+ * from_row to to_row (not including it) and from_column to to_column (not including it)
210
+ * with the specified value.
211
+ *
212
+ * @param id - A matrix object
213
+ * @param value - The value to fill with
214
+ * @param from_row - Row index from which the fill will begin (inclusive). Default: 0
215
+ * @param to_row - Row index where the fill will end (not inclusive). Default: matrix.rows
216
+ * @param from_column - Column index from which the fill will begin (inclusive). Default: 0
217
+ * @param to_column - Column index where the fill will end (not inclusive). Default: matrix.columns
218
+ *
219
+ * @example
220
+ * ```typescript
221
+ * // Create a 4x5 matrix with value 0
222
+ * const m = matrix.new_matrix(4, 5, 0);
223
+ *
224
+ * // Fill rows 0-1 and columns 1-2 with value 9
225
+ * matrix.fill(m, 9, 0, 2, 1, 3);
226
+ *
227
+ * // Result: positions [0,1], [0,2], [1,1], [1,2] are now 9
228
+ * ```
229
+ */
230
+ export declare function fill<T>(id: PineMatrix<T>, value: T, from_row?: simple_int, to_row?: simple_int, from_column?: simple_int, to_column?: simple_int): void;
231
+ /**
232
+ * Test if matrix is square
233
+ *
234
+ * The function determines if the matrix is square (it has the same number of rows and columns).
235
+ *
236
+ * @param id - Matrix object to test
237
+ * @returns true if the matrix is square, false otherwise
238
+ *
239
+ * @example
240
+ * ```typescript
241
+ * // Create a 3x3 square matrix
242
+ * const m1 = matrix.new_matrix(3, 3, 0);
243
+ * const isSquare1 = matrix.is_square(m1); // Returns: true
244
+ *
245
+ * // Create a 2x3 non-square matrix
246
+ * const m2 = matrix.new_matrix(2, 3, 0);
247
+ * const isSquare2 = matrix.is_square(m2); // Returns: false
248
+ * ```
249
+ */
250
+ export declare function is_square<T>(id: PineMatrix<T>): bool;
251
+ /**
252
+ * Test if matrix is a zero matrix
253
+ *
254
+ * The function determines if all elements of the matrix are zero.
255
+ *
256
+ * @param id - Matrix object to check (int/float)
257
+ * @returns true if all elements are zero, false otherwise
258
+ *
259
+ * @example
260
+ * ```typescript
261
+ * // Create a 2x2 zero matrix
262
+ * const m1 = matrix.new_matrix(2, 2, 0);
263
+ * const isZero1 = matrix.is_zero(m1); // Returns: true
264
+ *
265
+ * // Create a matrix with non-zero element
266
+ * const m2 = matrix.new_matrix(2, 2, 0);
267
+ * matrix.set(m2, 0, 0, 1);
268
+ * const isZero2 = matrix.is_zero(m2); // Returns: false
269
+ * ```
270
+ */
271
+ export declare function is_zero(id: PineMatrix<float>): bool;
272
+ /**
273
+ * Test if matrix is binary
274
+ *
275
+ * The function determines if the matrix is binary (when all elements are 0 or 1).
276
+ *
277
+ * @param id - Matrix object to test (int/float)
278
+ * @returns true if the matrix is binary, false otherwise
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * // Create a binary matrix
283
+ * const m1 = matrix.new_matrix(2, 2, 0);
284
+ * matrix.set(m1, 0, 0, 1);
285
+ * matrix.set(m1, 1, 1, 1);
286
+ * const isBinary1 = matrix.is_binary(m1); // Returns: true
287
+ *
288
+ * // Create a non-binary matrix
289
+ * const m2 = matrix.new_matrix(2, 2, 0);
290
+ * matrix.set(m2, 0, 0, 2);
291
+ * const isBinary2 = matrix.is_binary(m2); // Returns: false
292
+ * ```
293
+ */
294
+ export declare function is_binary(id: PineMatrix<float>): bool;
295
+ /**
296
+ * Add row to matrix
297
+ *
298
+ * Inserts a new row at the specified index of the matrix.
299
+ *
300
+ * @param id - A matrix object
301
+ * @param row - Optional. The index of the new row. Must be a value from 0 to matrix.rows(id).
302
+ * All existing rows with indices >= this value increase their index by one.
303
+ * Default is matrix.rows(id) (append at end).
304
+ * @param array_id - Optional. An array to use as the new row. If the matrix is empty, the array
305
+ * can be of any size. Otherwise, its size must equal matrix.columns(id).
306
+ * By default, inserts a row of undefined values.
307
+ *
308
+ * @remarks
309
+ * Indexing of rows starts at zero.
310
+ * Rather than add rows to an empty matrix, it is far more efficient to declare a matrix
311
+ * with explicit dimensions and fill it with values.
312
+ *
313
+ * @example
314
+ * ```typescript
315
+ * // Create a 2x3 matrix with zeros
316
+ * const m = matrix.new_matrix(2, 3, 0);
317
+ *
318
+ * // Add a row at the end with default values
319
+ * matrix.add_row(m);
320
+ *
321
+ * // Add an array as the first row
322
+ * const arr = [1, 2, 3];
323
+ * matrix.add_row(m, 0, arr);
324
+ * ```
325
+ */
326
+ export declare function add_row<T>(id: PineMatrix<T>, row?: simple_int, array_id?: PineArray<T>): void;
327
+ /**
328
+ * Add column to matrix
329
+ *
330
+ * Inserts a new column at the specified index of the matrix.
331
+ *
332
+ * @param id - A matrix object
333
+ * @param column - Optional. The index of the new column. Must be a value from 0 to matrix.columns(id).
334
+ * All existing columns with indices >= this value increase their index by one.
335
+ * Default is matrix.columns(id) (append at end).
336
+ * @param array_id - Optional. An array to use as the new column. If the matrix is empty, the array
337
+ * can be of any size. Otherwise, its size must equal matrix.rows(id).
338
+ * By default, inserts a column of undefined values.
339
+ *
340
+ * @remarks
341
+ * Rather than add columns to an empty matrix, it is far more efficient to declare a matrix
342
+ * with explicit dimensions and fill it with values. Adding a column is also much slower
343
+ * than adding a row with matrix.add_row().
344
+ *
345
+ * @example
346
+ * ```typescript
347
+ * // Create a 2x3 matrix with zeros
348
+ * const m = matrix.new_matrix(2, 3, 0);
349
+ *
350
+ * // Add a column at the end with default values
351
+ * matrix.add_col(m);
352
+ *
353
+ * // Add an array as the first column
354
+ * const arr = [1, 2];
355
+ * matrix.add_col(m, 0, arr);
356
+ * ```
357
+ */
358
+ export declare function add_col<T>(id: PineMatrix<T>, column?: simple_int, array_id?: PineArray<T>): void;
359
+ /**
360
+ * Remove row from matrix
361
+ *
362
+ * Removes the row at the specified index and returns an array containing the removed row's values.
363
+ *
364
+ * @param id - A matrix object
365
+ * @param row - Optional. The index of the row to be deleted.
366
+ * Default is matrix.rows(id) - 1 (last row).
367
+ * @returns An array containing the elements of the removed row
368
+ *
369
+ * @remarks
370
+ * Indexing of rows starts at zero.
371
+ * It is far more efficient to declare matrices with explicit dimensions than to build them
372
+ * by adding or removing rows.
373
+ *
374
+ * @example
375
+ * ```typescript
376
+ * // Create a 2x2 matrix
377
+ * const m = matrix.new_matrix(2, 2, 1);
378
+ * matrix.set(m, 0, 1, 2);
379
+ * matrix.set(m, 1, 0, 3);
380
+ * matrix.set(m, 1, 1, 4);
381
+ *
382
+ * // Remove the first row
383
+ * const arr = matrix.remove_row(m, 0); // Returns: [1, 2]
384
+ * // Matrix now has 1 row
385
+ * ```
386
+ */
387
+ export declare function remove_row<T>(id: PineMatrix<T>, row?: simple_int): PineArray<T>;
388
+ /**
389
+ * Remove column from matrix
390
+ *
391
+ * Removes the column at the specified index and returns an array containing the removed column's values.
392
+ *
393
+ * @param id - A matrix object
394
+ * @param column - Optional. The index of the column to be removed.
395
+ * Default is matrix.columns(id) - 1 (last column).
396
+ * @returns An array containing the elements of the removed column
397
+ *
398
+ * @remarks
399
+ * Indexing of columns starts at zero.
400
+ * It is far more efficient to declare matrices with explicit dimensions than to build them
401
+ * by adding or removing columns. Deleting a column is also much slower than deleting a row
402
+ * with matrix.remove_row().
403
+ *
404
+ * @example
405
+ * ```typescript
406
+ * // Create a 2x2 matrix
407
+ * const m = matrix.new_matrix(2, 2, 1);
408
+ * matrix.set(m, 0, 1, 2);
409
+ * matrix.set(m, 1, 0, 3);
410
+ * matrix.set(m, 1, 1, 4);
411
+ *
412
+ * // Remove the first column
413
+ * const arr = matrix.remove_col(m, 0); // Returns: [1, 3]
414
+ * // Matrix now has 1 column
415
+ * ```
416
+ */
417
+ export declare function remove_col<T>(id: PineMatrix<T>, column?: simple_int): PineArray<T>;
418
+ /**
419
+ * Swap two rows
420
+ *
421
+ * Swaps the rows at the index row1 and row2 in the matrix.
422
+ *
423
+ * @param id - A matrix object
424
+ * @param row1 - Index of the first row to be swapped
425
+ * @param row2 - Index of the second row to be swapped
426
+ *
427
+ * @remarks
428
+ * Indexing of rows starts at zero.
429
+ *
430
+ * @example
431
+ * ```typescript
432
+ * // Create a 3x2 matrix
433
+ * const m = matrix.new_matrix(3, 2, 0);
434
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2);
435
+ * matrix.set(m, 1, 0, 3); matrix.set(m, 1, 1, 4);
436
+ * matrix.set(m, 2, 0, 5); matrix.set(m, 2, 1, 6);
437
+ *
438
+ * // Swap first and second rows
439
+ * matrix.swap_rows(m, 0, 1);
440
+ * // Now row 0 is [3, 4] and row 1 is [1, 2]
441
+ * ```
442
+ */
443
+ export declare function swap_rows<T>(id: PineMatrix<T>, row1: simple_int, row2: simple_int): void;
444
+ /**
445
+ * Swap two columns
446
+ *
447
+ * Swaps the columns at the index column1 and column2 in the matrix.
448
+ *
449
+ * @param id - A matrix object
450
+ * @param column1 - Index of the first column to be swapped
451
+ * @param column2 - Index of the second column to be swapped
452
+ *
453
+ * @remarks
454
+ * Indexing of columns starts at zero.
455
+ *
456
+ * @example
457
+ * ```typescript
458
+ * // Create a 2x2 matrix
459
+ * const m = matrix.new_matrix(2, 2, 0);
460
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2);
461
+ * matrix.set(m, 1, 0, 3); matrix.set(m, 1, 1, 4);
462
+ *
463
+ * // Swap first and second columns
464
+ * matrix.swap_columns(m, 0, 1);
465
+ * // Now column 0 is [2, 4] and column 1 is [1, 3]
466
+ * ```
467
+ */
468
+ export declare function swap_columns<T>(id: PineMatrix<T>, column1: simple_int, column2: simple_int): void;
469
+ /**
470
+ * Matrix transpose
471
+ *
472
+ * Creates a new, transposed version of the matrix. This interchanges the row and column
473
+ * index of each element.
474
+ *
475
+ * @param id - A matrix object
476
+ * @returns A new matrix containing the transposed version
477
+ *
478
+ * @example
479
+ * ```typescript
480
+ * // Create a 2x3 matrix
481
+ * const m1 = matrix.new_matrix(2, 3, 0);
482
+ * matrix.set(m1, 0, 0, 1); matrix.set(m1, 0, 1, 2); matrix.set(m1, 0, 2, 3);
483
+ * matrix.set(m1, 1, 0, 4); matrix.set(m1, 1, 1, 5); matrix.set(m1, 1, 2, 6);
484
+ *
485
+ * // Transpose to get a 3x2 matrix
486
+ * const m2 = matrix.transpose(m1);
487
+ * // m2 = [[1, 4], [2, 5], [3, 6]]
488
+ * ```
489
+ */
490
+ export declare function transpose<T>(id: PineMatrix<T>): PineMatrix<T>;
491
+ /**
492
+ * Concatenate matrices
493
+ *
494
+ * Appends the rows of m2 matrix to m1 matrix (vertical concatenation).
495
+ *
496
+ * @param id1 - Matrix object to concatenate into
497
+ * @param id2 - Matrix object whose rows will be appended to id1
498
+ * @returns Returns the id1 matrix concatenated with the id2 matrix
499
+ *
500
+ * @remarks
501
+ * The number of columns in both matrices must be identical.
502
+ *
503
+ * @example
504
+ * ```typescript
505
+ * // Create two 2x4 matrices
506
+ * const m1 = matrix.new_matrix(2, 4, 0);
507
+ * const m2 = matrix.new_matrix(2, 4, 1);
508
+ *
509
+ * // Append m2 to m1
510
+ * matrix.concat(m1, m2);
511
+ * // m1 is now 4x4
512
+ * ```
513
+ */
514
+ export declare function concat<T>(id1: PineMatrix<T>, id2: PineMatrix<T>): PineMatrix<T>;
515
+ /**
516
+ * Extract submatrix
517
+ *
518
+ * Extracts a submatrix from the matrix within the specified indices.
519
+ *
520
+ * @param id - A matrix object
521
+ * @param from_row - Row index from which extraction begins (inclusive). Default: 0
522
+ * @param to_row - Row index where extraction ends (exclusive). Default: matrix.rows(id)
523
+ * @param from_column - Column index from which extraction begins (inclusive). Default: 0
524
+ * @param to_column - Column index where extraction ends (exclusive). Default: matrix.columns(id)
525
+ * @returns A new matrix object containing the submatrix
526
+ *
527
+ * @remarks
528
+ * Indexing of rows and columns starts at zero.
529
+ *
530
+ * @example
531
+ * ```typescript
532
+ * // Create a 2x3 matrix
533
+ * const m1 = matrix.new_matrix(2, 3, 0);
534
+ * matrix.set(m1, 0, 0, 1); matrix.set(m1, 0, 1, 2); matrix.set(m1, 0, 2, 3);
535
+ * matrix.set(m1, 1, 0, 4); matrix.set(m1, 1, 1, 5); matrix.set(m1, 1, 2, 6);
536
+ *
537
+ * // Extract a 2x2 submatrix (columns 1-2)
538
+ * const m2 = matrix.submatrix(m1, 0, 2, 1, 3);
539
+ * // m2 = [[2, 3], [5, 6]]
540
+ * ```
541
+ */
542
+ export declare function submatrix<T>(id: PineMatrix<T>, from_row?: simple_int, to_row?: simple_int, from_column?: simple_int, to_column?: simple_int): PineMatrix<T>;
543
+ /**
544
+ * Reshape matrix
545
+ *
546
+ * Rebuilds the matrix to new dimensions. The total number of elements must remain the same.
547
+ *
548
+ * @param id - A matrix object
549
+ * @param rows - The number of rows of the reshaped matrix
550
+ * @param columns - The number of columns of the reshaped matrix
551
+ *
552
+ * @remarks
553
+ * The product of rows * columns must equal the current element count.
554
+ * Elements are read row by row and placed in the new shape row by row.
555
+ *
556
+ * @example
557
+ * ```typescript
558
+ * // Create a 2x3 matrix
559
+ * const m = matrix.new_matrix(2, 3, 0);
560
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2); matrix.set(m, 0, 2, 3);
561
+ * matrix.set(m, 1, 0, 4); matrix.set(m, 1, 1, 5); matrix.set(m, 1, 2, 6);
562
+ *
563
+ * // Reshape to 3x2
564
+ * matrix.reshape(m, 3, 2);
565
+ * // m = [[1, 2], [3, 4], [5, 6]]
566
+ * ```
567
+ */
568
+ export declare function reshape<T>(id: PineMatrix<T>, rows: simple_int, columns: simple_int): void;
569
+ /**
570
+ * Reverse matrix
571
+ *
572
+ * Reverses the order of rows and columns in the matrix. The first row and first column
573
+ * become the last, and the last become the first.
574
+ *
575
+ * @param id - A matrix object
576
+ *
577
+ * @remarks
578
+ * This modifies the matrix in place. Both rows and columns are reversed.
579
+ *
580
+ * @example
581
+ * ```typescript
582
+ * // Create a 2x2 matrix
583
+ * const m = matrix.new_matrix(2, 2, 0);
584
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2);
585
+ * matrix.set(m, 1, 0, 3); matrix.set(m, 1, 1, 4);
586
+ *
587
+ * // Reverse the matrix
588
+ * matrix.reverse(m);
589
+ * // m = [[4, 3], [2, 1]]
590
+ * ```
591
+ */
592
+ export declare function reverse<T>(id: PineMatrix<T>): void;
593
+ /**
594
+ * Sort matrix by column
595
+ *
596
+ * Rearranges the rows in the matrix following the sorted order of values in the specified column.
597
+ *
598
+ * @param id - A matrix object to be sorted
599
+ * @param column - Index of the column whose values determine the new order of rows. Default: 0
600
+ * @param order - The sort order: 'ascending' or 'descending'. Default: 'ascending'
601
+ *
602
+ * @remarks
603
+ * This modifies the matrix in place.
604
+ *
605
+ * @example
606
+ * ```typescript
607
+ * // Create a 2x2 matrix
608
+ * const m = matrix.new_matrix(2, 2, 0);
609
+ * matrix.set(m, 0, 0, 3); matrix.set(m, 0, 1, 4);
610
+ * matrix.set(m, 1, 0, 1); matrix.set(m, 1, 1, 2);
611
+ *
612
+ * // Sort by first column (ascending)
613
+ * matrix.sort(m);
614
+ * // m = [[1, 2], [3, 4]]
615
+ * ```
616
+ */
617
+ export declare function sort<T extends number | string>(id: PineMatrix<T>, column?: simple_int, order?: 'ascending' | 'descending'): void;
618
+ /**
619
+ * Matrix addition (sum)
620
+ *
621
+ * Returns a new matrix resulting from the element-wise sum of two matrices,
622
+ * or of a matrix and a scalar.
623
+ *
624
+ * @param id1 - First matrix object
625
+ * @param id2 - Second matrix object, or scalar value
626
+ * @returns A new matrix containing the sum
627
+ *
628
+ * @remarks
629
+ * When adding two matrices, they must have the same dimensions.
630
+ *
631
+ * @example
632
+ * ```typescript
633
+ * // Sum of two matrices
634
+ * const m1 = matrix.new_matrix(2, 3, 5);
635
+ * const m2 = matrix.new_matrix(2, 3, 4);
636
+ * const m3 = matrix.sum(m1, m2); // All elements are 9
637
+ *
638
+ * // Sum of matrix and scalar
639
+ * const m4 = matrix.new_matrix(2, 3, 4);
640
+ * const m5 = matrix.sum(m4, 1); // All elements are 5
641
+ * ```
642
+ */
643
+ export declare function sum(id1: PineMatrix<float>, id2: PineMatrix<float> | float): PineMatrix<float>;
644
+ /**
645
+ * Matrix subtraction (diff)
646
+ *
647
+ * Returns a new matrix resulting from the element-wise subtraction between two matrices,
648
+ * or of a matrix and a scalar.
649
+ *
650
+ * @param id1 - Matrix to subtract from
651
+ * @param id2 - Matrix object or scalar value to be subtracted
652
+ * @returns A new matrix containing the difference
653
+ *
654
+ * @remarks
655
+ * When subtracting two matrices, they must have the same dimensions.
656
+ *
657
+ * @example
658
+ * ```typescript
659
+ * // Difference between two matrices
660
+ * const m1 = matrix.new_matrix(2, 3, 5);
661
+ * const m2 = matrix.new_matrix(2, 3, 4);
662
+ * const m3 = matrix.diff(m1, m2); // All elements are 1
663
+ *
664
+ * // Difference between matrix and scalar
665
+ * const m4 = matrix.new_matrix(2, 3, 4);
666
+ * const m5 = matrix.diff(m4, 1); // All elements are 3
667
+ * ```
668
+ */
669
+ export declare function diff(id1: PineMatrix<float>, id2: PineMatrix<float> | float): PineMatrix<float>;
670
+ /**
671
+ * Average of all elements
672
+ *
673
+ * Calculates the average of all elements in the matrix.
674
+ *
675
+ * @param id - A matrix object
676
+ * @returns The average value from the matrix
677
+ *
678
+ * @example
679
+ * ```typescript
680
+ * // Create a 2x2 matrix
681
+ * const m = matrix.new_matrix(2, 2, 0);
682
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2);
683
+ * matrix.set(m, 1, 0, 3); matrix.set(m, 1, 1, 4);
684
+ *
685
+ * const avg = matrix.avg(m); // Returns: 2.5
686
+ * ```
687
+ */
688
+ export declare function avg(id: PineMatrix<float>): float;
689
+ /**
690
+ * Minimum element
691
+ *
692
+ * Returns the smallest value from the matrix elements.
693
+ *
694
+ * @param id - A matrix object
695
+ * @returns The smallest value from the matrix
696
+ *
697
+ * @example
698
+ * ```typescript
699
+ * // Create a 2x2 matrix
700
+ * const m = matrix.new_matrix(2, 2, 0);
701
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2);
702
+ * matrix.set(m, 1, 0, 3); matrix.set(m, 1, 1, 4);
703
+ *
704
+ * const minVal = matrix.min(m); // Returns: 1
705
+ * ```
706
+ */
707
+ export declare function min(id: PineMatrix<float>): float;
708
+ /**
709
+ * Maximum element
710
+ *
711
+ * Returns the largest value from the matrix elements.
712
+ *
713
+ * @param id - A matrix object
714
+ * @returns The largest value from the matrix
715
+ *
716
+ * @example
717
+ * ```typescript
718
+ * // Create a 2x2 matrix
719
+ * const m = matrix.new_matrix(2, 2, 0);
720
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2);
721
+ * matrix.set(m, 1, 0, 3); matrix.set(m, 1, 1, 4);
722
+ *
723
+ * const maxVal = matrix.max(m); // Returns: 4
724
+ * ```
725
+ */
726
+ export declare function max(id: PineMatrix<float>): float;
727
+ /**
728
+ * Median element
729
+ *
730
+ * Calculates the median ("the middle" value) of matrix elements.
731
+ *
732
+ * @param id - A matrix object
733
+ * @returns The median value from the matrix
734
+ *
735
+ * @remarks
736
+ * NA elements of the matrix are not considered when calculating the median.
737
+ *
738
+ * @example
739
+ * ```typescript
740
+ * // Create a 2x2 matrix
741
+ * const m = matrix.new_matrix(2, 2, 0);
742
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2);
743
+ * matrix.set(m, 1, 0, 3); matrix.set(m, 1, 1, 4);
744
+ *
745
+ * const medianVal = matrix.median(m); // Returns: 2.5
746
+ * ```
747
+ */
748
+ export declare function median(id: PineMatrix<float>): float;
749
+ /**
750
+ * Mode (most frequent element)
751
+ *
752
+ * Calculates the mode of the matrix, which is the most frequently occurring value.
753
+ * When there are multiple values occurring equally frequently, returns the smallest.
754
+ *
755
+ * @param id - A matrix object
756
+ * @returns The most frequently occurring value, or the smallest if tie
757
+ *
758
+ * @remarks
759
+ * NA elements of the matrix are not considered when calculating the mode.
760
+ *
761
+ * @example
762
+ * ```typescript
763
+ * // Create a 2x2 matrix
764
+ * const m = matrix.new_matrix(2, 2, 0);
765
+ * matrix.set(m, 0, 0, 0); matrix.set(m, 0, 1, 0);
766
+ * matrix.set(m, 1, 0, 1); matrix.set(m, 1, 1, 1);
767
+ *
768
+ * const modeVal = matrix.mode(m); // Returns: 0 (tie, so smallest)
769
+ * ```
770
+ */
771
+ export declare function mode(id: PineMatrix<float>): float;
772
+ /**
773
+ * Matrix trace
774
+ *
775
+ * Calculates the trace of a matrix (the sum of the main diagonal's elements).
776
+ *
777
+ * @param id - A matrix object (must be square)
778
+ * @returns The trace of the matrix
779
+ *
780
+ * @remarks
781
+ * The matrix must be square. Throws an error for non-square matrices.
782
+ *
783
+ * @example
784
+ * ```typescript
785
+ * // Create a 2x2 matrix
786
+ * const m = matrix.new_matrix(2, 2, 0);
787
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2);
788
+ * matrix.set(m, 1, 0, 3); matrix.set(m, 1, 1, 4);
789
+ *
790
+ * const tr = matrix.trace(m); // Returns: 5 (1 + 4)
791
+ * ```
792
+ */
793
+ export declare function trace(id: PineMatrix<float>): float;
794
+ /**
795
+ * Test if diagonal matrix
796
+ *
797
+ * Determines if the matrix is diagonal (all elements outside the main diagonal are zero).
798
+ *
799
+ * @param id - Matrix object to test
800
+ * @returns true if the matrix is diagonal, false otherwise
801
+ *
802
+ * @remarks
803
+ * Returns false with non-square matrices.
804
+ *
805
+ * @example
806
+ * ```typescript
807
+ * // Create a diagonal matrix
808
+ * const m = matrix.new_matrix(3, 3, 0);
809
+ * matrix.set(m, 0, 0, 1);
810
+ * matrix.set(m, 1, 1, 2);
811
+ * matrix.set(m, 2, 2, 3);
812
+ *
813
+ * const isDiag = matrix.is_diagonal(m); // Returns: true
814
+ * ```
815
+ */
816
+ export declare function is_diagonal(id: PineMatrix<float>): bool;
817
+ /**
818
+ * Test if identity matrix
819
+ *
820
+ * Determines if a matrix is an identity matrix (elements with ones on the main diagonal
821
+ * and zeros elsewhere).
822
+ *
823
+ * @param id - Matrix object to test
824
+ * @returns true if id is an identity matrix, false otherwise
825
+ *
826
+ * @remarks
827
+ * Returns false with non-square matrices.
828
+ *
829
+ * @example
830
+ * ```typescript
831
+ * // Create an identity matrix
832
+ * const m = matrix.new_matrix(3, 3, 0);
833
+ * matrix.set(m, 0, 0, 1);
834
+ * matrix.set(m, 1, 1, 1);
835
+ * matrix.set(m, 2, 2, 1);
836
+ *
837
+ * const isIdent = matrix.is_identity(m); // Returns: true
838
+ * ```
839
+ */
840
+ export declare function is_identity(id: PineMatrix<float>): bool;
841
+ /**
842
+ * Test if symmetric matrix
843
+ *
844
+ * Determines if a square matrix is symmetric (elements are symmetric with respect
845
+ * to the main diagonal, i.e., matrix equals its transpose).
846
+ *
847
+ * @param id - Matrix object to test
848
+ * @returns true if the matrix is symmetric, false otherwise
849
+ *
850
+ * @remarks
851
+ * Returns false with non-square matrices.
852
+ *
853
+ * @example
854
+ * ```typescript
855
+ * // Create a symmetric matrix
856
+ * const m = matrix.new_matrix(3, 3, 0);
857
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2); matrix.set(m, 0, 2, 3);
858
+ * matrix.set(m, 1, 0, 2); matrix.set(m, 1, 1, 4); matrix.set(m, 1, 2, 5);
859
+ * matrix.set(m, 2, 0, 3); matrix.set(m, 2, 1, 5); matrix.set(m, 2, 2, 6);
860
+ *
861
+ * const isSym = matrix.is_symmetric(m); // Returns: true
862
+ * ```
863
+ */
864
+ export declare function is_symmetric(id: PineMatrix<float>): bool;
865
+ /**
866
+ * Test if antisymmetric (skew-symmetric) matrix
867
+ *
868
+ * Determines if a matrix is antisymmetric (its transpose equals its negative).
869
+ * A[i][j] = -A[j][i] for all i, j, and diagonal elements must be 0.
870
+ *
871
+ * @param id - Matrix object to test
872
+ * @returns true if the matrix is antisymmetric, false otherwise
873
+ *
874
+ * @remarks
875
+ * Returns false with non-square matrices.
876
+ *
877
+ * @example
878
+ * ```typescript
879
+ * // Create an antisymmetric matrix
880
+ * const m = matrix.new_matrix(3, 3, 0);
881
+ * matrix.set(m, 0, 1, 2); matrix.set(m, 0, 2, -1);
882
+ * matrix.set(m, 1, 0, -2); matrix.set(m, 1, 2, 3);
883
+ * matrix.set(m, 2, 0, 1); matrix.set(m, 2, 1, -3);
884
+ *
885
+ * const isAntiSym = matrix.is_antisymmetric(m); // Returns: true
886
+ * ```
887
+ */
888
+ export declare function is_antisymmetric(id: PineMatrix<float>): bool;
889
+ /**
890
+ * Test if triangular matrix
891
+ *
892
+ * Determines if the matrix is triangular (if all elements above or below the main
893
+ * diagonal are zero).
894
+ *
895
+ * @param id - Matrix object to test
896
+ * @returns true if the matrix is triangular (upper or lower), false otherwise
897
+ *
898
+ * @remarks
899
+ * Returns false with non-square matrices.
900
+ * Returns true if the matrix is either upper triangular or lower triangular.
901
+ *
902
+ * @example
903
+ * ```typescript
904
+ * // Create an upper triangular matrix
905
+ * const m = matrix.new_matrix(3, 3, 0);
906
+ * matrix.set(m, 0, 0, 1); matrix.set(m, 0, 1, 2); matrix.set(m, 0, 2, 3);
907
+ * matrix.set(m, 1, 1, 4); matrix.set(m, 1, 2, 5);
908
+ * matrix.set(m, 2, 2, 6);
909
+ *
910
+ * const isTri = matrix.is_triangular(m); // Returns: true
911
+ * ```
912
+ */
913
+ export declare function is_triangular(id: PineMatrix<float>): bool;
914
+ /**
915
+ * Test if antidiagonal matrix
916
+ *
917
+ * Determines if the matrix is anti-diagonal (all elements outside the secondary
918
+ * diagonal are zero).
919
+ *
920
+ * @param id - Matrix object to test
921
+ * @returns true if the matrix is anti-diagonal, false otherwise
922
+ *
923
+ * @remarks
924
+ * Returns false with non-square matrices.
925
+ * The anti-diagonal runs from top-right to bottom-left.
926
+ *
927
+ * @example
928
+ * ```typescript
929
+ * // Create an antidiagonal matrix
930
+ * const m = matrix.new_matrix(3, 3, 0);
931
+ * matrix.set(m, 0, 2, 1);
932
+ * matrix.set(m, 1, 1, 2);
933
+ * matrix.set(m, 2, 0, 3);
934
+ *
935
+ * const isAntiDiag = matrix.is_antidiagonal(m); // Returns: true
936
+ * ```
937
+ */
938
+ export declare function is_antidiagonal(id: PineMatrix<float>): bool;
939
+ /**
940
+ * Test if stochastic matrix
941
+ *
942
+ * Determines if the matrix is stochastic (all elements are non-negative and all
943
+ * row sums equal 1).
944
+ *
945
+ * @param id - Matrix object to test
946
+ * @returns true if the matrix is stochastic, false otherwise
947
+ *
948
+ * @remarks
949
+ * A right stochastic matrix has rows that sum to 1.
950
+ *
951
+ * @example
952
+ * ```typescript
953
+ * // Create a stochastic matrix
954
+ * const m = matrix.new_matrix(2, 2, 0);
955
+ * matrix.set(m, 0, 0, 0.5); matrix.set(m, 0, 1, 0.5);
956
+ * matrix.set(m, 1, 0, 0.3); matrix.set(m, 1, 1, 0.7);
957
+ *
958
+ * const isStoch = matrix.is_stochastic(m); // Returns: true
959
+ * ```
960
+ */
961
+ export declare function is_stochastic(id: PineMatrix<float>): bool;
962
+ /**
963
+ * Matrix multiplication
964
+ *
965
+ * Returns a new matrix resulting from the product between two matrices,
966
+ * or between a matrix and a scalar, or between a matrix and a vector (array).
967
+ *
968
+ * @param id1 - First matrix object
969
+ * @param id2 - Second matrix object, scalar value, or array (vector)
970
+ * @returns A new matrix containing the product, or array for matrix × vector
971
+ *
972
+ * @remarks
973
+ * For matrix × matrix: id1's columns must equal id2's rows.
974
+ * For matrix × vector: the array length must equal id1's columns.
975
+ * Time complexity: O(n³) for n×n matrices.
976
+ *
977
+ * @example
978
+ * ```typescript
979
+ * // Product of two matrices
980
+ * const m1 = matrix.new_matrix(6, 2, 5);
981
+ * const m2 = matrix.new_matrix(2, 3, 4);
982
+ * const m3 = matrix.mult(m1, m2); // 6x3 matrix with values 40
983
+ *
984
+ * // Product of matrix and scalar
985
+ * const m4 = matrix.new_matrix(2, 3, 4);
986
+ * const m5 = matrix.mult(m4, 5); // All elements are 20
987
+ *
988
+ * // Product of matrix and vector
989
+ * const m6 = matrix.new_matrix(2, 3, 4);
990
+ * const arr = [1, 1, 1];
991
+ * const result = matrix.mult(m6, arr); // [12, 12]
992
+ * ```
993
+ */
994
+ export declare function mult(id1: PineMatrix<float>, id2: PineMatrix<float> | float | PineArray<float>): PineMatrix<float> | PineArray<float>;
995
+ /**
996
+ * Matrix power
997
+ *
998
+ * Calculates the product of the matrix by itself 'power' times.
999
+ * Uses repeated squaring for efficiency: O(n³ log p) for n×n matrix and power p.
1000
+ *
1001
+ * @param id - A matrix object (must be square)
1002
+ * @param power - The number of times the matrix will be multiplied by itself
1003
+ * @returns A new matrix that is id raised to the specified power
1004
+ *
1005
+ * @remarks
1006
+ * The matrix must be square.
1007
+ * power=0 returns the identity matrix.
1008
+ * Negative powers compute the inverse first, then raise to the positive power.
1009
+ *
1010
+ * @example
1011
+ * ```typescript
1012
+ * // Create a 2x2 matrix
1013
+ * const m1 = matrix.new_matrix(2, 2, 2);
1014
+ * // Calculate the power of three
1015
+ * const m2 = matrix.pow(m1, 3);
1016
+ * // m2 = m1 × m1 × m1
1017
+ * ```
1018
+ */
1019
+ export declare function pow(id: PineMatrix<float>, power: int): PineMatrix<float>;
1020
+ /**
1021
+ * Matrix determinant
1022
+ *
1023
+ * Computes the determinant of a square matrix using LU decomposition
1024
+ * with partial pivoting.
1025
+ *
1026
+ * @param id - A matrix object (must be square)
1027
+ * @returns The determinant value
1028
+ *
1029
+ * @remarks
1030
+ * Function calculation based on the LU decomposition algorithm.
1031
+ * Time complexity: O(n³)
1032
+ *
1033
+ * @example
1034
+ * ```typescript
1035
+ * // Create a 2x2 matrix
1036
+ * const m = matrix.new_matrix(2, 2, NaN);
1037
+ * matrix.set(m, 0, 0, 3);
1038
+ * matrix.set(m, 0, 1, 7);
1039
+ * matrix.set(m, 1, 0, 1);
1040
+ * matrix.set(m, 1, 1, -4);
1041
+ *
1042
+ * const d = matrix.det(m); // Returns: -19
1043
+ * ```
1044
+ */
1045
+ export declare function det(id: PineMatrix<float>): float;
1046
+ /**
1047
+ * Matrix inverse
1048
+ *
1049
+ * Computes the inverse of a square matrix using Gauss-Jordan elimination
1050
+ * with partial pivoting.
1051
+ *
1052
+ * @param id - A matrix object (must be square and non-singular)
1053
+ * @returns A new matrix that is the inverse, or null if singular
1054
+ *
1055
+ * @remarks
1056
+ * Function calculation based on the LU decomposition algorithm.
1057
+ * Returns null for singular matrices (det = 0).
1058
+ * Time complexity: O(n³)
1059
+ *
1060
+ * @example
1061
+ * ```typescript
1062
+ * // Create a 2x2 matrix
1063
+ * const m1 = matrix.new_matrix(2, 2, NaN);
1064
+ * matrix.set(m1, 0, 0, 1);
1065
+ * matrix.set(m1, 0, 1, 2);
1066
+ * matrix.set(m1, 1, 0, 3);
1067
+ * matrix.set(m1, 1, 1, 4);
1068
+ *
1069
+ * const m2 = matrix.inv(m1);
1070
+ * // m2 = [[-2, 1], [1.5, -0.5]]
1071
+ * ```
1072
+ */
1073
+ export declare function inv(id: PineMatrix<float>): PineMatrix<float> | null;
1074
+ /**
1075
+ * Matrix pseudo-inverse (Moore-Penrose)
1076
+ *
1077
+ * Computes the pseudo-inverse of a matrix. For non-singular square matrices,
1078
+ * this returns the same result as inv().
1079
+ *
1080
+ * @param id - A matrix object (can be any shape)
1081
+ * @returns A new matrix containing the pseudo-inverse
1082
+ *
1083
+ * @remarks
1084
+ * Uses the formula: A⁺ = (AᵀA)⁻¹Aᵀ for full column rank matrices,
1085
+ * or Aᵀ(AAᵀ)⁻¹ for full row rank matrices.
1086
+ * For singular matrices, uses iterative refinement approach.
1087
+ *
1088
+ * @example
1089
+ * ```typescript
1090
+ * // Create a 2x2 matrix
1091
+ * const m1 = matrix.new_matrix(2, 2, NaN);
1092
+ * matrix.set(m1, 0, 0, 1);
1093
+ * matrix.set(m1, 0, 1, 2);
1094
+ * matrix.set(m1, 1, 0, 3);
1095
+ * matrix.set(m1, 1, 1, 4);
1096
+ *
1097
+ * const m2 = matrix.pinv(m1);
1098
+ * ```
1099
+ */
1100
+ export declare function pinv(id: PineMatrix<float>): PineMatrix<float>;
1101
+ /**
1102
+ * Matrix rank
1103
+ *
1104
+ * Calculates the rank of a matrix (number of linearly independent rows/columns)
1105
+ * using Gaussian elimination to row echelon form.
1106
+ *
1107
+ * @param id - A matrix object
1108
+ * @returns The rank of the matrix
1109
+ *
1110
+ * @remarks
1111
+ * Uses row reduction with partial pivoting.
1112
+ * Time complexity: O(n³)
1113
+ *
1114
+ * @example
1115
+ * ```typescript
1116
+ * // Create a 2x2 matrix
1117
+ * const m1 = matrix.new_matrix(2, 2, NaN);
1118
+ * matrix.set(m1, 0, 0, 1);
1119
+ * matrix.set(m1, 0, 1, 2);
1120
+ * matrix.set(m1, 1, 0, 3);
1121
+ * matrix.set(m1, 1, 1, 4);
1122
+ *
1123
+ * const r = matrix.rank(m1); // Returns: 2
1124
+ * ```
1125
+ */
1126
+ export declare function rank(id: PineMatrix<float>): int;
1127
+ /**
1128
+ * Matrix eigenvalues
1129
+ *
1130
+ * Computes the eigenvalues of a square matrix using the QR algorithm.
1131
+ *
1132
+ * @param id - A matrix object (must be square)
1133
+ * @returns An array containing the eigenvalues
1134
+ *
1135
+ * @remarks
1136
+ * Uses the Implicit QL Algorithm with shifts.
1137
+ * For non-symmetric matrices, only real eigenvalues are returned accurately.
1138
+ * Complex eigenvalues return their real part for 2x2 matrices.
1139
+ * Time complexity: O(n³) per iteration, typically converges in O(n) iterations.
1140
+ *
1141
+ * @example
1142
+ * ```typescript
1143
+ * // Create a 2x2 matrix
1144
+ * const m1 = matrix.new_matrix(2, 2, NaN);
1145
+ * matrix.set(m1, 0, 0, 2);
1146
+ * matrix.set(m1, 0, 1, 4);
1147
+ * matrix.set(m1, 1, 0, 6);
1148
+ * matrix.set(m1, 1, 1, 8);
1149
+ *
1150
+ * const ev = matrix.eigenvalues(m1); // Returns eigenvalues
1151
+ * ```
1152
+ */
1153
+ export declare function eigenvalues(id: PineMatrix<float>): PineArray<float>;
1154
+ /**
1155
+ * Matrix eigenvectors
1156
+ *
1157
+ * Returns a matrix of eigenvectors, where each column is an eigenvector
1158
+ * corresponding to an eigenvalue.
1159
+ *
1160
+ * @param id - A matrix object (must be square)
1161
+ * @returns A new matrix where columns are eigenvectors
1162
+ *
1163
+ * @remarks
1164
+ * Uses inverse iteration method to compute eigenvectors from eigenvalues.
1165
+ * Eigenvectors are normalized to unit length.
1166
+ * Time complexity: O(n³)
1167
+ *
1168
+ * @example
1169
+ * ```typescript
1170
+ * // Create a 2x2 matrix
1171
+ * const m1 = matrix.new_matrix(2, 2, 1);
1172
+ * matrix.set(m1, 0, 0, 2);
1173
+ * matrix.set(m1, 0, 1, 4);
1174
+ * matrix.set(m1, 1, 0, 6);
1175
+ * matrix.set(m1, 1, 1, 8);
1176
+ *
1177
+ * const evecs = matrix.eigenvectors(m1);
1178
+ * // Each column is an eigenvector
1179
+ * ```
1180
+ */
1181
+ export declare function eigenvectors(id: PineMatrix<float>): PineMatrix<float>;
1182
+ /**
1183
+ * Kronecker product
1184
+ *
1185
+ * Computes the Kronecker (tensor) product of two matrices.
1186
+ * Each element of id1 is multiplied by the entire id2 matrix.
1187
+ *
1188
+ * @param id1 - First matrix object
1189
+ * @param id2 - Second matrix object
1190
+ * @returns A new matrix containing the Kronecker product
1191
+ *
1192
+ * @remarks
1193
+ * Result size: (m₁×m₂) rows by (n₁×n₂) columns.
1194
+ * Time complexity: O(m₁×m₂×n₁×n₂)
1195
+ *
1196
+ * @example
1197
+ * ```typescript
1198
+ * // Create two 2x2 matrices
1199
+ * const m1 = matrix.new_matrix(2, 2, 1);
1200
+ * const m2 = matrix.new_matrix(2, 2, 2);
1201
+ *
1202
+ * const m3 = matrix.kron(m1, m2);
1203
+ * // Result is a 4x4 matrix
1204
+ * ```
1205
+ */
1206
+ export declare function kron(id1: PineMatrix<float>, id2: PineMatrix<float>): PineMatrix<float>;
1207
+ /**
1208
+ * Create matrix of user-defined type
1209
+ *
1210
+ * Creates a new matrix that can hold user-defined types.
1211
+ * This is a placeholder that functions identically to new_matrix() for now,
1212
+ * as JavaScript doesn't have the same type system as PineScript.
1213
+ *
1214
+ * @param rows - Initial row count
1215
+ * @param columns - Initial column count
1216
+ * @param initial_value - Initial value for all elements
1217
+ * @returns A new matrix object
1218
+ *
1219
+ * @remarks
1220
+ * In PineScript, this is used for matrices containing user-defined types (UDTs).
1221
+ * In JavaScript, this behaves the same as new_matrix() since type handling
1222
+ * is done at runtime.
1223
+ *
1224
+ * @example
1225
+ * ```typescript
1226
+ * // Create a 2x2 matrix that could hold any type
1227
+ * const m = matrix.newtype(2, 2, { name: 'default', value: 0 });
1228
+ * ```
1229
+ */
1230
+ export declare function newtype<T>(rows?: simple_int, columns?: simple_int, initial_value?: T): PineMatrix<T>;
1231
+ //# sourceMappingURL=index.d.ts.map