| 376 | |
| 377 | template <class I, class T> |
| 378 | void csr_sum_duplicates(const I n_row, |
| 379 | const I n_col, |
| 380 | I Ap[], |
| 381 | I Aj[], |
| 382 | T Ax[]) |
| 383 | { |
| 384 | I nnz = 0; |
| 385 | I row_end = 0; |
| 386 | for(I i = 0; i < n_row; i++){ |
| 387 | I jj = row_end; |
| 388 | row_end = Ap[i+1]; |
| 389 | while( jj < row_end ){ |
| 390 | I j = Aj[jj]; |
| 391 | T x = Ax[jj]; |
| 392 | jj++; |
| 393 | while( jj < row_end && Aj[jj] == j ){ |
| 394 | x += Ax[jj]; |
| 395 | jj++; |
| 396 | } |
| 397 | Aj[nnz] = j; |
| 398 | Ax[nnz] = x; |
| 399 | nnz++; |
| 400 | } |
| 401 | Ap[i+1] = nnz; |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | EIGEN_DONT_INLINE Scalar* setrand_scipy(const Coordinates& coords, const Values& vals) |
| 406 | { |