@@ -311,6 +311,12 @@ function Base.similar(::Type{<:OldPSparseMatrix{V}},inds::Tuple{<:PRange,<:PRang
311311 OldPSparseMatrix (matrix_partition,partition (rows),partition (cols))
312312end
313313
314+ function Base. copy (a:: OldPSparseMatrix )
315+ mats = map (copy,partition (a))
316+ cache = map (copy_cache,a. cache)
317+ OldPSparseMatrix (mats,partition (axes (a,1 )),partition (axes (a,2 )),cache)
318+ end
319+
314320function Base. copy! (a:: OldPSparseMatrix ,b:: OldPSparseMatrix )
315321 @assert size (a) == size (b)
316322 copyto! (a,b)
@@ -674,6 +680,15 @@ function Base.similar(a::AbstractSplitMatrix,::Type{T}) where T
674680 split_matrix (blocks,a. row_permutation,a. col_permutation)
675681end
676682
683+ function Base. copy (a:: AbstractSplitMatrix )
684+ own_own = copy (a. blocks. own_own)
685+ own_ghost = copy (a. blocks. own_ghost)
686+ ghost_own = copy (a. blocks. ghost_own)
687+ ghost_ghost = copy (a. blocks. ghost_ghost)
688+ blocks = split_matrix_blocks (own_own,own_ghost,ghost_own,ghost_ghost)
689+ split_matrix (blocks,a. row_permutation,a. col_permutation)
690+ end
691+
677692function Base. copy! (a:: AbstractSplitMatrix ,b:: AbstractSplitMatrix )
678693 copy! (a. blocks. own_own,b. blocks. own_own)
679694 copy! (a. blocks. own_ghost,b. blocks. own_ghost)
@@ -1995,6 +2010,12 @@ function Base.similar(a::PSparseMatrix,::Type{T}) where T
19952010 PSparseMatrix (matrix_partition,partition (rows),partition (cols),a. assembled)
19962011end
19972012
2013+ function Base. copy (a:: PSparseMatrix )
2014+ mats = map (copy,partition (a))
2015+ rows, cols = axes (a)
2016+ PSparseMatrix (mats,partition (rows),partition (cols),a. assembled)
2017+ end
2018+
19982019function Base. copy! (a:: PSparseMatrix ,b:: PSparseMatrix )
19992020 @assert size (a) == size (b)
20002021 @assert a. assembled == b. assembled
0 commit comments