Mercurial > octave-nkf
comparison liboctave/dim-vector.h @ 14624:edf9ca8a92a8 stable
when redimensioning, always pad dim_vector objects with 1 (bug #33216)
* dim-vector.cc (dim_vector::redim): Always pad with 1.
* dim-vector.h (dim_vector::redim): Update comment.
* Array.cc (Array<T>::assign): Query dimensions for all zeros before
redimensioning.
* ov-struct.cc: New test.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 11 May 2012 12:33:13 -0400 |
parents | 72c96de7a403 |
children | bb5ecda3b975 |
comparison
equal
deleted
inserted
replaced
14597:6980b0f35df9 | 14624:edf9ca8a92a8 |
---|---|
379 bool hvcat (const dim_vector& dvb, int dim); | 379 bool hvcat (const dim_vector& dvb, int dim); |
380 | 380 |
381 // Force certain dimensionality, preserving numel (). Missing | 381 // Force certain dimensionality, preserving numel (). Missing |
382 // dimensions are set to 1, redundant are folded into the trailing | 382 // dimensions are set to 1, redundant are folded into the trailing |
383 // one. If n = 1, the result is 2d and the second dim is 1 | 383 // one. If n = 1, the result is 2d and the second dim is 1 |
384 // (dim_vectors are always at least 2D). If the original dimensions | 384 // (dim_vectors are always at least 2D). |
385 // were all zero, the padding value is zero. | |
386 | 385 |
387 dim_vector redim (int n) const; | 386 dim_vector redim (int n) const; |
388 | 387 |
389 dim_vector as_column (void) const | 388 dim_vector as_column (void) const |
390 { | 389 { |