Go through lists

How can I go through a list list? I created two matrices but now I want to know how to make the transposition of b and multiply it with the matrix a

1 Like

Sounds like you are using Elixir’s built-in lists. Maybe you should switch to a library like this one ?
https://hexdocs.pm/matrix/Matrix.html

1 Like

Hi all,

Transpose a list of lists using list comprehension

2 Likes

Found it on the other thread. You can give this a go:

iex> Enum.zip [[1,2],[3,4],[5,6]]
[{1, 3, 5}, {2, 4, 6}]

or if you need list of lists:

iex> Enum.zip([[1,2],[3,4],[5,6]]) |> Enum.map(&Tuple.to_list/1)
[[1, 3, 5], [2, 4, 6]]

For large matrices, I’d use C and OpenMP - SSE/AVX - MPI.

http://www.nic.uoregon.edu/iwomp2005/iwomp2005_tutorial_openmp_rvdp.pdf

GNU Octave is another option.