# Using ToeplitzMatrices

**URL:** https://discourse.julialang.org/t/using-toeplitzmatrices/53140
**Category:** General Usage
**Created:** [January 11, 2021, 4:04am UTC](https://discourse.julialang.org/t/using-toeplitzmatrices/53140 "2021-01-11T04:04:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![panditabupesh](https://avatars.discourse-cdn.com/v4/letter/p/ecc23a/32.png) [@panditabupesh](https://discourse.julialang.org/u/panditabupesh)
#### Post date: [January 11, 2021, 4:04am UTC](https://discourse.julialang.org/t/using-toeplitzmatrices/53140/1 "2021-01-11T04:04:55Z")

</div>

```julia
using ToeplitzMatrices
Hankel([1.,2.,3.], 3:5)

Hankel([1,2,3], 3:5)

```

The first example work, but the second fails with this message:  
ERROR: LoadError: TypeError: in new, expected Toeplitz{Int64,S} where S\<:Number, got a value of type Toeplitz{Float32,Complex{Float32}}  
Stacktrace:  
[1] \_Hankel at C:\Users\bupandit.julia\packages\ToeplitzMatrices\JiFWS\src\ToeplitzMatrices.jl:667 [inlined]  
[2] Hankel{Int64}(::Array{Int64,1}, ::UnitRange{Int64}) at C:\Users\bupandit.julia\packages\ToeplitzMatrices\JiFWS\src\ToeplitzMatrices.jl:677  
[3] Hankel(::Array{Int64,1}, ::UnitRange{Int64}) at C:\Users\bupandit.julia\packages\ToeplitzMatrices\JiFWS\src\ToeplitzMatrices.jl:680  
[4] top-level scope at C:\Projects\PHYBUDGET\pam4\_j\hankel\_example.jl:4  
[5] include(::String) at .\client.jl:457  
[6] top-level scope at REPL[113]:1  
in expression starting at C:\Projects\PHYBUDGET\pam4\_j\hankel\_example.jl:4

---

<div class="post-metadata">

### Author: ![Skoffer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skoffer/32/378_2.png) [@Skoffer](https://discourse.julialang.org/u/Skoffer)
#### Post date: [January 11, 2021, 10:32am UTC](https://discourse.julialang.org/t/using-toeplitzmatrices/53140/2 "2021-01-11T10:32:27Z")

</div>

It looks like a bug in `ToeplitzMatrices.jl`, at least this conversion looks suspicious

```julia
julia> convert(Toeplitz{Int}, Toeplitz{Int}([3, 4, 5], [3, 2, 1]))
3×3 Toeplitz{Float32, ComplexF32}:
 3.0 2.0 1.0
 4.0 3.0 2.0
 5.0 4.0 3.0

```

I think it makes sense to open an issue in ToeplitzMatrices.jl repository.

If you can allow yourself type piracy, you can override current behaviour with

```julia
import ToeplitzMatrices

ToeplitzMatrices.Toeplitz(vc::AbstractVector, vr::AbstractVector) = Toeplitz{promote_type(eltype(vc), eltype(vr))}(vc, vr)

```
