Mercurial > hg > octave-nkf
comparison src/xdiv.cc @ 4543:79df15d4470c
[project @ 2003-10-18 03:53:52 by jwe]
author | jwe |
---|---|
date | Sat, 18 Oct 2003 03:53:53 +0000 |
parents | 6b96ce9f5743 |
children | 334a27c8f453 |
comparison
equal
deleted
inserted
replaced
4542:2633831cbeb5 | 4543:79df15d4470c |
---|---|
26 | 26 |
27 #include <cassert> | 27 #include <cassert> |
28 | 28 |
29 #include "CMatrix.h" | 29 #include "CMatrix.h" |
30 #include "dMatrix.h" | 30 #include "dMatrix.h" |
31 #include "CNDArray.h" | |
32 #include "dNDArray.h" | |
31 #include "oct-cmplx.h" | 33 #include "oct-cmplx.h" |
32 #include "quit.h" | 34 #include "quit.h" |
33 | 35 |
34 #include "error.h" | 36 #include "error.h" |
35 #include "xdiv.h" | 37 #include "xdiv.h" |
303 } | 305 } |
304 | 306 |
305 return result; | 307 return result; |
306 } | 308 } |
307 | 309 |
310 // Funny element by element division operations. | |
311 // | |
312 // op2 \ op1: s cs | |
313 // +-- +---+----+ | |
314 // N-d array | 1 | 3 | | |
315 // +---+----+ | |
316 // complex N-d array | 2 | 4 | | |
317 // +---+----+ | |
318 | |
319 NDArray | |
320 x_el_div (double a, const NDArray& b) | |
321 { | |
322 NDArray result (b.dims ()); | |
323 | |
324 for (int i = 0; i < b.length (); i++) | |
325 { | |
326 OCTAVE_QUIT; | |
327 result (i) = a / b (i); | |
328 } | |
329 | |
330 return result; | |
331 } | |
332 | |
333 ComplexNDArray | |
334 x_el_div (double a, const ComplexNDArray& b) | |
335 { | |
336 ComplexNDArray result (b.dims ()); | |
337 | |
338 for (int i = 0; i < b.length (); i++) | |
339 { | |
340 OCTAVE_QUIT; | |
341 result (i) = a / b (i); | |
342 } | |
343 | |
344 return result; | |
345 } | |
346 | |
347 ComplexNDArray | |
348 x_el_div (const Complex a, const NDArray& b) | |
349 { | |
350 ComplexNDArray result (b.dims ()); | |
351 | |
352 for (int i = 0; i < b.length (); i++) | |
353 { | |
354 OCTAVE_QUIT; | |
355 result (i) = a / b (i); | |
356 } | |
357 | |
358 return result; | |
359 } | |
360 | |
361 ComplexNDArray | |
362 x_el_div (const Complex a, const ComplexNDArray& b) | |
363 { | |
364 ComplexNDArray result (b.dims ()); | |
365 | |
366 for (int i = 0; i < b.length (); i++) | |
367 { | |
368 OCTAVE_QUIT; | |
369 result (i) = a / b (i); | |
370 } | |
371 | |
372 return result; | |
373 } | |
374 | |
308 // Left division functions. | 375 // Left division functions. |
309 // | 376 // |
310 // op2 \ op1: m cm | 377 // op2 \ op1: m cm |
311 // +-- +---+----+ | 378 // +-- +---+----+ |
312 // matrix | 1 | 3 | | 379 // matrix | 1 | 3 | |