Skip to content

Instantly share code, notes, and snippets.

@BitPuffin
Created April 11, 2014 15:34
Show Gist options
  • Save BitPuffin/10478279 to your computer and use it in GitHub Desktop.
Save BitPuffin/10478279 to your computer and use it in GitHub Desktop.
proc `*`*[T; R, N, C: static[int]](a: TMatrix[T, R, N], b: TMatrix[T, N, C]): TMatrix[T, R, C] {.noSideEffect.} =
## Multiplies two matrices together and returns the result. The column count
## of the first matrix must be the same as the row count of the second
## matrix. The result matrix has the same row count as the first matrix
## and the same column count as the second.:
for i in low(a)..high(a):
for j in low(a[i])..high(a[i]):
result[i][j] = a.row(i) *. b.col(j)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment