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

should ctranspose on an Array{Any} take conjugates? #5449

Closed
simonster opened this issue Jan 20, 2014 · 3 comments
Closed

should ctranspose on an Array{Any} take conjugates? #5449

simonster opened this issue Jan 20, 2014 · 3 comments

Comments

@simonster
Copy link
Member

I realized this when looking into #5448 and I'm not sure if it's intended behavior or a bug. At the moment we have:

julia> [0.0+1.0im]'
1x1 Array{Complex{Float64},2}:
 0.0-1.0im

julia> {0.0+1.0im}'
1x1 Array{Any,2}:
 0.0+1.0im

If this is intended behavior, we should document it. If not, we'd have to decide whether to call conj on all elements where it's applicable (which would include complex arrays) or only elements that are typed as Complex. Both of these potential solutions seem to require an extra function call for each element in non-concrete arrays, which would not be great from a performance standpoint, but since non-concrete arrays are not going to be fast to begin with, perhaps this would be acceptable?

@JeffBezanson
Copy link
Member

I do not think this is intentional.
On Jan 19, 2014 8:49 PM, "Simon Kornblith" [email protected] wrote:

I realized this when looking into #5448https://github.com/JuliaLang/julia/issues/5448and I'm not sure if it's intended behavior or a bug. At the moment we have:

julia> [0.0+1.0im]'1x1 Array{Complex{Float64},2}:
0.0-1.0im
julia> {0.0+1.0im}'1x1 Array{Any,2}:
0.0+1.0im

If this is intended behavior, we should document it. If not, we'd have to
decide whether to call conj on all elements where it's applicable (which
would include complex arrays) or only elements that are typed as Complex.
Both of these potential solutions seem to require an extra function call
for each element in non-dense non-numeric arrays, which would not be great
from a performance standpoint, but since non-dense arrays are not going to
be fast to begin with, perhaps this would be acceptable?


Reply to this email directly or view it on GitHubhttps://github.com//issues/5449
.

@StefanKarpinski
Copy link
Member

We should call conj on all the elements of any array that ctranspose is called on. We may want to define conj(x) = x, conj(x::Real) = x and make conj(x::Number) an error so that you can use A' for non-numeric arrays, but it seems pretty clear to me that having A' just do transpose for non-numeric A is asking for trouble.

@simonster
Copy link
Member Author

That is the easiest way, but I wonder whether it will be confusing that conj is recursively applied to arrays inside the array while transpose is not.

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