| 3695 | } |
| 3696 | |
| 3697 | void SparseMat::copyTo( SparseMat& m ) const |
| 3698 | { |
| 3699 | if( hdr == m.hdr ) |
| 3700 | return; |
| 3701 | if( !hdr ) |
| 3702 | { |
| 3703 | m.release(); |
| 3704 | return; |
| 3705 | } |
| 3706 | m.create( hdr->dims, hdr->size, type() ); |
| 3707 | SparseMatConstIterator from = begin(); |
| 3708 | size_t i, N = nzcount(), esz = elemSize(); |
| 3709 | |
| 3710 | for( i = 0; i < N; i++, ++from ) |
| 3711 | { |
| 3712 | const Node* n = from.node(); |
| 3713 | uchar* to = m.newNode(n->idx, n->hashval); |
| 3714 | copyElem( from.ptr, to, esz ); |
| 3715 | } |
| 3716 | } |
| 3717 | |
| 3718 | void SparseMat::copyTo( Mat& m ) const |
| 3719 | { |
no test coverage detected