Mercurial > hg > octave-lojdl
changeset 1099:8a5b0b2caf44
[project @ 1995-02-14 01:39:08 by jwe]
author | jwe |
---|---|
date | Tue, 14 Feb 1995 01:39:08 +0000 |
parents | c0f319a1e51d |
children | 3b6f6c5217e7 |
files | liboctave/dRowVector.cc |
diffstat | 1 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/dRowVector.cc +++ b/liboctave/dRowVector.cc @@ -442,6 +442,24 @@ elem (i) = f (elem (i)); } +RowVector +linspace (double x1, double x2, int n) +{ + RowVector retval; + + if (n > 0) + { + retval.resize (n); + double delta = (x2 - x1) / (n - 1); + retval.elem (0) = x1; + for (int i = 1; i < n-1; i++) + retval.elem (i) = x1 + i * delta; + retval.elem (n-1) = x2; + } + + return retval; +} + double RowVector::min (void) const {