Skip to content

Commit f6c99ba

Browse files
committed
Improve some things
1 parent 60289d2 commit f6c99ba

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib.ua

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
# Extract real
55
R ↚ ◌°ℂ
6-
# Floating point epsilon
7-
ε ← 2.2204460492503131e-16
86

97
# -- Averages --
108

@@ -32,16 +30,22 @@ GaussEliminate‼ ↚ ∧(
3230
⊢⍖⊸⌵⍜⊙↙×0⟜⊡⤚⊸⊙⍉
3331
⍜⊏⇌ ⊃⊙⊙∘^0 ⊟⤙⊙⊙∘ ⊙(⊃⋅⊙∘^1 ⍤.≥ε⊸⌵) ⟜⊡
3432
⊸⍜⊡(÷⊸⊡:),
35-
⍜(°⊂↻|⊙-:⊸⊞×:⊙(⊡⤚˜⊙⍉)),
33+
⍜(°⊂↻|𝄐⌞-˜⊸⊞×⊙(⊡⤚˜⊙⍉)),
3634
)°⊏
3735

3836
# Matrix Determinant
39-
MDet ← ◌⍣GaussEliminate‼(⍥¯/≠⊙⋅⋅∘|×⊙⋅⋅∘)⊙0 ⊙1
37+
MDet ← ◌⍣GaussEliminate‼(⍥¯𝄐𝄐/≠)𝄐𝄐× ⊙0⊙1
4038

4139
# Perform Gauss-Jordan elimination
4240
Mgje ← ⍣GaussEliminate‼(|)(⍤"Elimination cannot be completed"0)
4341
# Matrix Inverse
44-
MInv ← ⌅(⍜⍉(↘÷2⊸⧻) ⍣Mgje(⍤"Matrix has no inverse"0) ≡⊂:⊞=.°⊏)
42+
MInv ← ⌅(⍜⍉(↘÷2⊸⧻) ⍣Mgje(⍤"Matrix has no inverse"0) ˜≡⊂˙⊞=°⊏)
43+
44+
┌─╴test
45+
⍤⤙≍ 5 ⁅₃ MDet [1_¯3_¯1 1_¯1_¯2 1_0_0]
46+
⍤⤙≍ [0_0_1 ¯0.4_0.2_0.2 0.2_¯0.6_0.4] ⁅₃ MInv [1_¯3_¯1 1_¯1_¯2 1_0_0]
47+
⍤⤙≍ ˙⊞=⇡3 ⁅₃ Mgje [1_¯3_¯1 1_¯1_¯2 1_0_0]
48+
└─╴
4549

4650
MSquarify ↚ ⍜△[.√⊢]
4751
# Matrix Cofactors
@@ -387,5 +391,5 @@ RPFFT ← ⌅(⍥(⍉fft)⧻△.|⍥°(⍉fft)⧻△.)
387391
Valid ← ⍥R=0↥⊃∩type(↘-+1⌵⊙⟜(×√/×⊸△⍜∩RPFFT×∩⌞⬚0↙)⊃-↥◡∩△)
388392
# Convolution that maintains the shape of the larger input
389393
# **CURRENTLY UNIMPLEMENTED** - PR welcome
390-
Same ← ⍤"Not yet implemented (make a PR?)"0 ⋅∘
394+
Same ← ⍤"Not yet implemented"0 ⋅∘
391395
└─╴

0 commit comments

Comments
 (0)