[80] | 1 | /*************************************************************************** |
---|
| 2 | * blitz/array/shape.h |
---|
| 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_ARRAYSHAPE_H |
---|
| 24 | #define BZ_ARRAYSHAPE_H |
---|
| 25 | |
---|
| 26 | #ifndef BZ_ARRAY_H |
---|
| 27 | #error <blitz/array/shape.h> must be included via <blitz/array.h> |
---|
| 28 | #endif |
---|
| 29 | |
---|
| 30 | BZ_NAMESPACE(blitz) |
---|
| 31 | |
---|
| 32 | /* |
---|
| 33 | * These routines make it easier to create shape parameters on |
---|
| 34 | * the fly: instead of having to write |
---|
| 35 | * |
---|
| 36 | * A.resize(TinyVector<int,4>(8,8,8,12)); |
---|
| 37 | * |
---|
| 38 | * you can just say |
---|
| 39 | * |
---|
| 40 | * A.resize(shape(8,8,8,12)); |
---|
| 41 | * |
---|
| 42 | */ |
---|
| 43 | inline TinyVector<int,1> shape(int n1) |
---|
| 44 | { return TinyVector<int,1>(n1); } |
---|
| 45 | |
---|
| 46 | inline TinyVector<int,2> shape(int n1, int n2) |
---|
| 47 | { return TinyVector<int,2>(n1,n2); } |
---|
| 48 | |
---|
| 49 | inline TinyVector<int,3> shape(int n1, int n2, int n3) |
---|
| 50 | { return TinyVector<int,3>(n1,n2,n3); } |
---|
| 51 | |
---|
| 52 | inline TinyVector<int,4> shape(int n1, int n2, int n3, int n4) |
---|
| 53 | { return TinyVector<int,4>(n1,n2,n3,n4); } |
---|
| 54 | |
---|
| 55 | inline TinyVector<int,5> shape(int n1, int n2, int n3, int n4, |
---|
| 56 | int n5) |
---|
| 57 | { return TinyVector<int,5>(n1,n2,n3,n4,n5); } |
---|
| 58 | |
---|
| 59 | inline TinyVector<int,6> shape(int n1, int n2, int n3, int n4, |
---|
| 60 | int n5, int n6) |
---|
| 61 | { return TinyVector<int,6>(n1,n2,n3,n4,n5,n6); } |
---|
| 62 | |
---|
| 63 | inline TinyVector<int,7> shape(int n1, int n2, int n3, int n4, |
---|
| 64 | int n5, int n6, int n7) |
---|
| 65 | { return TinyVector<int,7>(n1,n2,n3,n4,n5,n6,n7); } |
---|
| 66 | |
---|
| 67 | inline TinyVector<int,8> shape(int n1, int n2, int n3, int n4, |
---|
| 68 | int n5, int n6, int n7, int n8) |
---|
| 69 | { return TinyVector<int,8>(n1,n2,n3,n4,n5,n6,n7,n8); } |
---|
| 70 | |
---|
| 71 | inline TinyVector<int,9> shape(int n1, int n2, int n3, int n4, |
---|
| 72 | int n5, int n6, int n7, int n8, int n9) |
---|
| 73 | { return TinyVector<int,9>(n1,n2,n3,n4,n5,n6,n7,n8,n9); } |
---|
| 74 | |
---|
| 75 | inline TinyVector<int,10> shape(int n1, int n2, int n3, int n4, |
---|
| 76 | int n5, int n6, int n7, int n8, int n9, int n10) |
---|
| 77 | { return TinyVector<int,10>(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10); } |
---|
| 78 | |
---|
| 79 | inline TinyVector<int,11> shape(int n1, int n2, int n3, int n4, |
---|
| 80 | int n5, int n6, int n7, int n8, int n9, int n10, int n11) |
---|
| 81 | { return TinyVector<int,11>(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11); } |
---|
| 82 | |
---|
| 83 | BZ_NAMESPACE_END |
---|
| 84 | |
---|
| 85 | #endif // BZ_ARRAYSHAPE_H |
---|
| 86 | |
---|