/usr/include/blitz/indexexpr.h is in libblitz0-dev 1:0.10-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | // -*- C++ -*-
/***************************************************************************
* blitz/indexexpr.h Declaration of the IndexPlaceholder<N> class
*
* $Id$
*
* Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
*
* This file is a part of Blitz.
*
* Blitz is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Blitz is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Blitz. If not, see <http://www.gnu.org/licenses/>.
*
* Suggestions: blitz-devel@lists.sourceforge.net
* Bugs: blitz-support@lists.sourceforge.net
*
* For more information, please see the Blitz++ Home Page:
* https://sourceforge.net/projects/blitz/
*
***************************************************************************/
#ifndef BZ_INDEXEXPR_H
#define BZ_INDEXEXPR_H
#include <blitz/tinyvec2.h>
#include <blitz/prettyprint.h>
#include <blitz/etbase.h>
#include <blitz/array/domain.h>
#include <blitz/array/slice.h>
BZ_NAMESPACE(blitz)
template<int N>
class IndexPlaceholder
#ifdef BZ_NEW_EXPRESSION_TEMPLATES
: public ETBase<IndexPlaceholder<N> >
#endif
{
public:
IndexPlaceholder()
{ }
#ifdef BZ_NEW_EXPRESSION_TEMPLATES
IndexPlaceholder(const IndexPlaceholder<N>& x)
: ETBase< IndexPlaceholder<N> >(x)
{ }
#else
IndexPlaceholder(const IndexPlaceholder<N>&)
{ }
#endif
~IndexPlaceholder()
{ }
void operator=(const IndexPlaceholder<N>&)
{ }
typedef int T_numtype;
typedef int T_ctorArg1; // Dummy; not used
typedef int T_ctorArg2; // Ditto
typedef int T_range_result; // dummy
typedef typename opType<T_numtype>::T_optype T_optype;
typedef typename asET<T_numtype>::T_wrapped T_typeprop;
typedef typename unwrapET<T_typeprop>::T_unwrapped T_result;
static const int
numArrayOperands = 0,
numTVOperands = 0,
numTMOperands = 0,
numIndexPlaceholders = 1,
minWidth = simdTypes<T_numtype>::vecWidth,
maxWidth = simdTypes<T_numtype>::vecWidth,
rank_ = N+1;
/** The vectorized return type for an IndexPlaceholder should be
some form of range, but that's not useful since a vectorized
TinyVector assignment can not contain index placeholders. In
fact, since vectorization doesn't work for index expressions
anyway, we can just set this to a dummy. */
template<int M> struct tvresult {
typedef FastTV2Iterator<T_numtype, M> Type;
};
// If you have a precondition failure on this routine, it means
// you are trying to use stack iteration mode on an expression
// which contains an index placeholder. You must use index
// iteration mode instead.
int operator*() const {
BZPRECONDITION(0);
return 0;
}
#ifdef BZ_ARRAY_EXPR_PASS_INDEX_BY_VALUE
template<int N_rank>
T_result operator()(TinyVector<int, N_rank> i) const { return i[N]; }
#else
template<int N_rank>
T_result operator()(const TinyVector<int, N_rank>& i) const { return i[N]; }
#endif
int ascending(int) const { return INT_MIN; }
int ordering(int) const { return INT_MIN; }
int lbound(int) const { return INT_MIN; } // tiny(int());
int ubound(int) const { return INT_MAX; } // huge(int());
RectDomain<rank_> domain() const
{
const TinyVector<int, rank_> lb(lbound(0)), ub(ubound(0));
return RectDomain<rank_>(lb,ub);
}
// See operator*() note
void push(int) { BZPRECONDITION(0); }
void pop(int) { BZPRECONDITION(0); }
void advance() { BZPRECONDITION(0); }
void advance(int) { BZPRECONDITION(0); }
void loadStride(int) { BZPRECONDITION(0); }
template<int N_rank>
void moveTo(const TinyVector<int,N_rank>& i) { BZPRECONDITION(0); }
bool isUnitStride(int) const {
BZPRECONDITION(0);
return false;
}
bool isUnitStride() const {
BZPRECONDITION(0);
return false;
}
void advanceUnitStride() { BZPRECONDITION(0); }
bool canCollapse(int,int) const {
BZPRECONDITION(0);
return false;
}
T_result operator[](int) const {
BZPRECONDITION(0);
return T_numtype();
}
T_result fastRead(diffType) const {
BZPRECONDITION(0);
return T_numtype();
}
template<int M>
typename tvresult<M>::Type fastRead_tv(diffType) const {
BZPRECONDITION(0);
return TinyVector<T_numtype, M>();
}
/** There are no alignment issues here, so just return true. */
bool isVectorAligned(diffType offset) const {
return true; }
diffType suggestStride(int) const {
BZPRECONDITION(0);
return 0;
}
bool isStride(int,diffType) const {
BZPRECONDITION(0);
return true;
}
// don't know how to define shift, as it relies on having an
// implicit position. thus stencils won't work
T_result shift(int offset, int dim) const
{ BZPRECHECK(0,"Stencils of index expressions are not implemented");
return T_numtype(); }
T_result shift(int offset1, int dim1,int offset2, int dim2) const {
BZPRECHECK(0,"Stencils of index expressions are not implemented");
return T_numtype(); }
void _bz_offsetData(sizeType i) { BZPRECONDITION(0); }
// Unclear how to define this, and stencils don't work anyway
T_range_result operator()(RectDomain<rank_> d) const
{ BZPRECHECK(0,"Stencils of index expressions are not implemented");
return T_range_result(); }
void prettyPrint(BZ_STD_SCOPE(string) &str, prettyPrintFormat&) const {
// NEEDS_WORK-- do real formatting for reductions
str += "index-expr[NEEDS_WORK]";
}
template<typename T_shape>
bool shapeCheck(const T_shape&) const { return true; }
// sliceinfo for index placeholder does nothing
template<typename T1, typename T2 = nilArraySection,
class T3 = nilArraySection, typename T4 = nilArraySection,
class T5 = nilArraySection, typename T6 = nilArraySection,
class T7 = nilArraySection, typename T8 = nilArraySection,
class T9 = nilArraySection, typename T10 = nilArraySection,
class T11 = nilArraySection>
class SliceInfo {
public:
static const int new_rank = (N>0) ? ArraySectionInfo<T1>::rank : 0
+ (N>1) ? ArraySectionInfo<T2>::rank : 0
+ (N>2) ? ArraySectionInfo<T3>::rank : 0
+ (N>4) ? ArraySectionInfo<T4>::rank : 0
+ (N>5) ? ArraySectionInfo<T5>::rank : 0
+ (N>6) ? ArraySectionInfo<T6>::rank : 0
+ (N>7) ? ArraySectionInfo<T7>::rank : 0
+ (N>8) ? ArraySectionInfo<T8>::rank : 0
+ (N>9) ? ArraySectionInfo<T9>::rank : 0
+ (N>10) ? ArraySectionInfo<T10>::rank : 0
+ (N>11) ? ArraySectionInfo<T11>::rank : 0;
typedef IndexPlaceholder<new_rank> T_slice;
};
template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6,
typename T7, typename T8, typename T9, typename T10, typename T11>
typename SliceInfo<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>::T_slice
operator()(T1 r1, T2 r2, T3 r3, T4 r4, T5 r5, T6 r6, T7 r7, T8 r8, T9 r9, T10 r10, T11 r11) const
{
// slicing of index placeholders is not implemented. there are
// two problems: First, if you slice the dimension of the index
// placeholder, it should be replaced with a constant. Second,
// if you restrict the range of that dimension, the index
// placeholder should start from a nonzero value.
BZPRECONDITION(0);
}
};
typedef IndexPlaceholder<0> firstIndex;
typedef IndexPlaceholder<1> secondIndex;
typedef IndexPlaceholder<2> thirdIndex;
typedef IndexPlaceholder<3> fourthIndex;
typedef IndexPlaceholder<4> fifthIndex;
typedef IndexPlaceholder<5> sixthIndex;
typedef IndexPlaceholder<6> seventhIndex;
typedef IndexPlaceholder<7> eighthIndex;
typedef IndexPlaceholder<8> ninthIndex;
typedef IndexPlaceholder<9> tenthIndex;
typedef IndexPlaceholder<10> eleventhIndex;
#ifndef BZ_NO_TENSOR_INDEX_OBJECTS
BZ_NAMESPACE(tensor)
_bz_global blitz::IndexPlaceholder<0> i;
_bz_global blitz::IndexPlaceholder<1> j;
_bz_global blitz::IndexPlaceholder<2> k;
_bz_global blitz::IndexPlaceholder<3> l;
_bz_global blitz::IndexPlaceholder<4> m;
_bz_global blitz::IndexPlaceholder<5> n;
_bz_global blitz::IndexPlaceholder<6> o;
_bz_global blitz::IndexPlaceholder<7> p;
_bz_global blitz::IndexPlaceholder<8> q;
_bz_global blitz::IndexPlaceholder<9> r;
_bz_global blitz::IndexPlaceholder<10> s;
_bz_global blitz::IndexPlaceholder<11> t;
BZ_NAMESPACE_END // tensor
#endif
BZ_NAMESPACE_END
#endif // BZ_INDEXEXPR_H
|