load modular_matrix_divide.ijs
open script for function/adverb definitions

gcd's, gauss-jordan, modulo divide and modular matrix divide


I think this is a draft of the modular matrix system solver that I imagined
a couple decades ago. It may still have some rough edges/mistakes.

gcd2x 51 119

17 _2 1

_2 1 +/ . * 51 119

17

NB. more general than integer

gcd2x 53r3 20

1r3 17 _15

NB. md is meant to be like % mod m

7 md 6

6

m md i.&.<:m=:7

1 4 5 2 3 6

m md i.&.<:m=:8

1 _ 3 _ 5 _ 7

5 m md i.&.<:m

5 _ 7 _ 1 _ 3

NB. Md is meant to be like %. mod m

-/ . * a=:?.3 3$5

_7

a

4 1 3

1 0 3

1 1 1

]ai=: 17 Md a

15 7 2

7 12 11

12 15 5

17|ai mp a

1 0 0

0 1 0

0 0 1

1 2 3 (17) Md a

1 13 6

NB. Non square case includes:

NB. Can take an independent direction b and

NB. make one, B, orthogonal to the columns of A --

NB. as in Gram-Schmidt even if not "least squares fit"

$A=:a,1

4 3

17 Md A NB. Left inverse

15 7 1 1

7 12 14 14

12 15 11 11

17|(17 Md A)mp A

1 0 0

0 1 0

0 0 1

b=:1 2 3 4

s=:b 17 Md A

17| (B=:17|b-A mp s) mp A

0 0 0

B

0 0 8 9
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to