I am trying to do a row vector times a matrix but it give an adjoint type instead of a row vector? should I do (A’A[1,:])'? I need the results to be a vector so I can continue other calculation.
Thanks.
A=sparse([1 2;3 4])
A[1,:]'A
#1×2 adjoint(::SparseVector{Int64, Int64}) with eltype Int64
Thanks. But I just did a type conversion for it like:
sparsevec(A[1,:]'A)
This solved my problem.
A little more direct (and performant) is either of
julia> (A[1,:]' * A)'
2-element SparseVector{Int64, Int64} with 2 stored entries:
[1] = 7
[2] = 10
julia> A' * A[1,:]
2-element SparseVector{Int64, Int64} with 2 stored entries:
[1] = 7
[2] = 10
For real numbers this is fine, but if your numbers are complex then you should be careful about the conjugation of the result.