| [221] | 1 | /***************************************************************************
 | 
|---|
 | 2 |  * blitz/array/shape.h        
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  * $Id: shape.h,v 1.1.1.1 1999-04-09 17:59:04 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  1998/03/14 00:04:47  tveldhui
 | 
|---|
 | 27 |  * 0.2-alpha-05
 | 
|---|
 | 28 |  *
 | 
|---|
 | 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 | 
 | 
|---|