CPUtils (Fixpoint v0.8.28)

Summary

Functions

latin_square(x)

mat_at(m,i,j)

print_matrix(x,rows,cols, format \ "~2w")

timeit(fun)

timeit_simple(fun)

transpose(m)

Functions

Link to this function

latin_square(x)

latin_square(x)

Ensures that an n x n matrix x is a Latin Square.

##Examples##

> latin_square(x)
Link to this function

mat_at(m, i, j)

mat_at(m,i,j)

Returns the value (i,j) of the 2d matrix mat.

##Examples##

 iex> [[1,2,3],[4,5,6],[7,8,9]] |> mat_at(1,2)
 6

timeit(fun)

From https://stackoverflow.com/questions/29668635/how-can-we-easily-time-function-calls-in-elixir

A more elaborate timing function. Prints

  • Name of the function
  • Result
  • Time in seconds

##Examples##

 > timeit(&test1/0)
Link to this function

timeit_simple(fun)

timeit_simple(fun)

A simple timing function, returns the time in seconds (as a string).

##Examples##

 > Util.timeit_simple(&Test1.main/0)

 > Util.timeit_simple(fn () -> Test1.main() end)

transpose(m)

Returns a transposed version of m.

##Example##

 iex> [[1,2,3],[4,5,6],[7,8,9]] |> transpose
 [[1, 4, 7], [2, 5, 8], [3, 6, 9]]