?? array-impl.h
字號:
storage_.setBase(10, r10.first()); setupStorage(10); } /* * Create a reference of another array */ Array(const Array<T_numtype, N_rank>& array)#ifdef BZ_NEW_EXPRESSION_TEMPLATES : MemoryBlockReference<T_numtype>(), ETBase< Array<T_numtype, N_rank> >(array)#else : MemoryBlockReference<T_numtype>()#endif { // NEEDS_WORK: this const_cast is a tad ugly. reference(const_cast<T_array&>(array)); } /* * These constructors are used for creating interlaced arrays (see * <blitz/arrayshape.h> */ Array(const TinyVector<int,N_rank-1>& shape, int lastExtent, const GeneralArrayStorage<N_rank>& storage); //Array(const TinyVector<Range,N_rank-1>& shape, // int lastExtent, const GeneralArrayStorage<N_rank>& storage); /* * These constructors make the array a view of a subportion of another * array. If there fewer than N_rank Range arguments provided, no * slicing is performed in the unspecified ranks. * e.g. Array<int,3> A(20,20,20); * Array<int,3> B(A, Range(5,15)); * is equivalent to: * Array<int,3> B(A, Range(5,15), Range::all(), Range::all()); */ Array(Array<T_numtype, N_rank>& array, Range r0) { constructSubarray(array, r0); } Array(Array<T_numtype, N_rank>& array, Range r0, Range r1) { constructSubarray(array, r0, r1); } Array(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2) { constructSubarray(array, r0, r1, r2); } Array(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3) { constructSubarray(array, r0, r1, r2, r3); } Array(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4) { constructSubarray(array, r0, r1, r2, r3, r4); } Array(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5) { constructSubarray(array, r0, r1, r2, r3, r4, r5); } Array(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6) { constructSubarray(array, r0, r1, r2, r3, r4, r5, r6); } Array(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7) { constructSubarray(array, r0, r1, r2, r3, r4, r5, r6, r7); } Array(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8) { constructSubarray(array, r0, r1, r2, r3, r4, r5, r6, r7, r8); } Array(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8, Range r9) { constructSubarray(array, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9); } Array(Array<T_numtype, N_rank>& array, Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8, Range r9, Range r10) { constructSubarray(array, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10); } Array(Array<T_numtype, N_rank>& array, const RectDomain<N_rank>& subdomain) { constructSubarray(array, subdomain); } /* Constructor added by Julian Cummings */ Array(Array<T_numtype, N_rank>& array, const StridedDomain<N_rank>& subdomain) { constructSubarray(array, subdomain); } /* * This constructor is invoked by the operator()'s which take * a combination of integer and Range arguments. It's not intended * for end-user use. */ template<int N_rank2, typename R0, typename R1, typename R2, typename R3, typename R4, typename R5, typename R6, typename R7, typename R8, typename R9, typename R10> Array(Array<T_numtype,N_rank2>& array, R0 r0, R1 r1, R2 r2, R3 r3, R4 r4, R5 r5, R6 r6, R7 r7, R8 r8, R9 r9, R10 r10) { constructSlice(array, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10); } ////////////////////////////////////////////// // Member functions ////////////////////////////////////////////// const TinyVector<int, N_rank>& base() const { return storage_.base(); } int base(int rank) const { return storage_.base(rank); } iterator begin() { return iterator(*this); } const_iterator begin() const { return const_iterator(*this); } T_iterator beginFast() const { return T_iterator(*this); } // Deprecated: now extractComponent(...) template<typename P_numtype2> Array<P_numtype2,N_rank> chopComponent(P_numtype2 a, int compNum, int numComponents) const { return extractComponent(a, compNum, numComponents); } int cols() const { return length_[1]; } int columns() const { return length_[1]; } T_array copy() const; // data_ always refers to the point (0,0,...,0) which may // not be in the array if the base is not zero in each rank. // These data() routines return a pointer to the first // element in the array (but note that it may not be // stored first in memory if some ranks are stored descending). int dataOffset() const { return dot(storage_.base(), stride_); } const T_numtype* restrict data() const { return data_ + dataOffset(); } T_numtype* restrict data() { return data_ + dataOffset(); } // These dataZero() routines refer to the point (0,0,...,0) // which may not be in the array if the bases are nonzero. const T_numtype* restrict dataZero() const { return data_; } T_numtype* restrict dataZero() { return data_; } // These dataFirst() routines refer to the element in the // array which falls first in memory. int dataFirstOffset() const { int pos = 0; // Used to use tinyvector expressions: // return data_ + dot(storage_.base() // + (1 - storage_.ascendingFlag()) * (length_ - 1), stride_); for (int i=0; i < N_rank; ++i) pos += (storage_.base(i) + (1-storage_.isRankStoredAscending(i)) * (length_(i)-1)) * stride_(i); return pos; } const T_numtype* restrict dataFirst() const { return data_ + dataFirstOffset(); } T_numtype* restrict dataFirst() { return data_ + dataFirstOffset(); } int depth() const { return length_[2]; } int dimensions() const { return N_rank; } RectDomain<N_rank> domain() const { return RectDomain<N_rank>(lbound(), ubound()); } void dumpStructureInformation(ostream& os = cout) const; iterator end() { return iterator(); } const_iterator end() const { return const_iterator(); } int extent(int rank) const { return length_[rank]; } const TinyVector<int,N_rank>& extent() const { return length_; } template<typename P_numtype2> Array<P_numtype2,N_rank> extractComponent(P_numtype2, int compNum, int numComponents) const; void free() { changeToNullBlock(); length_ = 0; } bool isMajorRank(int rank) const { return storage_.ordering(rank) == 0; } bool isMinorRank(int rank) const { return storage_.ordering(rank) != 0; } bool isRankStoredAscending(int rank) const { return storage_.isRankStoredAscending(rank); } bool isStorageContiguous() const; int lbound(int rank) const { return base(rank); } TinyVector<int,N_rank> lbound() const { return base(); } int length(int rank) const { return length_[rank]; } const TinyVector<int, N_rank>& length() const { return length_; } void makeUnique(); int numElements() const { return product(length_); } // NEEDS_WORK -- Expose the numReferences() method // MemoryBlockReference<T_numtype>::numReferences; // The storage_.ordering_ array is a list of dimensions from // the most minor (stride 1) to major dimension. Generally, // ordering(0) will return the dimension which has the smallest // stride, and ordering(N_rank-1) will return the dimension with // the largest stride. int ordering(int storageRankIndex) const { return storage_.ordering(storageRankIndex); } const TinyVector<int, N_rank>& ordering() const { return storage_.ordering(); } void transposeSelf(int r0, int r1, int r2=0, int r3=0, int r4=0, int r5=0, int r6=0, int r7=0, int r8=0, int r9=0, int r10=0); T_array transpose(int r0, int r1, int r2=0, int r3=0, int r4=0, int r5=0, int r6=0, int r7=0, int r8=0, int r9=0, int r10=0); int rank() const { return N_rank; } void reference(const T_array&); // Added by Derrick Bass T_array reindex(const TinyVector<int,N_rank>&); void reindexSelf(const TinyVector<int,N_rank>&); void resize(int extent); void resize(int extent1, int extent2); void resize(int extent1, int extent2, int extent3); void resize(int extent1, int extent2, int extent3, int extent4); void resize(int extent1, int extent2, int extent3, int extent4, int extent5); void resize(int extent1, int extent2, int extent3, int extent4, int extent5, int extent6); void resize(int extent1, int extent2, int extent3, int extent4, int extent5, int extent6, int extent7); void resize(int extent1, int extent2, int extent3, int extent4, int extent5, int extent6, int extent7, int extent8); void resize(int extent1, int extent2, int extent3, int extent4, int extent5, int extent6, int extent7, int extent8, int extent9); void resize(int extent1, int extent2, int extent3, int extent4, int extent5, int extent6, int extent7, int extent8, int extent9, int extent10); void resize(int extent1, int extent2, int extent3, int extent4, int extent5, int extent6, int extent7, int extent8, int extent9, int extent10, int extent11); void resize(Range r1); void resize(Range r1, Range r2); void resize(Range r1, Range r2, Range r3); void resize(Range r1, Range r2, Range r3, Range r4); void resize(Range r1, Range r2, Range r3, Range r4, Range r5); void resize(Range r1, Range r2, Range r3, Range r4, Range r5, Range r6); void resize(Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7); void resize(Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8); void resize(Range r1, Range r2, Range r3,
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -