| 1 | /*************************************************************************** | 
|---|
| 2 | * blitz/array/shape.h | 
|---|
| 3 | * | 
|---|
| 4 | * $Id: shape.h,v 1.1.1.1 1999-11-26 16:37:07 ansari Exp $ | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright (C) 1997,1998 Todd Veldhuizen <tveldhui@seurat.uwaterloo.ca> | 
|---|
| 7 | * | 
|---|
| 8 | * This program is free software; you can redistribute it and/or | 
|---|
| 9 | * modify it under the terms of the GNU General Public License | 
|---|
| 10 | * as published by the Free Software Foundation; either version 2 | 
|---|
| 11 | * of the License, or (at your option) any later version. | 
|---|
| 12 | * | 
|---|
| 13 | * This program is distributed in the hope that it will be useful, | 
|---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 16 | * GNU General Public License for more details. | 
|---|
| 17 | * | 
|---|
| 18 | * Suggestions:          blitz-suggest@cybervision.com | 
|---|
| 19 | * Bugs:                 blitz-bugs@cybervision.com | 
|---|
| 20 | * | 
|---|
| 21 | * For more information, please see the Blitz++ Home Page: | 
|---|
| 22 | *    http://seurat.uwaterloo.ca/blitz/ | 
|---|
| 23 | * | 
|---|
| 24 | *************************************************************************** | 
|---|
| 25 | * $Log: not supported by cvs2svn $ | 
|---|
| 26 | * Revision 1.1.1.1  1999/04/09  17:59:04  ansari | 
|---|
| 27 | * Creation module DPC/Blitz (blitz 0.4) Reza 09/04/99 | 
|---|
| 28 | * | 
|---|
| 29 | * Revision 1.1  1998/03/14 00:04:47  tveldhui | 
|---|
| 30 | * 0.2-alpha-05 | 
|---|
| 31 | * | 
|---|
| 32 | */ | 
|---|
| 33 |  | 
|---|
| 34 | #ifndef BZ_ARRAYSHAPE_H | 
|---|
| 35 | #define BZ_ARRAYSHAPE_H | 
|---|
| 36 |  | 
|---|
| 37 | #ifndef BZ_ARRAY_H | 
|---|
| 38 | #error <blitz/array/shape.h> must be included via <blitz/array.h> | 
|---|
| 39 | #endif | 
|---|
| 40 |  | 
|---|
| 41 | BZ_NAMESPACE(blitz) | 
|---|
| 42 |  | 
|---|
| 43 | /* | 
|---|
| 44 | * These routines make it easier to create shape parameters on | 
|---|
| 45 | * the fly: instead of having to write | 
|---|
| 46 | * | 
|---|
| 47 | * A.resize(TinyVector<int,4>(8,8,8,12)); | 
|---|
| 48 | * | 
|---|
| 49 | * you can just say | 
|---|
| 50 | * | 
|---|
| 51 | * A.resize(shape(8,8,8,12)); | 
|---|
| 52 | * | 
|---|
| 53 | */ | 
|---|
| 54 | inline TinyVector<int,1> shape(int n1) | 
|---|
| 55 | { return TinyVector<int,1>(n1); } | 
|---|
| 56 |  | 
|---|
| 57 | inline TinyVector<int,2> shape(int n1, int n2) | 
|---|
| 58 | { return TinyVector<int,2>(n1,n2); } | 
|---|
| 59 |  | 
|---|
| 60 | inline TinyVector<int,3> shape(int n1, int n2, int n3) | 
|---|
| 61 | { return TinyVector<int,3>(n1,n2,n3); } | 
|---|
| 62 |  | 
|---|
| 63 | inline TinyVector<int,4> shape(int n1, int n2, int n3, int n4) | 
|---|
| 64 | { return TinyVector<int,4>(n1,n2,n3,n4); } | 
|---|
| 65 |  | 
|---|
| 66 | inline TinyVector<int,5> shape(int n1, int n2, int n3, int n4, | 
|---|
| 67 | int n5) | 
|---|
| 68 | { return TinyVector<int,5>(n1,n2,n3,n4,n5); } | 
|---|
| 69 |  | 
|---|
| 70 | inline TinyVector<int,6> shape(int n1, int n2, int n3, int n4, | 
|---|
| 71 | int n5, int n6) | 
|---|
| 72 | { return TinyVector<int,6>(n1,n2,n3,n4,n5,n6); } | 
|---|
| 73 |  | 
|---|
| 74 | inline TinyVector<int,7> shape(int n1, int n2, int n3, int n4, | 
|---|
| 75 | int n5, int n6, int n7) | 
|---|
| 76 | { return TinyVector<int,7>(n1,n2,n3,n4,n5,n6,n7); } | 
|---|
| 77 |  | 
|---|
| 78 | inline TinyVector<int,8> shape(int n1, int n2, int n3, int n4, | 
|---|
| 79 | int n5, int n6, int n7, int n8) | 
|---|
| 80 | { return TinyVector<int,8>(n1,n2,n3,n4,n5,n6,n7,n8); } | 
|---|
| 81 |  | 
|---|
| 82 | inline TinyVector<int,9> shape(int n1, int n2, int n3, int n4, | 
|---|
| 83 | int n5, int n6, int n7, int n8, int n9) | 
|---|
| 84 | { return TinyVector<int,9>(n1,n2,n3,n4,n5,n6,n7,n8,n9); } | 
|---|
| 85 |  | 
|---|
| 86 | inline TinyVector<int,10> shape(int n1, int n2, int n3, int n4, | 
|---|
| 87 | int n5, int n6, int n7, int n8, int n9, int n10) | 
|---|
| 88 | { return TinyVector<int,10>(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10); } | 
|---|
| 89 |  | 
|---|
| 90 | inline TinyVector<int,11> shape(int n1, int n2, int n3, int n4, | 
|---|
| 91 | int n5, int n6, int n7, int n8, int n9, int n10, int n11) | 
|---|
| 92 | { return TinyVector<int,11>(n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11); } | 
|---|
| 93 |  | 
|---|
| 94 | BZ_NAMESPACE_END | 
|---|
| 95 |  | 
|---|
| 96 | #endif // BZ_ARRAYSHAPE_H | 
|---|
| 97 |  | 
|---|