The new matrix operator is very cool, but it does not work on numbers with variable precision.

⌹ 2 2⍴1 2 3 5

¯5 2

3 ¯1

÷⌻ 2 2⍴1 2 3 5

¯5 2

3 ¯1

⌹ 2 2⍴1 2 3 5v

¯5 2

3 ¯1

÷⌻ 2 2⍴1 2 3 5v

DOMAIN ERROR

9 posts
• Page **1** of **1**

The new matrix operator is very cool, but it does not work on numbers with variable precision.

⌹ 2 2⍴1 2 3 5

¯5 2

3 ¯1

÷⌻ 2 2⍴1 2 3 5

¯5 2

3 ¯1

⌹ 2 2⍴1 2 3 5v

¯5 2

3 ¯1

÷⌻ 2 2⍴1 2 3 5v

DOMAIN ERROR

⌹ 2 2⍴1 2 3 5

¯5 2

3 ¯1

÷⌻ 2 2⍴1 2 3 5

¯5 2

3 ¯1

⌹ 2 2⍴1 2 3 5v

¯5 2

3 ¯1

÷⌻ 2 2⍴1 2 3 5v

DOMAIN ERROR

- drab
**Posts:**315**Joined:**Thu Oct 09, 2014 6:23 am

It doesn't work with rational numbers either -- which not a surprise.

But maybe a rational argument should be automatically converted.

But maybe a rational argument should be automatically converted.

- drab
**Posts:**315**Joined:**Thu Oct 09, 2014 6:23 am

This behavior represents the current behavior of the current Alpha release. When I get around to it, I plan to extend the Matrix Operator to support MP numbers, but first I need to find C code which implements calculations of Eigenvalues and Eigenvectors so I can convert it to MP code and thus support MP numbers in the Matrix Operator.drab wrote:It doesn't work with rational numbers either -- which not a surprise.

But maybe a rational argument should be automatically converted.

- forummaster
**Posts:**567**Joined:**Wed Jan 23, 2013 1:00 pm

Consider these ...

∘⌻ 1 (2 2⍴⍳4)

1 0 0

0 1 2

0 3 4

∘⌻ 1 (3 3↑2 3⍴⍳6)

1 0 0 0

0 1 2 3

0 4 5 6

0 0 0 0

∘⌻ 1 ( 2 3⍴⍳6)

LENGTH ERROR

Why not do an automatic "squaring" of the sub-matrices if necessary, so as to make the last expression work?

∘⌻ 1 (2 2⍴⍳4)

1 0 0

0 1 2

0 3 4

∘⌻ 1 (3 3↑2 3⍴⍳6)

1 0 0 0

0 1 2 3

0 4 5 6

0 0 0 0

∘⌻ 1 ( 2 3⍴⍳6)

LENGTH ERROR

Why not do an automatic "squaring" of the sub-matrices if necessary, so as to make the last expression work?

- drab
**Posts:**315**Joined:**Thu Oct 09, 2014 6:23 am

Just curious ...

Please describe the algorithm this uses.

I tried

F ⌻ 2 2⍴1 2 3 5

where F is a defined function which traces it use.

It called F once with a complex vector argument.

Is it using eigenvectors?

Please describe the algorithm this uses.

I tried

F ⌻ 2 2⍴1 2 3 5

where F is a defined function which traces it use.

It called F once with a complex vector argument.

Is it using eigenvectors?

- drab
**Posts:**315**Joined:**Thu Oct 09, 2014 6:23 am

Another question ...

Is there already a way to get eigenvectors and eigenvalues?

If so, I missed it.

Is there already a way to get eigenvectors and eigenvalues?

If so, I missed it.

- drab
**Posts:**315**Joined:**Thu Oct 09, 2014 6:23 am

This is yet another well-hidden documentation which can be found in Eigenvalues and Eigenvectors. The short of it is thatdrab wrote:Another question ...

Is there already a way to get eigenvectors and eigenvalues?

If so, I missed it.

(Eval Evec)←⌹⍠3 M where M is a square matrix. The Magic Function

⎕VR'#MatOpr'

∇ Z←{L} (LO #MatOpr) R;Eval Evec T

[1] ⎕PRO:

[2] :if 0=⎕NC 'L' ⋄ L←⊢ ⋄ :endif

[3] (Eval Evec)←⌹⍠3 R

[4] ⎕ERROR ((⍴Eval)≠⍴∪Eval)/'EIGENVALUES NOT DISTINCT'

[5] Z←Evec+.×(∘⌻L LO Eval)+.×⌹Evec

∇

shows how the Matrix Operator works. That is, given Eval andEvec have been calculated from M as above, then

M≡Evec+.×(∘⌻Eval)+.×⌹Evec

which shows the inverse operation to calculating Eval and Evec. The Matrix Operator inserts its left operand into the above expression between ∘⌻ and Eval. For example, the above expression can be expressed as the identity M≡⊢⌻M. Another surprising identity is (⌹M)≡÷⌻M. Squaring a matrix (M+.×M) can be expressed as 2*⍨⌻M. Given the right matrix, you can express various identities such as I≡(2*⍨⌻1○⌻M)+2*⍨⌻2○⌻M where I is the appropriately shaped identity matrix and the values of M are such that both 1>⌈/|⌹⍠1 M and ∧/1>|,M hold. However, even with that restriction, the identity doesn't hold because the off-diagonal elements of the right hand side aren't exactly zero (as they are in the identity matrix I) and so they don't compare because ⎕CT doesn't apply to comparisons against zero. More on fixing that later from an idea I had at the recent Minnowbrook workshop.

The recent paper A Matrix Operator in APL explains a bit more, but it is very preliminary.

Last edited by forummaster on Sat Sep 23, 2017 3:58 pm, edited 1 time in total.

- forummaster
**Posts:**567**Joined:**Wed Jan 23, 2013 1:00 pm

Excellent. Thanks.

But if that's the third function of the new operator, then what are the first two?

But if that's the third function of the new operator, then what are the first two?

- drab
**Posts:**315**Joined:**Thu Oct 09, 2014 6:23 am

drab wrote:Excellent. Thanks.

But if that's the third function of the new operator, then what are the first two?

If you are referring to the four flavors of the Variant operator on the Domino function of which the third one (⌹⍠3) returns both Eigenvalues and Eigenvectors, take a look at Eigenvalues and Eigenvectors.

- forummaster
**Posts:**567**Joined:**Wed Jan 23, 2013 1:00 pm

9 posts
• Page **1** of **1**

Users browsing this forum: No registered users and 2 guests