Some linear algebra and APL results

Table of Contents

1. Affine transformation
2. Solve linear equations

1. Affine transformation

Equation 1. Affine equations


Where (u,v) is the new coordinate and (x,y) is the old coordinate.

The APL code mapping an image by this transformation is like:

     ⍝ affine transformation
     ⎕IO←0 ⋄ s←⍴⍵
     g←¯1↓⍉⌊0.5+⍺+.×⍤2 1⊢1,⍨⍉s⊤⍳×/s
     m←∧⌿(s>⍤0 1⊢g)∧0<g

2. Solve linear equations

For coefficient matrix A, variable matrix X and constant matrix B, then


Then the APL code is just (⌹A)+.×B, or even simpler, B⌹A. As the APL2 specification writes:

If Z←L⌹R is executable, Z is determined to minimize the value of the least squares expression: