Numy v0.1.5 Numy.Lapack.Vector View Source
LAPACK Vector.
Implements protocols: Numy.Vc
, Numy.Vcm
Example of mutating add!
iex(7)> v = Numy.Lapack.Vector.new([1,2,3])
%Numy.Lapack.Vector{lapack: #Numy.Lapack<shape: [...], ...>, nelm: 3}
iex(8)> Numy.Vcm.add!(v,v)
:ok
iex(9)> Numy.Lapack.data(v.lapack)
[2.0, 4.0, 6.0]
Example of non-mutating add
iex(3)> v = Numy.Lapack.Vector.new([1,2,3])
%Numy.Lapack.Vector{lapack: #Numy.Lapack<shape: [...], ...>, nelm: 3}
iex(4)> Numy.Vc.add(v,v)
[1.0, 2.0, 3.0]
Link to this section Summary
Functions
Examples
iex(4)> v = Numy.Lapack.Vector.new(1..100)
#Vector<size=100, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, ...]>
iex(5)> Numy.Lapack.Vector.save_to_file(v, 'vec.numy.bin')
:ok
iex(6)> Numy.Lapack.Vector.load_from_file('vec.numy.bin')
#Vector<size=100, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, ...]>
Create new Vector from Elixir Range
Create new Vector as a concatination of 2 other vectors
Examples
iex(1)> alias Numy.Lapack.Vector
Numy.Lapack.Vector
iex(2)> a = Vector.new(1..10)
#Vector<size=10, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]>
iex(3)> b = Vector.new(1..10)
#Vector<size=10, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]>
iex(4)> Vector.swap_ranges(a,b,3,2,7)
:ok
iex(5)> a
#Vector<size=10, [1.0, 2.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0]>
iex(6)> b
#Vector<size=10, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 3.0, 4.0, 5.0]>
Link to this section Functions
Examples
iex(4)> v = Numy.Lapack.Vector.new(1..100)
#Vector<size=100, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, ...]>
iex(5)> Numy.Lapack.Vector.save_to_file(v, 'vec.numy.bin')
:ok
iex(6)> Numy.Lapack.Vector.load_from_file('vec.numy.bin')
#Vector<size=100, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, ...]>
Create new Vector from Elixir Range
Create new Vector as a concatination of 2 other vectors
Examples
iex(1)> v1 = Numy.Lapack.Vector.new([1,2,3])
iex(2)> v2 = Numy.Lapack.Vector.new([4,5,6])
iex(3)> v3 = Numy.Lapack.Vector.new(v1,v2)
iex(4)> Numy.Vc.data(v3)
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
Examples
iex(1)> alias Numy.Lapack.Vector
Numy.Lapack.Vector
iex(2)> a = Vector.new(1..10)
#Vector<size=10, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]>
iex(3)> b = Vector.new(1..10)
#Vector<size=10, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]>
iex(4)> Vector.swap_ranges(a,b,3,2,7)
:ok
iex(5)> a
#Vector<size=10, [1.0, 2.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0]>
iex(6)> b
#Vector<size=10, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 3.0, 4.0, 5.0]>