Matrix/vector operations in Nim

2022-01-23 Thread mratsim
Yes for vector/matrices used in graphics programming, you should use a graphics oriented package.

Matrix/vector operations in Nim

2022-01-22 Thread demotomohiro
In 2D or 3D graphics/physics/geometry, you rarely use vectors longer than 4 or matrix larger than 4x4. In that case, following Nim libraries would be more suitable than Arraymancer. I don't know much about Arraymancer, bu

Matrix/vector operations in Nim

2022-01-22 Thread mratsim
There are many matrix/vector packages in Nim: * Arraymancer: (disclaimer I'm the author) * Neo, the first one: * Manu, which has no external dependencies: Or roll your o

Matrix/vector operations in Nim

2022-01-21 Thread sls1005
A 2-dim sequence of int is represented as @[@[1]] . Its type is seq[seq[int]] . I'm not sure if this is what you call "matrix." The answer for the next question is yes, it can. To access A[i][j] with A[i, j], you may define: proc `[]`[T](A: seq[seq[T]], i, j: int): T = A[i][j]

Matrix/vector operations in Nim

2022-01-21 Thread Yardanico
Nim supports A[i, j] syntax by itself without any metaprogramming, see for example

Matrix/vector operations in Nim

2022-01-21 Thread keks84
Looks very good for point 1, thx! Re element access A[i,j] instead of A[i][j] any chance to overload setters and getters in Nim?

Matrix/vector operations in Nim

2022-01-21 Thread keks84
Hi, how can I implement a matrix (2-dim vector) A in Nim? Guess it should be vector of vectors, but could not find an example. * Could overloading be used to implement matrix-vector multiplication A * b? * Could metaprogramming be used to implement element access A[i,j] instead of A[i][j]?

Matrix/vector operations in Nim

2022-01-21 Thread Clonk
Check out Arraymancer