[80] | 1 | /*************************************************************************** |
---|
| 2 | * blitz/array/complex.cc Special functions for complex arrays |
---|
| 3 | * |
---|
| 4 | * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> |
---|
| 5 | * |
---|
| 6 | * This program is free software; you can redistribute it and/or |
---|
| 7 | * modify it under the terms of the GNU General Public License |
---|
| 8 | * as published by the Free Software Foundation; either version 2 |
---|
| 9 | * of the License, or (at your option) any later version. |
---|
| 10 | * |
---|
| 11 | * This program is distributed in the hope that it will be useful, |
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | * GNU General Public License for more details. |
---|
| 15 | * |
---|
| 16 | * Suggestions: blitz-dev@oonumerics.org |
---|
| 17 | * Bugs: blitz-bugs@oonumerics.org |
---|
| 18 | * |
---|
| 19 | * For more information, please see the Blitz++ Home Page: |
---|
| 20 | * http://oonumerics.org/blitz/ |
---|
| 21 | * |
---|
| 22 | ****************************************************************************/ |
---|
| 23 | #ifndef BZ_ARRAYCOMPLEX_CC |
---|
| 24 | #define BZ_ARRAYCOMPLEX_CC |
---|
| 25 | |
---|
| 26 | // Special functions for complex arrays |
---|
| 27 | |
---|
| 28 | #ifndef BZ_ARRAY_H |
---|
| 29 | #error <blitz/array/complex.cc> must be included via <blitz/array/array.h> |
---|
| 30 | #endif |
---|
| 31 | |
---|
| 32 | BZ_NAMESPACE(blitz) |
---|
| 33 | |
---|
| 34 | #ifdef BZ_HAVE_COMPLEX |
---|
| 35 | |
---|
| 36 | template<typename T_numtype, int N_rank> |
---|
| 37 | inline Array<T_numtype, N_rank> real(const Array<complex<T_numtype>,N_rank>& A) |
---|
| 38 | { |
---|
| 39 | return A.extractComponent(T_numtype(), 0, 2); |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | template<typename T_numtype, int N_rank> |
---|
| 43 | inline Array<T_numtype, N_rank> imag(const Array<complex<T_numtype>,N_rank>& A) |
---|
| 44 | { |
---|
| 45 | return A.extractComponent(T_numtype(), 1, 2); |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | #endif |
---|
| 50 | |
---|
| 51 | BZ_NAMESPACE_END |
---|
| 52 | |
---|
| 53 | #endif // BZ_ARRAYCOMPLEX_CC |
---|
| 54 | |
---|