matrex v0.5.1 Matrex.Operators View Source
Overrides Kernel math operators for use with matrices. Use with caution.
Usage
iex> import IEx.Helpers, except: [t: 1] # Only in iex, conflicts with transpose function
iex> import Matrex.Operators
iex> import Kernel, except: [-: 1, +: 2, -: 2, *: 2, /: 2, <|>: 2]
iex> m = random(5, 3)
#Matrex[5×3]
┌ ┐
│ 0.51502 0.03132 0.94185 │
│ 0.49434 0.93887 0.91102 │
│ 0.70671 0.89428 0.28817 │
│ 0.23771 0.37695 0.38214 │
│ 0.37221 0.34008 0.19615 │
└ ┘
iex> m * t(m) / eye(5) |> sigmoid()
#Matrex[5×5]
┌ ┐
│ 0.76012 1.0 1.0 1.0 1.0 │
│ 1.0 0.87608 1.0 1.0 1.0 │
│ 1.0 1.0 0.79935 1.0 1.0 │
│ 1.0 1.0 1.0 0.58531 1.0 │
│ 1.0 1.0 1.0 1.0 0.57265 │
└ ┘
Link to this section Summary
Functions
Element-wise matrices multiplication. The same as Matrex.multiply/2
Take logarithm of a matrix elementwise
Take sigmoid function of each element of matrix.
sigmoid(x) = 1 / (1 + exp(-x))
Transpose a matrix
Link to this section Functions
Element-wise matrices multiplication. The same as Matrex.multiply/2
See Matrex.eye/1
Take logarithm of a matrix elementwise.
See Matrex.ones/1
See Matrex.ones/2
See Matrex.square/1
See Matrex.random/1
See Matrex.random/2
See Matrex.scalar/1
See Matrex.set/4
Take sigmoid function of each element of matrix.
sigmoid(x) = 1 / (1 + exp(-x))
See Matrex.size/1
Transpose a matrix.
See Matrex.zeros/1
See Matrex.zeros/2