Skip to content

Instantly share code, notes, and snippets.

@danielkrizian
Last active April 30, 2021 11:22
Show Gist options
  • Save danielkrizian/c6c3e520e50129be33b2e32ca27e2340 to your computer and use it in GitHub Desktop.
Save danielkrizian/c6c3e520e50129be33b2e32ca27e2340 to your computer and use it in GitHub Desktop.
linear algebra (matrix algebra)

matrix multiplication

https://youtu.be/XkY2DOUCWMU?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab q stores matrices in column-major order - it means that first element of each list is first column, second element is second column etc

special case: float vector is Nx1 or 1xN (if enlisted) matrix

q)enlist[1 2 3f] $ 1 2 3f                            / rows times columns
,14f
q)(1 3f;-2 0f)$-1 2f                                 / 5 2; (x-axis coords;y-axis coords); has columns 1 -2 and 3 0
q)(1 1f;0 1f)$(0 -1f;1 0f)                           / (1 -1f;1 0f);

q)(1 2 3f;4 5 6f)$(7 8f;9 10f;11 12f)                / 58 64  139 154; rows dot columns
q)(1 2 3f;4 5 6f)$\:(7 8f;9 10f;11 12f)                / 58 64  139 154

q)((enlist each 1 4f)$enlist 7 8f) +
 ((enlist each 2 5f)$enlist 9 10f) +
 (enlist each 3 6f)$enlist 11 12f

eigenvectors and eigenvalues

https://youtu.be/PFDu9oVAE-g?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab eigen vector is the axis of rotation, eigenvalue is scaling/squishing along that axis. all other vectors after rotation end up outside their own span, except eigenvectors

@Evidsson
Copy link

It's very useful info for as I have some troubles with this segment. I'm sure that it will help me to cope with my task. Thanks for sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment