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. <https://github.com/treeform/vmath> 
<https://github.com/stavenko/nim-glm>

I don't know much about Arraymancer, but it seems it is designed for large (> 
100) vector/matrix. vmath/nim-glm uses only `array` to store data. So size of 
vector/matrix must be determined at compile time in vmath/nim-glm but size can 
be changed at runtime in Arraymancer. If you use `array`, data can be placed in 
stack or heap.

Here is how nim-glm implements matrix-vector multiplication: 
<https://github.com/stavenko/nim-glm/blob/47d5f8681f3c462b37e37ebc5e7067fa5cba4d16/glm/mat.nim#L341>

How nim-glm implements matrix[i, j] subscript operator: 
<https://github.com/stavenko/nim-glm/blob/47d5f8681f3c462b37e37ebc5e7067fa5cba4d16/glm/mat.nim#L51>
    
    
    # This proc implements matrix[i, j] = a.
    proc `[]=`*[M,N,T](v:var Mat[M,N,T]; ix, iy:int; value:T): void {.inline.} =
    
    # This proc implements a = matrix[i, j]
    proc `[]`*[M,N,T](v: Mat[M,N,T]; ix, iy: int): T {.inline.} =
    
    Run

Reply via email to