numexy v0.1.8 Numexy

Documentation for Numexy.

Link to this section Summary

Functions

Add vector or matrix

Get index of max value

Get index of max value row or col

Avarage matrix or vector

Division vector or matrix

Calculate inner product

Get matrix or vector value

Multiplication vector or matrix

New matrix

Create ones matrix or vector

Calculate outer product

Get relu function value

Reshape list

Get sigmoid function value

Get softmax function value

Get step function value

Subtraction vector or matrix

Sum matrix or vector

Calculate transpose matrix

Create zeros matrix or vector

Link to this section Functions

Add vector or matrix.

Examples

iex> x = Numexy.new([1,2,3])
%Array{array: [1,2,3], shape: {3, nil}}
iex> y = 4
iex> Numexy.add(x, y)
%Array{array: [5,6,7], shape: {3, nil}}

Get index of max value.

Examples

iex> Numexy.new([[1,2,9],[4,5,6]]) |> Numexy.argmax
2
Link to this function argmax(array, atom)

Get index of max value row or col.

Examples

iex> Numexy.new([[1,2,9],[4,6,3]]) |> Numexy.argmax(:row)
[2, 1]
iex> Numexy.new([[1,2,9],[4,6,3]]) |> Numexy.argmax(:col)
[1, 1, 0]

Avarage matrix or vector.

Examples

iex> Numexy.new([2,9,5]) |> Numexy.avg
5.333333333333333
iex> Numexy.new([[1,2,3],[4,5,6]]) |> Numexy.avg
3.5

Division vector or matrix.

Examples

iex> x = Numexy.new([8,4,2])
%Array{array: [8,4,2], shape: {3, nil}}
iex> y = 4
iex> Numexy.div(x, y)
%Array{array: [2.0,1.0,0.5], shape: {3, nil}}
Link to this function dot(array1, array2)

Calculate inner product.

Examples

iex> x = Numexy.new([1,2,3])
%Array{array: [1,2,3], shape: {3, nil}}
iex> y = Numexy.new([1,2,3])
%Array{array: [1,2,3], shape: {3, nil}}
iex> Numexy.dot(x, y)
14
Link to this function get(array, arg)

Get matrix or vector value.

Examples

iex> Numexy.new([2,9,5]) |> Numexy.get({2, nil})
9
iex> Numexy.new([[1,2,3],[4,5,6]]) |> Numexy.get({2, 1})
4

Multiplication vector or matrix.

Examples

iex> x = Numexy.new([1,2,3])
%Array{array: [1,2,3], shape: {3, nil}}
iex> y = 4
iex> Numexy.mul(x, y)
%Array{array: [4,8,12], shape: {3, nil}}

New matrix.

Examples

iex> Numexy.new([1,2,3])
%Array{array: [1, 2, 3], shape: {3, nil}}
iex> Numexy.new([[1,2,3],[1,2,3]])
%Array{array: [[1, 2, 3], [1, 2, 3]], shape: {2, 3}}

Create ones matrix or vector.

Examples

iex> Numexy.ones({2, 3})
%Array{array: [[1, 1, 1], [1, 1, 1]], shape: {2, 3}}
iex> Numexy.ones({3, nil})
%Array{array: [1, 1, 1], shape: {3, nil}}
Link to this function outer(array1, array2)

Calculate outer product.

Examples

iex> Numexy.new([1,2,3,4]) |> Numexy.outer(Numexy.new([4,3,2,1]))
%Array{array: [[4,3,2,1],[8,6,4,2],[12,9,6,3],[16,12,8,4]], shape: {4, 4}}

Get relu function value.

Examples

iex> Numexy.new([-2,9,5]) |> Numexy.relu()
%Array{array: [0, 9, 5], shape: {3, nil}}
Link to this function reshape(list, col)

Reshape list.

Examples

iex> Numexy.reshape([1,2,3,4,5,6], 3)
%Array{array: [[1,2,3],[4,5,6]], shape: {2, 3}}

Get sigmoid function value.

Examples

iex> Numexy.new([-2,9,5]) |> Numexy.sigmoid()
%Array{array: [0.11920292202211755, 0.9998766054240137, 0.9933071490757153], shape: {3, nil}}

Get softmax function value.

Examples

iex> Numexy.new([-2,9,5]) |> Numexy.softmax()
%Array{array: [1.6401031494862326e-5, 0.9819976839988096, 0.017985914969695496], shape: {3, nil}}
Link to this function step_function(array)

Get step function value.

Examples

iex> Numexy.new([-2,9,5]) |> Numexy.step_function()
%Array{array: [0, 1, 1], shape: {3, nil}}

Subtraction vector or matrix.

Examples

iex> x = Numexy.new([1,2,3])
%Array{array: [1,2,3], shape: {3, nil}}
iex> y = 4
iex> Numexy.sub(x, y)
%Array{array: [-3,-2,-1], shape: {3, nil}}

Sum matrix or vector.

Examples

iex> Numexy.new([2,9,5]) |> Numexy.sum
16
iex> Numexy.new([[1,2,3],[4,5,6]]) |> Numexy.sum
21
Link to this function transpose(array)

Calculate transpose matrix.

Examples

iex> x = Numexy.new([[4,3],[7,5],[2,7]])
%Array{array: [[4, 3], [7, 5], [2, 7]], shape: {3, 2}}
iex> Numexy.transpose(x)
%Array{array: [[4, 7, 2], [3, 5, 7]], shape: {2, 3}}

Create zeros matrix or vector.

Examples

iex> Numexy.zeros({2, 3})
%Array{array: [[0, 0, 0], [0, 0, 0]], shape: {2, 3}}
iex> Numexy.zeros({3, nil})
%Array{array: [0, 0, 0], shape: {3, nil}}