Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No method matching rref(::Adjoint{Int64,Array{Int64,2}}) #14

Open
rmcsqrd opened this issue Nov 9, 2020 · 0 comments
Open

No method matching rref(::Adjoint{Int64,Array{Int64,2}}) #14

rmcsqrd opened this issue Nov 9, 2020 · 0 comments

Comments

@rmcsqrd
Copy link

rmcsqrd commented Nov 9, 2020

Thanks for making this package. I'm having a small issue when I try and use the rref() function on the transpose of a matrix.

Array works:

julia> using RowEchelon
julia> M = [1 -3 5 1 6;
           0 -1 1 0 3;
           3 -4 10 3 3;
           1 -1 3 1 0
           ];

julia> rref(M)
4×5 Array{Float64,2}:
 1.0  0.0   2.0   1.0  -3.0
 0.0  1.0  -1.0  -0.0  -3.0
 0.0  0.0   0.0   0.0   0.0
 0.0  0.0   0.0   0.0   0.0

julia> typeof(M)
Array{Int64,2}

Adjoint Fails:

julia> rref(M')
ERROR: MethodError: no method matching rref(::Adjoint{Int64,Array{Int64,2}})
Closest candidates are:
  rref(::Array{Complex{Float64},2}) at /Users/riomcmahon/.julia/packages/RowEchelon/7gDya/src/RowEchelon.jl:80
  rref(::Array{T,2}) where T<:Complex at /Users/riomcmahon/.julia/packages/RowEchelon/7gDya/src/RowEchelon.jl:79
  rref(::Array{T,2}) where T<:Union{Float16, Float32, Integer} at /Users/riomcmahon/.julia/packages/RowEchelon/7gDya/src/RowEchelon.jl:81
  ...
Stacktrace:
 [1] top-level scope at REPL[77]:1

julia> typeof(M')
Adjoint{Int64,Array{Int64,2}}

Converting to Matrix (or Array) works:

julia> rref(Matrix(M'))
5×4 Array{Float64,2}:
 1.0  0.0   3.0   1.0
 0.0  1.0  -5.0  -2.0
 0.0  0.0   0.0   0.0
 0.0  0.0   0.0   0.0
 0.0  0.0   0.0   0.0

I suggest that the following line be added to src/RowEchelon.jl:

rref(A::Adjoint) = rref(Matrix(A))

I will submit an appropriate pull request - just wanted to have a relevant issue to reference in my PR. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant