Skip to content

Instantly share code, notes, and snippets.

@BitPuffin
Created December 1, 2013 12:38
Show Gist options
  • Save BitPuffin/7733141 to your computer and use it in GitHub Desktop.
Save BitPuffin/7733141 to your computer and use it in GitHub Desktop.
import linagl/matrix
var a: TMatrix[int, range[0..2], range[0..2]] = [[ 1, -5, 3],
[ 0, -2, 6],
[ 7, 2, -4]]
echo a
var v = a.row(0)
var w = a.col(0)
echo(v*a)
nimrod c -r mat2.nim
/etc/nimrod.cfg(36, 2) Hint: added path: '/home/isak/.babel/pkgs/linagl-0.1.1' [Path]
/etc/nimrod.cfg(36, 2) Hint: added path: '/home/isak/.babel/pkgs/jester-0.1.0' [Path]
/etc/nimrod.cfg(36, 2) Hint: added path: '/home/isak/.babel/pkgs/babel-0.1.0' [Path]
/etc/nimrod.cfg(36, 2) Hint: added path: '/home/isak/.babel/pkgs/' [Path]
Hint: used config file '/etc/nimrod.cfg' [Conf]
Hint: system [Processing]
Hint: mat2 [Processing]
Hint: matrix [Processing]
Hint: vector [Processing]
Hint: math [Processing]
Hint: macros [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
/home/isak/.babel/pkgs/linagl-0.1.1/linagl/vector.nim(18, 2) Hint: 'TUVec3' is declared but not used [XDeclaredButNotUsed]
/home/isak/.babel/pkgs/linagl-0.1.1/linagl/vector.nim(17, 2) Hint: 'TUVec2' is declared but not used [XDeclaredButNotUsed]
/home/isak/.babel/pkgs/linagl-0.1.1/linagl/vector.nim(19, 2) Hint: 'TUvec4' is declared but not used [XDeclaredButNotUsed]
/home/isak/.babel/pkgs/linagl-0.1.1/linagl/vector.nim(98, 2) Hint: 'swizzleChars' is declared but not used [XDeclaredButNotUsed]
/home/isak/.babel/pkgs/linagl-0.1.1/linagl/vector.nim(100, 5) Hint: 'vector.swizzleImpl(str: string): array[I, int]' is declared but not used [XDeclaredButNotUsed]
mat2.nim(9, 6) Info: instantiation from here
/home/isak/.babel/pkgs/linagl-0.1.1/linagl/matrix.nim(112, 17) Error: undeclared identifier: 'dot'
proc `*`*[T; R, C](a: TVector[T, C], b: TMatrix[T, R, C]): TVector[T, C] {.noSideEffect.} =
## Multiplies a vector with a matrix, the vector is treated as a row vector
for i in low(a)..high(a):
result[i] = a.dot(b.col(i)) ### XXX: Line 112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment