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

The transpose of a 1x1 matrix should equal itself #32267

Closed
hochB opened this issue Jun 8, 2019 · 3 comments
Closed

The transpose of a 1x1 matrix should equal itself #32267

hochB opened this issue Jun 8, 2019 · 3 comments

Comments

@hochB
Copy link

hochB commented Jun 8, 2019

The transpose of a 1x1 matrix is itself, right?
Julia disagrees.

julia> A = [1]
1-element Array{Int64,1}:
 1

julia> A == A'
false
@fredrikekre
Copy link
Member

A is not a matrix, its a vector:

julia> A = fill(1, 1, 1)
1×1 Array{Int64,2}:
 1

julia> A == A'
true

@hochB
Copy link
Author

hochB commented Jun 8, 2019

Is this behavior also expected?

julia> A = [1 2 3]
1×3 Array{Int64,2}:
 1  2  3

julia> B = [1, 2, 3]
3-element Array{Int64,1}:
 1
 2
 3

julia> A'
3×1 LinearAlgebra.Adjoint{Int64,Array{Int64,2}}:
 1
 2
 3

julia> B'
1×3 LinearAlgebra.Adjoint{Int64,Array{Int64,1}}:
 1  2  3

julia> A == B'
true

julia> A' == B
false

@StefanKarpinski
Copy link
Member

It is. For further reading see JuliaLang/LinearAlgebra.jl#42. You can also ask questions on Discourse.

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

3 participants