As a newcomer to Julia I am still struggling with various type-related issues. One of them is this:
using LinearAlgebra
julia> x = [3,4]
2-element Array{Int64,1}:
3
4
julia> G,r = givens(x,1,2)
ERROR: MethodError: no method matching givensAlgorithm(::Int64, ::Int64)
Stacktrace:
[1] givens(::Int64, ::Int64, ::Int64, ::Int64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/LinearAlgebra/src/givens.jl:276
[2] givens(::Array{Int64,1}, ::Int64, ::Int64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/LinearAlgebra/src/givens.jl:317
[3] top-level scope at none:0
If instead I define x
as a vector containing floats, things are fine:
julia> x = [3.0,4.0]
2-element Array{Float64,1}:
3.0
4.0
julia> G,r = givens(x,1,2)
(LinearAlgebra.Givens{Float64}(1, 2, 0.6, 0.8), 5.0)
Is this really an anticipated behavior? In the documentation I can read that givens
can be called as givens(x::AbstractVector, i1::Integer, i2::Integer)
. Shouldn’t then a vector of integers be perfectly fine?