source: XIOS/dev/dev_olga/src/extern/blitz/include/blitz/array/complex.cc @ 1022

Last change on this file since 1022 was 1022, checked in by mhnguyen, 8 years ago
File size: 1.8 KB
Line 
1/***************************************************************************
2 * blitz/array/complex.cc  Special functions for complex arrays
3 *
4 * $Id$
5 *
6 * Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
7 *
8 * This file is a part of Blitz.
9 *
10 * Blitz is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation, either version 3
13 * of the License, or (at your option) any later version.
14 *
15 * Blitz is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with Blitz.  If not, see <http://www.gnu.org/licenses/>.
22 *
23 * Suggestions:          blitz-devel@lists.sourceforge.net
24 * Bugs:                 blitz-support@lists.sourceforge.net   
25 *
26 * For more information, please see the Blitz++ Home Page:
27 *    https://sourceforge.net/projects/blitz/
28 *
29 ****************************************************************************/
30#ifndef BZ_ARRAYCOMPLEX_CC
31#define BZ_ARRAYCOMPLEX_CC
32
33// Special functions for complex arrays
34
35#ifndef BZ_ARRAY_H
36 #error <blitz/array/complex.cc> must be included via <blitz/array/array.h>
37#endif
38
39BZ_NAMESPACE(blitz)
40
41#ifdef BZ_HAVE_COMPLEX
42
43template<typename T_numtype, int N_rank>
44inline Array<T_numtype, N_rank> real(const Array<complex<T_numtype>,N_rank>& A)
45{
46    return A.extractComponent(T_numtype(), 0, 2);
47}
48
49template<typename T_numtype, int N_rank>
50inline Array<T_numtype, N_rank> imag(const Array<complex<T_numtype>,N_rank>& A)
51{
52    return A.extractComponent(T_numtype(), 1, 2);
53}
54
55
56#endif
57
58BZ_NAMESPACE_END
59
60#endif // BZ_ARRAYCOMPLEX_CC
61
Note: See TracBrowser for help on using the repository browser.