Skip to content

Commit

Permalink
Don't use Union types in sparse.j, until issue #22 is fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
ViralBShah committed May 15, 2011
1 parent ef181a2 commit 14af18f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions j/sparse.j
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,17 @@ macro binary_op_A_sparse_B_sparse_res_sparse(op)
end # quote
end # macro

(+)(A::SparseMatrixCSC, B::Union(Array,Number)) = (+)(full(A), B)
(+)(A::Union(Array,Number), B::SparseMatrixCSC) = (+)(A, full(B))
(+)(A::SparseMatrixCSC, B::Number) = (+)(full(A), B)
(+)(A::Number, B::SparseMatrixCSC) = (+)(A, full(B))
(+)(A::SparseMatrixCSC, B::Array) = (+)(full(A), B)
(+)(A::Array, B::SparseMatrixCSC) = (+)(A, full(B))
(+)(A::SparseMatrixCSC, B::Array) = (+)(full(A), B)
@binary_op_A_sparse_B_sparse_res_sparse (+)

(-)(A::SparseMatrixCSC, B::Union(Array,Number)) = (-)(full(A), B)
(-)(A::Union(Array,Number), B::SparseMatrixCSC) = (-)(A, full(B))
(-)(A::SparseMatrixCSC, B::Number) = (-)(full(A), B)
(-)(A::Number, B::SparseMatrixCSC) = (-)(A, full(B))
(-)(A::SparseMatrixCSC, B::Array) = (-)(full(A), B)
(-)(A::Array, B::SparseMatrixCSC) = (-)(A, full(B))
@binary_op_A_sparse_B_sparse_res_sparse (-)

(.*)(A::SparseMatrixCSC, B::Number) = SparseMatrixCSC(A.m, A.n, A.colptr, A.rowval, A.nzval .* B)
Expand Down

0 comments on commit 14af18f

Please sign in to comment.