Skip to content

Commit

Permalink
better element type for sparse.^0
Browse files Browse the repository at this point in the history
I misspoke, in general it does not have the same type as A.
  • Loading branch information
JeffBezanson committed Feb 18, 2014
1 parent 4c72d02 commit b81df54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion base/sparse/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,9 @@ end # macro
(.\)(A::Array, B::SparseMatrixCSC) = (.\)(A, full(B))
(.\)(A::SparseMatrixCSC, B::SparseMatrixCSC) = (.\)(full(A), full(B))

(.^)(A::SparseMatrixCSC, B::Number) = B==0 ? sparse(ones(eltype(A), A.m, A.n)) : SparseMatrixCSC(A.m, A.n, copy(A.colptr), copy(A.rowval), A.nzval .^ B)
(.^)(A::SparseMatrixCSC, B::Number) =
B==0 ? sparse(ones(typeof(one(eltype(A)).^B), A.m, A.n)) :
SparseMatrixCSC(A.m, A.n, copy(A.colptr), copy(A.rowval), A.nzval .^ B)
(.^)(A::Number, B::SparseMatrixCSC) = (.^)(A, full(B))
(.^)(A::SparseMatrixCSC, B::Array) = (.^)(full(A), B)
(.^)(A::Array, B::SparseMatrixCSC) = (.^)(A, full(B))
Expand Down

1 comment on commit b81df54

@jiahao
Copy link
Member

@jiahao jiahao commented on b81df54 Feb 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'oh. I should stop trying to do things while still running on fumes.

Please sign in to comment.