ziko 0.0.5 → 0.0.6

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 (235) hide show
  1. package/dist/ziko.cjs +9999 -9853
  2. package/dist/ziko.js +10000 -9854
  3. package/dist/ziko.min.js +2 -2
  4. package/dist/ziko.mjs +9999 -9853
  5. package/package.json +12 -4
  6. package/starter/bin/index.js +10 -0
  7. package/wrapper/react/README.md +26 -0
  8. package/wrapper/react/index.jsx +7 -1
  9. package/wrapper/svelte/ZikoUI.svelte +15 -0
  10. package/wrapper/vue/ZikoUI.vue +8 -2
  11. package/core/App/Accessibility/index.js +0 -0
  12. package/core/App/Globals/__Target__.js +0 -3
  13. package/core/App/Globals/__UI__.js +0 -38
  14. package/core/App/Globals/__init__.js +0 -8
  15. package/core/App/Globals/index.js +0 -18
  16. package/core/App/Router/index.js +0 -40
  17. package/core/App/Seo/index.js +0 -43
  18. package/core/App/Themes/dark.js +0 -885
  19. package/core/App/Themes/index.js +0 -11
  20. package/core/App/Themes/light.js +0 -255
  21. package/core/App/app.js +0 -46
  22. package/core/App/index.js +0 -12
  23. package/core/Data/Api/fetchdom.js +0 -14
  24. package/core/Data/Api/index.js +0 -4
  25. package/core/Data/Api/preload.js +0 -11
  26. package/core/Data/Converter/canvas.js +0 -25
  27. package/core/Data/Converter/csv.js +0 -33
  28. package/core/Data/Converter/index.js +0 -25
  29. package/core/Data/Converter/json.js +0 -80
  30. package/core/Data/Converter/markdown.js +0 -83
  31. package/core/Data/Converter/svg.js +0 -11
  32. package/core/Data/Parser/markdown.js +0 -0
  33. package/core/Data/Parser/xml.js +0 -47
  34. package/core/Data/Strings/index.js +0 -26
  35. package/core/Data/decorators.js +0 -0
  36. package/core/Data/index.js +0 -64
  37. package/core/Graphics/Canvas/Elements/Basic/arc.js +0 -43
  38. package/core/Graphics/Canvas/Elements/Basic/image.js +0 -0
  39. package/core/Graphics/Canvas/Elements/Basic/line.js +0 -26
  40. package/core/Graphics/Canvas/Elements/Basic/path.js +0 -0
  41. package/core/Graphics/Canvas/Elements/Basic/points.js +0 -48
  42. package/core/Graphics/Canvas/Elements/Basic/polygon.js +0 -7
  43. package/core/Graphics/Canvas/Elements/Basic/polyline.js +0 -0
  44. package/core/Graphics/Canvas/Elements/Basic/rect.js +0 -46
  45. package/core/Graphics/Canvas/Elements/Basic/text.js +0 -0
  46. package/core/Graphics/Canvas/Elements/Chart/histogram.js +0 -0
  47. package/core/Graphics/Canvas/Elements/Chart/plot.js +0 -0
  48. package/core/Graphics/Canvas/Elements/Chart/scatter.js +0 -2
  49. package/core/Graphics/Canvas/Elements/Chart/stem.js +0 -0
  50. package/core/Graphics/Canvas/Elements/Element.js +0 -115
  51. package/core/Graphics/Canvas/Elements/Groupe.js +0 -0
  52. package/core/Graphics/Canvas/Elements/grid.js +0 -0
  53. package/core/Graphics/Canvas/Elements/index.js +0 -13
  54. package/core/Graphics/Canvas/Filter/index.js +0 -0
  55. package/core/Graphics/Canvas/Paint/index.js +0 -0
  56. package/core/Graphics/Canvas/Utils/color.js +0 -8
  57. package/core/Graphics/Canvas/Utils/floodFill.js +0 -58
  58. package/core/Graphics/Canvas/_canvas_offscreen +0 -0
  59. package/core/Graphics/Canvas/canvas.js +0 -189
  60. package/core/Graphics/Canvas/index.js +0 -15
  61. package/core/Graphics/Svg/Elements/ZikoSvgElement.js +0 -28
  62. package/core/Graphics/Svg/Elements/circle.js +0 -34
  63. package/core/Graphics/Svg/Elements/ellipse.js +0 -29
  64. package/core/Graphics/Svg/Elements/foreignObject.js +0 -46
  65. package/core/Graphics/Svg/Elements/grid.js +0 -9
  66. package/core/Graphics/Svg/Elements/groupe.js +0 -29
  67. package/core/Graphics/Svg/Elements/image.js +0 -33
  68. package/core/Graphics/Svg/Elements/line.js +0 -29
  69. package/core/Graphics/Svg/Elements/path.js +0 -59
  70. package/core/Graphics/Svg/Elements/polygon.js +0 -31
  71. package/core/Graphics/Svg/Elements/polyline.js +0 -4
  72. package/core/Graphics/Svg/Elements/rect.js +0 -43
  73. package/core/Graphics/Svg/Elements/text.js +0 -26
  74. package/core/Graphics/Svg/index.js +0 -1
  75. package/core/Graphics/Svg/svg.js +0 -117
  76. package/core/Graphics/index.js +0 -61
  77. package/core/Math/Calculus/Special Functions/bessel.js +0 -31
  78. package/core/Math/Calculus/Special Functions/beta.js +0 -38
  79. package/core/Math/Calculus/Special Functions/gamma.js +0 -30
  80. package/core/Math/Calculus/Special Functions/index.js +0 -4
  81. package/core/Math/Calculus/index.js +0 -1
  82. package/core/Math/Complex/Fractals/julia.js +0 -0
  83. package/core/Math/Complex/index.js +0 -191
  84. package/core/Math/Discret/Combinaison/index.js +0 -34
  85. package/core/Math/Discret/Conversion/index.js +0 -86
  86. package/core/Math/Discret/Logic/index.js +0 -46
  87. package/core/Math/Discret/Permutation/index.js +0 -31
  88. package/core/Math/Discret/Set/index.js +0 -2
  89. package/core/Math/Discret/Set/powerSet.js +0 -15
  90. package/core/Math/Discret/Set/subSet.js +0 -10
  91. package/core/Math/Discret/index.js +0 -23
  92. package/core/Math/Functions/index.js +0 -182
  93. package/core/Math/Matrix/Decomposition.js +0 -90
  94. package/core/Math/Matrix/LinearSystem.js +0 -10
  95. package/core/Math/Matrix/Matrix.js +0 -712
  96. package/core/Math/Matrix/index.js +0 -3
  97. package/core/Math/Numeric/index.js +0 -0
  98. package/core/Math/Random/index.js +0 -173
  99. package/core/Math/Signal/__np.py.txt +0 -40
  100. package/core/Math/Signal/conv.js +0 -175
  101. package/core/Math/Signal/fft.js +0 -55
  102. package/core/Math/Signal/filter.js +0 -39
  103. package/core/Math/Signal/functions.js +0 -146
  104. package/core/Math/Signal/index.js +0 -110
  105. package/core/Math/Statistics/Functions/index.js +0 -100
  106. package/core/Math/Statistics/index.js +0 -16
  107. package/core/Math/Utils/arithmetic.js +0 -139
  108. package/core/Math/Utils/checkers.js +0 -11
  109. package/core/Math/Utils/comparaison.js +0 -1
  110. package/core/Math/Utils/conversions.js +0 -7
  111. package/core/Math/Utils/discret.js +0 -28
  112. package/core/Math/Utils/index.js +0 -102
  113. package/core/Math/Utils/mapfun.js +0 -43
  114. package/core/Math/absract.js +0 -1
  115. package/core/Math/const.js +0 -3
  116. package/core/Math/index.js +0 -193
  117. package/core/Reactivity/Events/Global/Click.js +0 -56
  118. package/core/Reactivity/Events/Global/Clipboard.js +0 -84
  119. package/core/Reactivity/Events/Global/CustomEvent.js +0 -53
  120. package/core/Reactivity/Events/Global/Drag.js +0 -137
  121. package/core/Reactivity/Events/Global/Focus.js +0 -56
  122. package/core/Reactivity/Events/Global/Key.js +0 -104
  123. package/core/Reactivity/Events/Global/Mouse.js +0 -230
  124. package/core/Reactivity/Events/Global/Pointer.js +0 -214
  125. package/core/Reactivity/Events/Global/Touch.js +0 -0
  126. package/core/Reactivity/Events/Global/Wheel.js +0 -44
  127. package/core/Reactivity/Events/Partiel/Hash.js +0 -44
  128. package/core/Reactivity/Events/Partiel/Input.js +0 -59
  129. package/core/Reactivity/Events/Partiel/MediaEvent.js +0 -1
  130. package/core/Reactivity/Events/ZikoEvent.js +0 -91
  131. package/core/Reactivity/Events/index.js +0 -60
  132. package/core/Reactivity/Observer/index.js +0 -3
  133. package/core/Reactivity/Observer/intersection.js +0 -40
  134. package/core/Reactivity/Observer/mutation.js +0 -90
  135. package/core/Reactivity/Observer/resize.js +0 -47
  136. package/core/Reactivity/Use/Contexte/index.js +0 -1
  137. package/core/Reactivity/Use/Contexte/useSuccesifKeys.js +0 -14
  138. package/core/Reactivity/Use/Decorators/index.js +0 -4
  139. package/core/Reactivity/Use/Interactions/index.js +0 -4
  140. package/core/Reactivity/Use/Interactions/useBluetooth.js +0 -48
  141. package/core/Reactivity/Use/Interactions/useChannel.js +0 -50
  142. package/core/Reactivity/Use/Interactions/useEventEmmiter.js +0 -64
  143. package/core/Reactivity/Use/Interactions/useSerial.js +0 -0
  144. package/core/Reactivity/Use/Interactions/useThread.js +0 -44
  145. package/core/Reactivity/Use/Interactions/useUsb.js +0 -0
  146. package/core/Reactivity/Use/Sensors/index.js +0 -2
  147. package/core/Reactivity/Use/Sensors/useBattery.js +0 -36
  148. package/core/Reactivity/Use/Sensors/useCamera.js +0 -0
  149. package/core/Reactivity/Use/Sensors/useGeolocation.js +0 -17
  150. package/core/Reactivity/Use/Sensors/useMicro.js +0 -0
  151. package/core/Reactivity/Use/Sensors/useOrientation.js +0 -0
  152. package/core/Reactivity/Use/Storage/index.js +0 -1
  153. package/core/Reactivity/Use/Storage/useCookie.js +0 -0
  154. package/core/Reactivity/Use/Storage/useIndexedDb.js +0 -0
  155. package/core/Reactivity/Use/Storage/useStorage.js +0 -74
  156. package/core/Reactivity/Use/UI/index.js +0 -4
  157. package/core/Reactivity/Use/UI/useCssLink.js +0 -0
  158. package/core/Reactivity/Use/UI/useCssText.js +0 -21
  159. package/core/Reactivity/Use/UI/useFavIcon.js +0 -38
  160. package/core/Reactivity/Use/UI/useLinearGradient.js +0 -0
  161. package/core/Reactivity/Use/UI/useMediaQuery.js +0 -1
  162. package/core/Reactivity/Use/UI/useRadialGradient.js +0 -0
  163. package/core/Reactivity/Use/UI/useStyle.js +0 -54
  164. package/core/Reactivity/Use/UI/useTheme.js +0 -62
  165. package/core/Reactivity/Use/UI/useTitle.js +0 -30
  166. package/core/Reactivity/Use/index.js +0 -82
  167. package/core/Reactivity/Use/todo.md +0 -26
  168. package/core/Reactivity/index.js +0 -3
  169. package/core/Time/animation.js +0 -76
  170. package/core/Time/index.js +0 -54
  171. package/core/Time/loop.js +0 -83
  172. package/core/Time/utils/decorators.js +0 -17
  173. package/core/Time/utils/ease.js +0 -144
  174. package/core/Time/utils/index.js +0 -18
  175. package/core/Time/utils/performance.js +0 -16
  176. package/core/Time/utils/ui.js +0 -26
  177. package/core/UI/CustomElement/Elements/Accordion/index.js +0 -62
  178. package/core/UI/CustomElement/Elements/Carousel/index.js +0 -47
  179. package/core/UI/CustomElement/Elements/CodeNote/CodeCell.js +0 -176
  180. package/core/UI/CustomElement/Elements/CodeNote/CodeNote.js +0 -69
  181. package/core/UI/CustomElement/Elements/CodeNote/SubElements.js +0 -64
  182. package/core/UI/CustomElement/Elements/CodeNote/index.js +0 -2
  183. package/core/UI/CustomElement/Elements/Columns.js +0 -1
  184. package/core/UI/CustomElement/Elements/FAB.js +0 -0
  185. package/core/UI/CustomElement/Elements/Menu.js +0 -0
  186. package/core/UI/CustomElement/Elements/Notification.js +0 -0
  187. package/core/UI/CustomElement/Elements/Popover.js +0 -0
  188. package/core/UI/CustomElement/Elements/Popup.js +0 -0
  189. package/core/UI/CustomElement/Elements/Swipper.js +0 -4
  190. package/core/UI/CustomElement/Elements/Tabs/index.js +0 -111
  191. package/core/UI/CustomElement/Elements/Timeline.js +0 -0
  192. package/core/UI/CustomElement/Elements/Toast.js +0 -0
  193. package/core/UI/CustomElement/Elements/Treeview.js +0 -0
  194. package/core/UI/CustomElement/Elements/index.js +0 -4
  195. package/core/UI/CustomElement/Flex.js +0 -97
  196. package/core/UI/CustomElement/Grid.js +0 -30
  197. package/core/UI/CustomElement/index.js +0 -3
  198. package/core/UI/Embaded/index.js +0 -1
  199. package/core/UI/Inputs/Primitives/btn.js +0 -30
  200. package/core/UI/Inputs/Primitives/elements.js +0 -28
  201. package/core/UI/Inputs/Primitives/inputs.js +0 -324
  202. package/core/UI/Inputs/Primitives/select.js +0 -14
  203. package/core/UI/Inputs/Primitives/textarea.js +0 -15
  204. package/core/UI/Inputs/camera.js +0 -23
  205. package/core/UI/Inputs/index.js +0 -20
  206. package/core/UI/List/elements.js +0 -0
  207. package/core/UI/List/index.js +0 -127
  208. package/core/UI/Media/Audio/index.js +0 -38
  209. package/core/UI/Media/Image/figure.js +0 -16
  210. package/core/UI/Media/Image/image.js +0 -33
  211. package/core/UI/Media/Image/index.js +0 -2
  212. package/core/UI/Media/Video/index.js +0 -49
  213. package/core/UI/Media/index.js +0 -3
  214. package/core/UI/Misc/index.js +0 -45
  215. package/core/UI/Semantic/index.js +0 -61
  216. package/core/UI/Style/index.js +0 -499
  217. package/core/UI/Table/elements.js +0 -94
  218. package/core/UI/Table/index.js +0 -3
  219. package/core/UI/Table/table.js +0 -112
  220. package/core/UI/Table/utils.js +0 -12
  221. package/core/UI/Text/heading.js +0 -34
  222. package/core/UI/Text/index.js +0 -3
  223. package/core/UI/Text/p.js +0 -36
  224. package/core/UI/Text/pre.js +0 -0
  225. package/core/UI/Text/text.js +0 -65
  226. package/core/UI/Utils/index.js +0 -70
  227. package/core/UI/ZikoUIElement.js +0 -503
  228. package/core/UI/index.js +0 -154
  229. package/core/__proto__/Array.js +0 -74
  230. package/core/__proto__/Function.js +0 -0
  231. package/core/__proto__/Number.js +0 -76
  232. package/core/__proto__/Object.js +0 -0
  233. package/core/__proto__/String.js +0 -0
  234. package/core/index.js +0 -72
  235. package/wrapper/react/readme.md +0 -19
