Mercurial > octave
changeset 25481:920299ced721
Calculate nnz for diagonal matrices efficiently (>1000X speedup) (bug #53198).
* ov-base-diag.h (nnz): Extract diagonal (N elements) and return nnz of
extracted vector rather than calling to_dense (N^2 elements) and returning
nnz of 2-D matrix.
author | Sahil Yadav <yadavsahil5198@gmail.com> |
---|---|
date | Wed, 21 Feb 2018 23:14:02 +0530 |
parents | 00bfb85bfb28 |
children | 37dbf79c2297 |
files | libinterp/octave-value/ov-base-diag.h |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base-diag.h Sat Jun 16 10:10:07 2018 +0200 +++ b/libinterp/octave-value/ov-base-diag.h Wed Feb 21 23:14:02 2018 +0530 @@ -80,7 +80,7 @@ dim_vector dims (void) const { return matrix.dims (); } - octave_idx_type nnz (void) const { return to_dense ().nnz (); } + octave_idx_type nnz (void) const { return diag ().nnz (); } octave_value reshape (const dim_vector& new_dims) const { return to_dense ().reshape (new_dims); }