1 | // -*- C++ -*- |
---|
2 | /*************************************************************************** |
---|
3 | * blitz/array/shape.h |
---|
4 | * |
---|
5 | * $Id$ |
---|
6 | * |
---|
7 | * Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org> |
---|
8 | * |
---|
9 | * This file is a part of Blitz. |
---|
10 | * |
---|
11 | * Blitz is free software: you can redistribute it and/or modify |
---|
12 | * it under the terms of the GNU Lesser General Public License |
---|
13 | * as published by the Free Software Foundation, either version 3 |
---|
14 | * of the License, or (at your option) any later version. |
---|
15 | * |
---|
16 | * Blitz is distributed in the hope that it will be useful, |
---|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
19 | * GNU Lesser General Public License for more details. |
---|
20 | * |
---|
21 | * You should have received a copy of the GNU Lesser General Public |
---|
22 | * License along with Blitz. If not, see <http://www.gnu.org/licenses/>. |
---|
23 | * |
---|
24 | * Suggestions: blitz-devel@lists.sourceforge.net |
---|
25 | * Bugs: blitz-support@lists.sourceforge.net |
---|
26 | * |
---|
27 | * For more information, please see the Blitz++ Home Page: |
---|
28 | * https://sourceforge.net/projects/blitz/ |
---|
29 | * |
---|
30 | ****************************************************************************/ |
---|
31 | #ifndef BZ_ARRAYSHAPE_H |
---|
32 | #define BZ_ARRAYSHAPE_H |
---|
33 | |
---|
34 | #ifndef BZ_ARRAY_H |
---|
35 | #error <blitz/array/shape.h> must be included via <blitz/array.h> |
---|
36 | #endif |
---|
37 | |
---|
38 | BZ_NAMESPACE(blitz) |
---|
39 | |
---|
40 | /* |
---|
41 | * These routines make it easier to create shape parameters on |
---|
42 | * the fly: instead of having to write |
---|
43 | * |
---|
44 | * A.resize(TinyVector<int,4>(8,8,8,12)); |
---|
45 | * |
---|
46 | * you can just say |
---|
47 | * |
---|
48 | * A.resize(shape(8,8,8,12)); |
---|
49 | * |
---|
50 | */ |
---|
51 | inline TinyVector<int,1> shape(int n1) |
---|
52 | { return TinyVector<int,1>(n1); } |
---|
53 | |
---|
54 | inline TinyVector<int,2> shape(int n1, int n2) |
---|
55 | { return TinyVector<int,2>(n1,n2); } |
---|
56 | |
---|
57 | inline TinyVector<int,3> shape(int n1, int n2, int n3) |
---|
58 | { return TinyVector<int,3>(n1,n2,n3); } |
---|
59 | |
---|
60 | inline TinyVector<int,4> shape(int n1, int n2, int n3, int n4) |
---|
61 | { return TinyVector<int,4>(n1,n2,n3,n4); } |
---|
62 | |
---|
63 | inline TinyVector<int,5> shape(int n1, int n2, int n3, int n4, |
---|
64 | int n5) |
---|
65 | { return TinyVector<int,5>(n1,n2,n3,n4,n5); } |
---|
66 | |
---|
67 | inline TinyVector<int,6> shape(int n1, int n2, int n3, int n4, |
---|
68 | int n5, int n6) |
---|
69 | { return TinyVector<int,6>(n1,n2,n3,n4,n5,n6); } |
---|
70 | |
---|
71 | inline TinyVector<int,7> shape(int n1, int n2, int n3, int n4, |
---|
72 | int n5, int n6, int n7) |
---|
73 | { return TinyVector<int,7>(n1,n2,n3,n4,n5,n6,n7); } |
---|
74 | |
---|
75 | inline TinyVector<int,8> shape(int n1, int n2, int n3, int n4, |
---|
76 | int n5, int n6, int n7, int n8) |
---|
77 | { return TinyVector<int,8>(n1,n2,n3,n4,n5,n6,n7,n8); } |
---|
78 | |
---|
79 | inline TinyVector<int,9> shape(int n1, int n2, int n3, int n4, |
---|
80 | int n5, int n6, int n7, int n8, int n9) |
---|
81 | { return TinyVector<int,9>(n1,n2,n3,n4,n5,n6,n7,n8,n9); } |
---|
82 | |
---|
83 | inline TinyVector<int,10> shape(int n1, int n2, int n3, int n4, |
---|
84 | int n5, int n6, int n7, int n8, int n9, int n10) |
---|
85 | { return TinyVector<int,10>(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10); } |
---|
86 | |
---|
87 | inline TinyVector<int,11> shape(int n1, int n2, int n3, int n4, |
---|
88 | int n5, int n6, int n7, int n8, int n9, int n10, int n11) |
---|
89 | { return TinyVector<int,11>(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11); } |
---|
90 | |
---|
91 | BZ_NAMESPACE_END |
---|
92 | |
---|
93 | #endif // BZ_ARRAYSHAPE_H |
---|
94 | |
---|