Mercurial > hg > octave-nkf
annotate liboctave/array/CRowVector.cc @ 20428:b2100e1659ac
maint: Use cuddled parentheses when indexing dimension_vectors.
* libinterp/corefcn/besselj.cc, libinterp/corefcn/bsxfun.cc,
libinterp/corefcn/data.cc, libinterp/corefcn/dot.cc, libinterp/corefcn/fft.cc,
libinterp/corefcn/fft2.cc, libinterp/corefcn/tril.cc,
libinterp/corefcn/typecast.cc, libinterp/octave-value/ov-base-int.cc,
libinterp/octave-value/ov-base-mat.cc,
libinterp/octave-value/ov-base-sparse.cc,
libinterp/octave-value/ov-bool-mat.cc, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-flt-cx-mat.cc,
libinterp/octave-value/ov-flt-re-mat.cc, libinterp/octave-value/ov-lazy-idx.cc,
libinterp/octave-value/ov-re-mat.cc, libinterp/octave-value/ov-str-mat.cc,
libinterp/octave-value/ov-struct.cc, liboctave/array/Array-util.cc,
liboctave/array/Array.cc, liboctave/array/CMatrix.cc,
liboctave/array/CNDArray.cc, liboctave/array/MArray.cc,
liboctave/array/Sparse.cc, liboctave/array/dMatrix.cc,
liboctave/array/dNDArray.cc, liboctave/array/fCMatrix.cc,
liboctave/array/fCNDArray.cc, liboctave/array/fMatrix.cc,
liboctave/array/fNDArray.cc, liboctave/operators/mx-inlines.cc:
maint: Use cuddled parentheses when indexing dimension_vectors.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 23 May 2015 21:46:44 -0700 |
parents | 4197fc428c7d |
children | a9574e3c6e9e |
rev | line source |
---|---|
1993 | 1 // RowVector manipulations. |
458 | 2 /* |
3 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
4 Copyright (C) 1994-2015 John W. Eaton |
458 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
458 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
458 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
1192 | 25 #include <config.h> |
458 | 26 #endif |
27 | |
3503 | 28 #include <iostream> |
458 | 29 |
4669 | 30 #include "Array-util.h" |
1847 | 31 #include "f77-fcn.h" |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7482
diff
changeset
|
32 #include "functor.h" |
1368 | 33 #include "lo-error.h" |
458 | 34 #include "mx-base.h" |
35 #include "mx-inlines.cc" | |
1650 | 36 #include "oct-cmplx.h" |
458 | 37 |
38 // Fortran functions we call. | |
39 | |
40 extern "C" | |
41 { | |
4552 | 42 F77_RET_T |
43 F77_FUNC (zgemv, ZGEMV) (F77_CONST_CHAR_ARG_DECL, | |
11518 | 44 const octave_idx_type&, const octave_idx_type&, |
45 const Complex&, const Complex*, | |
46 const octave_idx_type&, const Complex*, | |
47 const octave_idx_type&, const Complex&, Complex*, | |
48 const octave_idx_type& | |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
49 F77_CHAR_ARG_LEN_DECL); |
5983 | 50 |
51 F77_RET_T | |
11518 | 52 F77_FUNC (xzdotu, XZDOTU) (const octave_idx_type&, const Complex*, |
53 const octave_idx_type&, const Complex*, | |
54 const octave_idx_type&, Complex&); | |
458 | 55 } |
56 | |
1360 | 57 // Complex Row Vector class |
458 | 58 |
2386 | 59 bool |
458 | 60 ComplexRowVector::operator == (const ComplexRowVector& a) const |
61 { | |
5275 | 62 octave_idx_type len = length (); |
458 | 63 if (len != a.length ()) |
64 return 0; | |
9550
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8999
diff
changeset
|
65 return mx_inline_equal (len, data (), a.data ()); |
458 | 66 } |
67 | |
2386 | 68 bool |
458 | 69 ComplexRowVector::operator != (const ComplexRowVector& a) const |
70 { | |
71 return !(*this == a); | |
72 } | |
73 | |
74 // destructive insert/delete/reorder operations | |
75 | |
76 ComplexRowVector& | |
5275 | 77 ComplexRowVector::insert (const RowVector& a, octave_idx_type c) |
458 | 78 { |
5275 | 79 octave_idx_type a_len = a.length (); |
4316 | 80 |
1699 | 81 if (c < 0 || c + a_len > length ()) |
458 | 82 { |
83 (*current_liboctave_error_handler) ("range error for insert"); | |
84 return *this; | |
85 } | |
86 | |
4316 | 87 if (a_len > 0) |
88 { | |
89 make_unique (); | |
90 | |
5275 | 91 for (octave_idx_type i = 0; i < a_len; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
92 xelem (c+i) = a.elem (i); |
4316 | 93 } |
458 | 94 |
95 return *this; | |
96 } | |
97 | |
98 ComplexRowVector& | |
5275 | 99 ComplexRowVector::insert (const ComplexRowVector& a, octave_idx_type c) |
458 | 100 { |
5275 | 101 octave_idx_type a_len = a.length (); |
4316 | 102 |
1699 | 103 if (c < 0 || c + a_len > length ()) |
458 | 104 { |
105 (*current_liboctave_error_handler) ("range error for insert"); | |
106 return *this; | |
107 } | |
108 | |
4316 | 109 if (a_len > 0) |
110 { | |
111 make_unique (); | |
112 | |
5275 | 113 for (octave_idx_type i = 0; i < a_len; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
114 xelem (c+i) = a.elem (i); |
4316 | 115 } |
458 | 116 |
117 return *this; | |
118 } | |
119 | |
120 ComplexRowVector& | |
121 ComplexRowVector::fill (double val) | |
122 { | |
5275 | 123 octave_idx_type len = length (); |
4316 | 124 |
458 | 125 if (len > 0) |
4316 | 126 { |
127 make_unique (); | |
128 | |
5275 | 129 for (octave_idx_type i = 0; i < len; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
130 xelem (i) = val; |
4316 | 131 } |
132 | |
458 | 133 return *this; |
134 } | |
135 | |
136 ComplexRowVector& | |
137 ComplexRowVector::fill (const Complex& val) | |
138 { | |
5275 | 139 octave_idx_type len = length (); |
4316 | 140 |
458 | 141 if (len > 0) |
4316 | 142 { |
143 make_unique (); | |
144 | |
5275 | 145 for (octave_idx_type i = 0; i < len; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
146 xelem (i) = val; |
4316 | 147 } |
148 | |
458 | 149 return *this; |
150 } | |
151 | |
152 ComplexRowVector& | |
5275 | 153 ComplexRowVector::fill (double val, octave_idx_type c1, octave_idx_type c2) |
458 | 154 { |
5275 | 155 octave_idx_type len = length (); |
4316 | 156 |
458 | 157 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) |
158 { | |
159 (*current_liboctave_error_handler) ("range error for fill"); | |
160 return *this; | |
161 } | |
162 | |
17663
7975d75f933c
Use std::swap in liboctave instead of temporary variable.
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
163 if (c1 > c2) { std::swap (c1, c2); } |
458 | 164 |
4316 | 165 if (c2 >= c1) |
166 { | |
167 make_unique (); | |
168 | |
5275 | 169 for (octave_idx_type i = c1; i <= c2; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
170 xelem (i) = val; |
4316 | 171 } |
458 | 172 |
173 return *this; | |
174 } | |
175 | |
176 ComplexRowVector& | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
177 ComplexRowVector::fill (const Complex& val, |
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
178 octave_idx_type c1, octave_idx_type c2) |
458 | 179 { |
5275 | 180 octave_idx_type len = length (); |
4316 | 181 |
458 | 182 if (c1 < 0 || c2 < 0 || c1 >= len || c2 >= len) |
183 { | |
184 (*current_liboctave_error_handler) ("range error for fill"); | |
185 return *this; | |
186 } | |
187 | |
17663
7975d75f933c
Use std::swap in liboctave instead of temporary variable.
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
188 if (c1 > c2) { std::swap (c1, c2); } |
458 | 189 |
4316 | 190 if (c2 >= c1) |
191 { | |
192 make_unique (); | |
193 | |
5275 | 194 for (octave_idx_type i = c1; i <= c2; i++) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
195 xelem (i) = val; |
4316 | 196 } |
458 | 197 |
198 return *this; | |
199 } | |
200 | |
201 ComplexRowVector | |
202 ComplexRowVector::append (const RowVector& a) const | |
203 { | |
5275 | 204 octave_idx_type len = length (); |
205 octave_idx_type nc_insert = len; | |
458 | 206 ComplexRowVector retval (len + a.length ()); |
207 retval.insert (*this, 0); | |
208 retval.insert (a, nc_insert); | |
209 return retval; | |
210 } | |
211 | |
212 ComplexRowVector | |
213 ComplexRowVector::append (const ComplexRowVector& a) const | |
214 { | |
5275 | 215 octave_idx_type len = length (); |
216 octave_idx_type nc_insert = len; | |
458 | 217 ComplexRowVector retval (len + a.length ()); |
218 retval.insert (*this, 0); | |
219 retval.insert (a, nc_insert); | |
220 return retval; | |
221 } | |
222 | |
223 ComplexColumnVector | |
224 ComplexRowVector::hermitian (void) const | |
225 { | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
226 return MArray<Complex>::hermitian (std::conj); |
458 | 227 } |
228 | |
229 ComplexColumnVector | |
230 ComplexRowVector::transpose (void) const | |
231 { | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7503
diff
changeset
|
232 return MArray<Complex>::transpose (); |
458 | 233 } |
234 | |
235 ComplexRowVector | |
236 conj (const ComplexRowVector& a) | |
237 { | |
13107
353c71c76f22
maint: fix compilation problem with g++ -std=c++0x option
Júlio Hoffimann <julio.hoffimann@gmail.com>
parents:
11523
diff
changeset
|
238 return do_mx_unary_map<Complex, Complex, std::conj<double> > (a); |
458 | 239 } |
240 | |
241 // resize is the destructive equivalent for this one | |
242 | |
243 ComplexRowVector | |
5275 | 244 ComplexRowVector::extract (octave_idx_type c1, octave_idx_type c2) const |
458 | 245 { |
17663
7975d75f933c
Use std::swap in liboctave instead of temporary variable.
Rik <rik@octave.org>
parents:
15271
diff
changeset
|
246 if (c1 > c2) { std::swap (c1, c2); } |
458 | 247 |
5275 | 248 octave_idx_type new_c = c2 - c1 + 1; |
458 | 249 |
250 ComplexRowVector result (new_c); | |
251 | |
5275 | 252 for (octave_idx_type i = 0; i < new_c; i++) |
458 | 253 result.elem (i) = elem (c1+i); |
254 | |
255 return result; | |
256 } | |
257 | |
4316 | 258 ComplexRowVector |
5275 | 259 ComplexRowVector::extract_n (octave_idx_type r1, octave_idx_type n) const |
4316 | 260 { |
261 ComplexRowVector result (n); | |
262 | |
5275 | 263 for (octave_idx_type i = 0; i < n; i++) |
4316 | 264 result.elem (i) = elem (r1+i); |
265 | |
266 return result; | |
267 } | |
268 | |
458 | 269 // row vector by row vector -> row vector operations |
270 | |
271 ComplexRowVector& | |
272 ComplexRowVector::operator += (const RowVector& a) | |
273 { | |
5275 | 274 octave_idx_type len = length (); |
2386 | 275 |
5275 | 276 octave_idx_type a_len = a.length (); |
2386 | 277 |
278 if (len != a_len) | |
458 | 279 { |
2386 | 280 gripe_nonconformant ("operator +=", len, a_len); |
458 | 281 return *this; |
282 } | |
283 | |
284 if (len == 0) | |
285 return *this; | |
286 | |
287 Complex *d = fortran_vec (); // Ensures only one reference to my privates! | |
288 | |
9550
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8999
diff
changeset
|
289 mx_inline_add2 (len, d, a.data ()); |
458 | 290 return *this; |
291 } | |
292 | |
293 ComplexRowVector& | |
294 ComplexRowVector::operator -= (const RowVector& a) | |
295 { | |
5275 | 296 octave_idx_type len = length (); |
2386 | 297 |
5275 | 298 octave_idx_type a_len = a.length (); |
2386 | 299 |
300 if (len != a_len) | |
458 | 301 { |
2386 | 302 gripe_nonconformant ("operator -=", len, a_len); |
458 | 303 return *this; |
304 } | |
305 | |
306 if (len == 0) | |
307 return *this; | |
308 | |
309 Complex *d = fortran_vec (); // Ensures only one reference to my privates! | |
310 | |
9550
3d6a9aea2aea
refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
8999
diff
changeset
|
311 mx_inline_sub2 (len, d, a.data ()); |
458 | 312 return *this; |
313 } | |
314 | |
315 // row vector by matrix -> row vector | |
316 | |
317 ComplexRowVector | |
318 operator * (const ComplexRowVector& v, const ComplexMatrix& a) | |
319 { | |
1947 | 320 ComplexRowVector retval; |
321 | |
5275 | 322 octave_idx_type len = v.length (); |
1947 | 323 |
5275 | 324 octave_idx_type a_nr = a.rows (); |
325 octave_idx_type a_nc = a.cols (); | |
2386 | 326 |
327 if (a_nr != len) | |
328 gripe_nonconformant ("operator *", 1, len, a_nr, a_nc); | |
1947 | 329 else |
458 | 330 { |
1947 | 331 if (len == 0) |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
332 retval.resize (a_nc, 0.0); |
1947 | 333 else |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
334 { |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
335 // Transpose A to form A'*x == (x'*A)' |
1947 | 336 |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
337 octave_idx_type ld = a_nr; |
1947 | 338 |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
339 retval.resize (a_nc); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
340 Complex *y = retval.fortran_vec (); |
1947 | 341 |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
342 F77_XFCN (zgemv, ZGEMV, (F77_CONST_CHAR_ARG2 ("T", 1), |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
343 a_nr, a_nc, 1.0, a.data (), |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
344 ld, v.data (), 1, 0.0, y, 1 |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
345 F77_CHAR_ARG_LEN (1))); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
346 } |
458 | 347 } |
348 | |
1947 | 349 return retval; |
458 | 350 } |
351 | |
1205 | 352 ComplexRowVector |
353 operator * (const RowVector& v, const ComplexMatrix& a) | |
354 { | |
355 ComplexRowVector tmp (v); | |
356 return tmp * a; | |
357 } | |
358 | |
458 | 359 // other operations |
360 | |
361 Complex | |
362 ComplexRowVector::min (void) const | |
363 { | |
5275 | 364 octave_idx_type len = length (); |
458 | 365 if (len == 0) |
366 return Complex (0.0); | |
367 | |
368 Complex res = elem (0); | |
5260 | 369 double absres = std::abs (res); |
458 | 370 |
5275 | 371 for (octave_idx_type i = 1; i < len; i++) |
5260 | 372 if (std::abs (elem (i)) < absres) |
458 | 373 { |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
374 res = elem (i); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
375 absres = std::abs (res); |
458 | 376 } |
377 | |
378 return res; | |
379 } | |
380 | |
381 Complex | |
382 ComplexRowVector::max (void) const | |
383 { | |
5275 | 384 octave_idx_type len = length (); |
458 | 385 if (len == 0) |
386 return Complex (0.0); | |
387 | |
388 Complex res = elem (0); | |
5260 | 389 double absres = std::abs (res); |
458 | 390 |
5275 | 391 for (octave_idx_type i = 1; i < len; i++) |
5260 | 392 if (std::abs (elem (i)) > absres) |
458 | 393 { |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
394 res = elem (i); |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
395 absres = std::abs (res); |
458 | 396 } |
397 | |
398 return res; | |
399 } | |
400 | |
401 // i/o | |
402 | |
3504 | 403 std::ostream& |
404 operator << (std::ostream& os, const ComplexRowVector& a) | |
458 | 405 { |
406 // int field_width = os.precision () + 7; | |
5275 | 407 for (octave_idx_type i = 0; i < a.length (); i++) |
458 | 408 os << " " /* setw (field_width) */ << a.elem (i); |
409 return os; | |
410 } | |
411 | |
3504 | 412 std::istream& |
413 operator >> (std::istream& is, ComplexRowVector& a) | |
458 | 414 { |
14846
460a3c6d8bf1
maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
415 octave_idx_type len = a.length (); |
458 | 416 |
8999
dc07bc4157b8
allow empty matrices in stream input operators
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
417 if (len > 0) |
458 | 418 { |
419 Complex tmp; | |
5275 | 420 for (octave_idx_type i = 0; i < len; i++) |
458 | 421 { |
422 is >> tmp; | |
423 if (is) | |
424 a.elem (i) = tmp; | |
425 else | |
426 break; | |
427 } | |
428 } | |
532 | 429 return is; |
458 | 430 } |
431 | |
1205 | 432 // row vector by column vector -> scalar |
433 | |
434 // row vector by column vector -> scalar | |
435 | |
436 Complex | |
437 operator * (const ComplexRowVector& v, const ColumnVector& a) | |
438 { | |
439 ComplexColumnVector tmp (a); | |
440 return v * tmp; | |
441 } | |
442 | |
443 Complex | |
444 operator * (const ComplexRowVector& v, const ComplexColumnVector& a) | |
445 { | |
5983 | 446 Complex retval (0.0, 0.0); |
447 | |
5275 | 448 octave_idx_type len = v.length (); |
2386 | 449 |
5275 | 450 octave_idx_type a_len = a.length (); |
2386 | 451 |
452 if (len != a_len) | |
5983 | 453 gripe_nonconformant ("operator *", len, a_len); |
454 else if (len != 0) | |
455 F77_FUNC (xzdotu, XZDOTU) (len, v.data (), 1, a.data (), 1, retval); | |
1205 | 456 |
457 return retval; | |
458 } | |
459 | |
460 // other operations | |
461 | |
462 ComplexRowVector | |
5275 | 463 linspace (const Complex& x1, const Complex& x2, octave_idx_type n) |
1205 | 464 { |
9653
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
465 if (n < 1) n = 1; |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
466 |
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
467 NoAlias<ComplexRowVector> retval (n); |
1205 | 468 |
9653
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
469 Complex delta = (x2 - x1) / (n - 1.0); |
9658
3429c956de6f
extend linspace & fix up liboctave rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
9653
diff
changeset
|
470 retval(0) = x1; |
9653
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
471 for (octave_idx_type i = 1; i < n-1; i++) |
9658
3429c956de6f
extend linspace & fix up liboctave rewrite
Jaroslav Hajek <highegg@gmail.com>
parents:
9653
diff
changeset
|
472 retval(i) = x1 + static_cast<double> (i)*delta; |
9653
e087d7c77ff9
improve linspace in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents:
9550
diff
changeset
|
473 retval(n-1) = x2; |
1205 | 474 |
475 return retval; | |
476 } |