# Givens matrix for an integer vector

**URL:** <https://discourse.julialang.org/t/givens-matrix-for-an-integer-vector/25520>\
**Category:** Numerics\
**Created:** [June 21, 2019, 11:37am UTC](https://discourse.julialang.org/t/givens-matrix-for-an-integer-vector/25520 "2019-06-21T11:37:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [June 21, 2019, 11:37am UTC](https://discourse.julialang.org/t/givens-matrix-for-an-integer-vector/25520/1 "2019-06-21T11:37:01Z")

</div>

As a newcomer to Julia I am still struggling with various type-related issues. One of them is this:

```julia
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
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?

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [June 21, 2019, 11:53am UTC](https://discourse.julialang.org/t/givens-matrix-for-an-integer-vector/25520/2 "2019-06-21T11:53:30Z")

</div>

This looks like a bug, I’d file an issue

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [June 21, 2019, 11:59am UTC](https://discourse.julialang.org/t/givens-matrix-for-an-integer-vector/25520/3 "2019-06-21T11:59:21Z")

</div>

Interestingly, [there is a method](https://github.com/JuliaLang/julia/blob/dd56dbfd8e54b91dfd6da5f04e5c06e735d8f8ef/stdlib/LinearAlgebra/src/givens.jl#L251)

`givensAlgorithm(f, g) = givensAlgorithm(promote(float(f), float(g))...)`

As @dlfivefifty said, this looks like a bug and should work.

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [June 21, 2019, 12:57pm UTC](https://discourse.julialang.org/t/givens-matrix-for-an-integer-vector/25520/4 "2019-06-21T12:57:41Z")

</div>

Notice that this method was added very recently so it’s not available in the latest release of Julia.

---

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [June 21, 2019, 1:12pm UTC](https://discourse.julialang.org/t/givens-matrix-for-an-integer-vector/25520/5 "2019-06-21T13:12:16Z")

</div>

Thanks for the opinion. I have filed a bug: [https://github.com/JuliaLang/julia/issues/32388](https://github.com/JuliaLang/julia/issues/32388).

---

<div class="post-metadata">

**Author:** ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Post date:** [June 21, 2019, 1:55pm UTC](https://discourse.julialang.org/t/givens-matrix-for-an-integer-vector/25520/6 "2019-06-21T13:55:43Z")

</div>

Andreas, you closed the issue on github [https://github.com/JuliaLang/julia/issues/32388](https://github.com/JuliaLang/julia/issues/32388) while explaining that the problem had already been fixed. Could you, however, give me a hint on how to proceed now, before the fix reaches the release of Julia? For example, will my switching to some nightly build help? Thanks.

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [June 21, 2019, 2:23pm UTC](https://discourse.julialang.org/t/givens-matrix-for-an-integer-vector/25520/7 "2019-06-21T14:23:48Z")

</div>

Yes. You could either use nightly but it is probably simpler just to carry the definition locally until the next version of Julia is released since it is so small.