@@ -1,110 +0,0 @@
1
- import { mapfun } from "../Utils";
2
- import { abs , sinc , sign , sin } from "../Functions/index.js"
3
- import { Random } from "../Random/index.js";
4
- import {
5
- zeros,
6
- ones,
7
- nums,
8
- arange,
9
- linspace,
10
- logspace,
11
- geomspace,
12
- map,
13
- norm,
14
- lerp,
15
- clamp,
16
- } from "./functions.js";
17
- import{
18
- fft,
19
- ifft
20
- } from "./fft.js"
21
- import {
22
- conv,
23
- conv1d,
24
- conv2d,
25
- circularConv,
26
- linearConv,
27
- circularConv1d,
28
- linearConv1d,
29
- circularConv2d,
30
- linearConv2d
31
- } from "./conv.js";
32
- import {
33
- filter
34
- } from "./filter.js";
35
- //import { Matrix } from "../Matrix/index.js";
36
- const Signal={
37
- zeros,
38
- ones,
39
- nums,
40
- arange,
41
- linspace,
42
- logspace,
43
- geomspace,
44
- map,
45
- norm,
46
- lerp,
47
- clamp,
48
- noise(n,min = 0,max = 1){
49
- return Random.floats(n,min,max);
50
- },
51
- echelon(t,t0 = 0 , A = 1){
52
- if(!(t instanceof Array))t=[t];
53
- const Y = mapfun(n=>n>=t0?1:0,...t);
54
- return Y instanceof Array ? Y.map(n=>n*A) : Y*A
55
- },
56
- rampe(t,t0 = 0 , A = 1){
57
- if(!(t instanceof Array))t=[t]
58
- const Y = mapfun(n=>n>=t0?n-t0:0,...t);
59
- return Y instanceof Array ? Y.map(n=>n*A) : Y*A
60
- },
61
- sign(t,t0 = 0 , A = 1){
62
- if(!(t instanceof Array))t=[t]
63
- const Y = mapfun(n=>Math.sign(n-t0),...t);
64
- return Y instanceof Array ? Y.map(n=>n*A) : Y*A
65
- },
66
- rect(t,T,t0 = 0, A = 1){
67
- if(!(t instanceof Array))t=[t];
68
- const Y = mapfun(n=>((t0-T/2 < n) && (t0+T/2 > n)? 1 - 2 * abs(n/T) : 0),...t)
69
- return Y instanceof Array ? Y.map(n=>n*A) : Y*A
70
- },
71
- tri(t,T,t0 = 0 , A = 1){
72
- if(!(t instanceof Array))t=[t]
73
- const Y = mapfun(n=>((t0-T/2 < n) && (t0+T/2 > n)? 1 - 2 * abs(n/T) : 0),...t)
74
- return Y instanceof Array ? Y.map(n=>n*A) : Y*A;
75
- },
76
- dirac(t,t0){
77
- return mapfun(n=>n===t0?Infinity:0,...t);
78
- },
79
- lorentz(t , t0 = 0 , A = 1){
80
- if(!(t instanceof Array))t=[t]
81
- const Y = mapfun(n => 1/(1+(n-t0)**2),...t);
82
- return Y instanceof Array ? Y.map(n=>n*A) : Y*A;
83
- },
84
- sinc(t , t0 , A = 1){
85
- if(!(t instanceof Array))t=[t]
86
- const Y = mapfun(n=>sinc(n-t0),...t);
87
- return Y instanceof Array ? Y.map(n=>n*A) : Y*A;
88
- },
89
- square(t,T=1,A=1){
90
- if(!(t instanceof Array))t=[t]
91
- const Y = mapfun(n=>sign(sin(n*2*Math.PI/T)),...t);
92
- return Y instanceof Array ? Y.map(n=>n*A) : Y*A;
93
- },
94
- sawtooth(){
95
-
96
- },
97
- conv,
98
- conv1d,
99
- conv2d,
100
- circularConv,
101
- linearConv,
102
- circularConv1d,
103
- linearConv1d,
104
- circularConv2d,
105
- linearConv2d,
106
- fft,
107
- ifft,
108
- filter,
109
- }
110
- export{Signal}
@@ -1,100 +0,0 @@
1
- // Mixed calcul
2
- const sum=(...x)=>{
3
- if(x.every(n=>typeof n==="number")){
4
- let s = x[0];
5
- for (let i = 1; i < x.length; i++) s += x[i];
6
- return s;
7
- }
8
- const Y=[];
9
- for(let i=0;i<x.length;i++){
10
- if(x[i] instanceof Array)Y.push(sum(...x[i]));
11
- else if(x[i] instanceof Object){
12
- Y.push(sum(...Object.values(x[i])))
13
- }
14
- }
15
- return Y.length===1?Y[0]:Y;
16
- }
17
- const prod=(...x)=>{
18
- if(x.every(n=>typeof n==="number")){
19
- let p = x[0];
20
- for (let i = 1; i < x.length; i++) p *= x[i];
21
- return p;
22
- }
23
- const Y=[];
24
- for(let i=0;i<x.length;i++){
25
- if(x[i] instanceof Array)Y.push(prod(...x[i]));
26
- else if(x[i] instanceof Object){
27
- Y.push(prod(...Object.values(x[i])))
28
- }
29
- }
30
- return Y.length===1?Y[0]:Y;
31
- }
32
- const min=(...num)=>{
33
- if(num.every(n=>typeof n==="number"))return Math.min(...num);
34
- const Y=[];
35
- for(let i=0;i<num.length;i++){
36
- if(num[i] instanceof Array)Y.push(min(...num[i]));
37
- else if(num[i] instanceof Object){
38
- Y.push(
39
- Object.fromEntries(
40
- [Object.entries(num[i]).sort((a,b)=>a[1]-b[1])[0]]
41
- )
42
- )
43
- }
44
- }
45
- return Y.length===1?Y[0]:Y;
46
- }
47
- const max=(...num)=>{
48
- if(num.every(n=>typeof n==="number"))return Math.max(...num);
49
- const Y=[];
50
- for(let i=0;i<num.length;i++){
51
- if(num[i] instanceof Array)Y.push(min(...num[i]));
52
- else if(num[i] instanceof Object){
53
- Y.push(
54
- Object.fromEntries(
55
- [Object.entries(num[i]).sort((a,b)=>b[1]-a[1])[0]]
56
- )
57
- )
58
- }
59
- }
60
- return Y.length===1?Y[0]:Y;
61
- }
62
- const accum=(...num)=>{
63
- if(num.every(n=>typeof n==="number")){
64
- let acc = num.reduce((x, y) => [...x, x[x.length - 1] + y], [0]);
65
- acc.shift();
66
- return acc;
67
- }
68
- const Y=[];
69
- for(let i=0;i<num.length;i++){
70
- if(num[i] instanceof Array)Y.push(accum(...num[i]));
71
- else if(num[i] instanceof Object){
72
- Y.push(null
73
- // Object.fromEntries(
74
- // [Object.entries(num[i]).sort((a,b)=>b[1]-a[1])[0]]
75
- // )
76
- )
77
- }
78
- }
79
- return Y.length===1?Y[0]:Y;
80
- }
81
-
82
- // sort
83
-
84
- export{
85
- sum,
86
- prod,
87
- min,
88
- max,
89
- accum
90
- }
91
-
92
- //moy
93
- //med
94
- //variance
95
- //std
96
- //mode
97
- //acccum
98
- //min2max
99
- //max2min
100
- //percentile
@@ -1,16 +0,0 @@
1
- import {
2
- sum,
3
- prod,
4
- min,
5
- max,
6
- accum
7
- } from "./Functions"
8
- const Stats={
9
- sum,
10
- prod,
11
- min,
12
- max,
13
- accum,
14
- }
15
- export default Stats;
16
- export * from "./Functions"
@@ -1,139 +0,0 @@
1
- import { Complex,complex} from "../Complex";
2
- import { Matrix } from "../Matrix";
3
- const _add=(a,b)=>{
4
- if(typeof(a)==="number"){
5
- if (typeof b == "number") return a + b;
6
- else if (b instanceof Complex)return complex(a + b.a, b.b);
7
- else if (b instanceof Matrix) return Matrix.nums(b.rows, b.cols, a).add(b);
8
- else if (b instanceof Array)return b.map(n=>add(n,a));
9
- }
10
- else if(a instanceof Complex||a instanceof Matrix){
11
- if(b instanceof Array)return b.map(n=>a.clone.add(n));
12
- return a.clone.add(b);
13
- }
14
- else if(a instanceof Array){
15
- if(b instanceof Array){
16
- if(a.length === b.length)return a.map((n,i)=>add(n,b[i]))
17
- }
18
- else {
19
- return a.map(n=>add(n,b));
20
- }
21
- }
22
- }
23
- const _sub=(a,b)=>{
24
- if(typeof(a)==="number"){
25
- if (typeof b == "number") return a - b;
26
- else if (b instanceof Complex)return complex(a - b.a, -b.b);
27
- else if (b instanceof Matrix) return Matrix.nums(b.rows, b.cols, a).sub(b);
28
- else if (b instanceof Array)return b.map(n=>sub(n,a));
29
- }
30
- else if(a instanceof Complex||a instanceof Matrix){
31
- if(b instanceof Array)return b.map(n=>a.clone.sub(n));
32
- return a.clone.sub(b);
33
- }
34
- else if(a instanceof Array){
35
- if(b instanceof Array){
36
- if(b instanceof Array){
37
- if(a.length === b.length)return a.map((n,i)=>sub(n,b[i]))
38
- }
39
- }
40
- else {
41
- return a.map(n=>sub(n,b));
42
- }
43
- }
44
- }
45
- const _mul=(a,b)=>{
46
- if(typeof(a)==="number"){
47
- if (typeof b == "number") return a * b;
48
- else if (b instanceof Complex)return complex(a * b.a,a * b.b);
49
- else if (b instanceof Matrix) return Matrix.nums(b.rows, b.cols, a).mul(b);
50
- else if (b instanceof Array)return b.map(n=>mul(a,n));
51
- }
52
- else if(a instanceof Complex||a instanceof Matrix){
53
- if(b instanceof Array)return b.map(n=>a.clone.mul(n));
54
- return a.clone.mul(b);
55
- }
56
- else if(a instanceof Array){
57
- if(b instanceof Array){
58
- if(b instanceof Array){
59
- if(a.length === b.length)return a.map((n,i)=>mul(n,b[i]))
60
- }
61
- }
62
- else {
63
- return a.map(n=>mul(n,b));
64
- }
65
- }
66
- }
67
- const _div=(a,b)=>{
68
- if(typeof(a)==="number"){
69
- if (typeof b == "number") return a / b;
70
- else if (b instanceof Complex)return complex(a / b.a,a / b.b);
71
- else if (b instanceof Matrix) return Matrix.nums(b.rows, b.cols, a).div(b);
72
- else if (b instanceof Array)return b.map(n=>div(a,n));
73
- }
74
- else if(a instanceof Complex||a instanceof Matrix){
75
- if(b instanceof Array)return b.map(n=>a.clone.div(n));
76
- return a.clone.div(b);
77
- }
78
- else if(a instanceof Array){
79
- if(b instanceof Array){
80
- if(b instanceof Array){
81
- if(a.length === b.length)return a.map((n,i)=>div(n,b[i]))
82
- }
83
- }
84
- else {
85
- return a.map(n=>div(n,b));
86
- }
87
- }
88
- }
89
- const _modulo=(a,b)=>{
90
- if(typeof(a)==="number"){
91
- if (typeof b == "number") return a % b;
92
- else if (b instanceof Complex)return complex(a % b.a,a % b.b);
93
- else if (b instanceof Matrix) return Matrix.nums(b.rows, b.cols, a).modulo(b);
94
- else if (b instanceof Array)return b.map(n=>div(a,n));
95
- }
96
- else if(a instanceof Complex||a instanceof Matrix){
97
- if(b instanceof Array)return b.map(n=>a.clone.div(n));
98
- return a.clone.div(b);
99
- }
100
- else if(a instanceof Array){
101
- if(b instanceof Array){
102
- }
103
- else {
104
- return a.map(n=>add(n,b));
105
- }
106
- }
107
- }
108
- const add=(a,...b)=>{
109
- var res=a;
110
- for(let i=0;i<b.length;i++)res=_add(res,b[i])
111
- return res;
112
- }
113
- const sub=(a,...b)=>{
114
- var res=a;
115
- for(let i=0;i<b.length;i++)res=_sub(res,b[i])
116
- return res;
117
- }
118
- const mul=(a,...b)=>{
119
- var res=a;
120
- for(let i=0;i<b.length;i++)res=_mul(res,b[i])
121
- return res;
122
- }
123
- const div=(a,...b)=>{
124
- var res=a;
125
- for(let i=0;i<b.length;i++)res=_div(res,b[i])
126
- return res;
127
- }
128
- const modulo=(a,...b)=>{
129
- var res=a;
130
- for(let i=0;i<b.length;i++)res=_modulo(res,b[i])
131
- return res;
132
- }
133
- export{
134
- add,
135
- sub,
136
- mul,
137
- div,
138
- modulo
139
- }
@@ -1,11 +0,0 @@
1
- const inRange=(x,a,b)=>{
2
- const [min,max]=[Math.min(a,b),Math.max(a,b)]
3
- return x>=min && x<=max
4
- }
5
- const isApproximatlyEqual=(a,b,Err=0.0001)=>{
6
- return Math.abs(a-b)<=Err;
7
- }
8
- export{
9
- inRange,
10
- isApproximatlyEqual
11
- }
@@ -1 +0,0 @@
1
- // approximatly equal
@@ -1,7 +0,0 @@
1
- import { mapfun } from "./mapfun.js";
2
- const deg2rad=(...deg)=>mapfun(x=>x*Math.PI/180,...deg);
3
- const rad2deg=(...rad)=>mapfun(x=>x/Math.PI*180,...rad);
4
- export{
5
- deg2rad,
6
- rad2deg
7
- }
@@ -1,28 +0,0 @@
1
- import { floor } from "../Functions";
2
- const cartesianProduct=(a, b)=>a.reduce((p, x) => [...p, ...b.map((y) => [x, y])], []);
3
- const pgcd=(n1, n2)=>{
4
- let i,
5
- pgcd = 1;
6
- if (n1 == floor(n1) && n2 == floor(n2)) {
7
- for (i = 2; i <= n1 && i <= n2; ++i) {
8
- if (n1 % i == 0 && n2 % i == 0) pgcd = i;
9
- }
10
- return pgcd;
11
- } else console.log("error");
12
- }
13
- const ppcm=(n1, n2)=>{
14
- let ppcm;
15
- if (n1 == floor(n1) && n2 == floor(n2)) {
16
- ppcm = n1 > n2 ? n1 : n2;
17
- while (true) {
18
- if (ppcm % n1 == 0 && ppcm % n2 == 0) break;
19
- ++ppcm;
20
- }
21
- return ppcm;
22
- } else console.log("error");
23
- }
24
- export{
25
- cartesianProduct,
26
- ppcm,
27
- pgcd
28
- }
@@ -1,102 +0,0 @@
1
- import { mapfun } from "./mapfun.js";
2
- import {
3
- add,
4
- sub,
5
- mul,
6
- div,
7
- modulo
8
- } from "./arithmetic.js";
9
- import {
10
- zeros,
11
- ones,
12
- nums,
13
- norm,
14
- lerp,
15
- map,
16
- clamp,
17
- arange,
18
- linspace,
19
- logspace,
20
- geomspace
21
- } from "../Signal/functions.js"
22
- import {
23
- deg2rad,
24
- rad2deg
25
- } from "./conversions.js"
26
- import{
27
- sum,
28
- prod,
29
- accum
30
- } from "../Statistics"
31
- import{
32
- inRange,
33
- isApproximatlyEqual
34
- } from "./checkers.js"
35
- import{
36
- cartesianProduct,
37
- ppcm,
38
- pgcd
39
- } from "./discret.js"
40
- const Utils={
41
- add,
42
- sub,
43
- mul,
44
- div,
45
- modulo,
46
-
47
- zeros,
48
- ones,
49
- nums,
50
- norm,
51
- lerp,
52
- map,
53
- clamp,
54
- arange,
55
- linspace,
56
- logspace,
57
- geomspace,
58
-
59
- sum,
60
- prod,
61
- accum,
62
-
63
- cartesianProduct,
64
- ppcm,
65
- pgcd,
66
-
67
- deg2rad,
68
- rad2deg,
69
-
70
- inRange,
71
- isApproximatlyEqual
72
- }
73
- export {
74
- mapfun,
75
- Utils,
76
- zeros,
77
- ones,
78
- nums,
79
- sum,
80
- prod,
81
- add,
82
- mul,
83
- sub,
84
- div,
85
- modulo,
86
- rad2deg,
87
- deg2rad,
88
- arange,
89
- linspace,
90
- logspace,
91
- geomspace,
92
- norm,
93
- lerp,
94
- map,
95
- clamp,
96
- pgcd,
97
- ppcm,
98
- isApproximatlyEqual,
99
- inRange,
100
- cartesianProduct,
101
- };
102
-
@@ -1,43 +0,0 @@
1
- import { Matrix } from "../Matrix";
2
- import { Complex , complex } from "../Complex/index.js";
3
- import {ln,e,cos,sin,sqrt,cosh,sinh} from "../Functions/index.js";
4
- import { Fixed } from "../Functions/index.js";
5
- const mapfun=(fun,...X)=>{
6
- const Y=X.map(x=>{
7
- if(x===null)return fun(null);
8
- if(["number","string","boolean","bigint","undefined"].includes(typeof x))return fun(x);
9
- if(x instanceof Array)return x.map(n=>mapfun(fun,n));
10
- if(ArrayBuffer.isView(x))return x.map(n=>fun(n));
11
- if(x instanceof Set)return new Set(mapfun(fun,...[...x]));
12
- if(x instanceof Map)return new Map([...x].map(n=>[n[0],mapfun(fun,n[1])]));
13
- if(x instanceof Matrix){
14
- return new Matrix(x.rows,x.cols,mapfun(x.arr.flat(1)))
15
- }
16
- if(x instanceof Complex){
17
- const [a,b,z,phi]=[x.a,x.b,x.z,x.phi];
18
- switch(fun){
19
- case Math.log:return complex(ln(z),phi); // Done
20
- case Math.exp:return complex(e(a)*cos(b),e(a)*sin(b)); // Done
21
- case Math.abs:return z; // Done
22
- case Math.sqrt:return complex(sqrt(z)*cos(phi/2),sqrt(z)*sin(phi/2)); // Done
23
- case Fixed.cos:return complex(cos(a)*cosh(b),-(sin(a)*sinh(b)));
24
- case Fixed.sin:return complex(sin(a)*cosh(b),cos(a)*sinh(b));
25
- case Fixed.tan:{
26
- const DEN=cos(2*a)+cosh(2*b);
27
- return complex(sin(2*a)/DEN,sinh(2*b)/DEN);
28
- }
29
- case Fixed.cosh:return complex(cosh(a)*cos(b),sinh(a)*sin(b));
30
- case Fixed.sinh:return complex(sinh(a)*cos(b),cosh(a)*sin(b));
31
- case Fixed.tanh:{
32
- const DEN=cosh(2*a)+cos(2*b);
33
- return complex(sinh(2*a)/DEN,sin(2*b)/DEN)
34
- }
35
- //default : return fun(x)
36
- }
37
- }
38
- else if(x instanceof Object)return Object.fromEntries(Object.entries(x).map(n=>n=[n[0],mapfun(fun,n[1])]))
39
-
40
- });
41
- return Y.length==1?Y[0]:Y;
42
- }
43
- export {mapfun}
@@ -1 +0,0 @@
1
- export default class AbstractZikoMath {}
@@ -1,3 +0,0 @@
1
- const { PI, E } = Math;
2
- const EPSILON=Number.EPSILON
3
- export{PI,E,EPSILON}