Numy v0.1.5 Numy.Vc protocol View Source
Interface to immutable Vector.
Link to this section Summary
Functions
iex(1)> Numy.Lapack.Vector.new(-3..3) |> Numy.Vc.abs
#Vector<size=7, [3.0, 2.0, 1.0, 0.0, 1.0, 2.0, 3.0]>
Add 2 vectors, cᵢ ← aᵢ + bᵢ
Step function, aᵢ ← 0 if aᵢ < 0 else 1
f(x) = 1/(1 + e⁻ˣ)
Assign some value to all elements.
Assign 1.0 to each element of the vector.
Assign random values to the elements.
Assign 0.0 to each element of the vector.
Get value of N-th element by index, return default in case of error.
Make a clone
Concatenate 2 vectors
Return true if vector contains the value
Get data as a list
Divide 2 vectors, cᵢ ← aᵢ÷bᵢ
Dot product of 2 vectors, ∑aᵢ×bᵢ
Return true if vector is empty.
Check if elements of 2 vectors are practically the same.
Find value in vector, returns position, -1 if could not find
Return max value
Return index of max value
Average (∑aᵢ)/length
Return min value
Return index of min value
Multiply 2 vectors, cᵢ ← aᵢ×bᵢ
Change sign of each element, aᵢ ← -aᵢ
√x₀² + x₁² + ... + xₙ²
Add a constant to each element, aᵢ ← aᵢ + offset
iex(2)> Numy.Lapack.Vector.new(-3..3) |> Numy.Vc.pow2
#Vector<size=7, [9.0, 4.0, 1.0, 0.0, 1.0, 4.0, 9.0]>
Reverse
Multiply each element by a constant, aᵢ ← aᵢ×scale_factor
Return size/length of the vector.
Sort elements
Subtract one vector from other, cᵢ ← aᵢ - bᵢ
Sum of all elements, ∑aᵢ
Link to this section Types
Link to this section Functions
iex(1)> Numy.Lapack.Vector.new(-3..3) |> Numy.Vc.abs
#Vector<size=7, [3.0, 2.0, 1.0, 0.0, 1.0, 2.0, 3.0]>
Add 2 vectors, cᵢ ← aᵢ + bᵢ
Step function, aᵢ ← 0 if aᵢ < 0 else 1
f(x) = 1/(1 + e⁻ˣ)
Assign some value to all elements.
Assign 1.0 to each element of the vector.
Assign random values to the elements.
Assign 0.0 to each element of the vector.
Get value of N-th element by index, return default in case of error.
Make a clone
Concatenate 2 vectors
Return true if vector contains the value
Get data as a list
Divide 2 vectors, cᵢ ← aᵢ÷bᵢ
Dot product of 2 vectors, ∑aᵢ×bᵢ
Return true if vector is empty.
Check if elements of 2 vectors are practically the same.
Find value in vector, returns position, -1 if could not find
Return max value
Return index of max value
Average (∑aᵢ)/length
Return min value
Return index of min value
Multiply 2 vectors, cᵢ ← aᵢ×bᵢ
Change sign of each element, aᵢ ← -aᵢ
√x₀² + x₁² + ... + xₙ²
Add a constant to each element, aᵢ ← aᵢ + offset
iex(2)> Numy.Lapack.Vector.new(-3..3) |> Numy.Vc.pow2
#Vector<size=7, [9.0, 4.0, 1.0, 0.0, 1.0, 4.0, 9.0]>
Reverse
Multiply each element by a constant, aᵢ ← aᵢ×scale_factor
Return size/length of the vector.
Sort elements
Subtract one vector from other, cᵢ ← aᵢ - bᵢ
Sum of all elements, ∑aᵢ