📄 resize.cc
字号:
length_[0] = r0.length(); storage_.setBase(0, r0.first()); length_[1] = r1.length(); storage_.setBase(1, r1.first()); length_[2] = r2.length(); storage_.setBase(2, r2.first()); length_[3] = r3.length(); storage_.setBase(3, r3.first()); setupStorage(3);} template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resize(Range r0, Range r1, Range r2, Range r3, Range r4){ BZPRECONDITION(r0.isAscendingContiguous() && r1.isAscendingContiguous() && r2.isAscendingContiguous() && r3.isAscendingContiguous() && r4.isAscendingContiguous()); length_[0] = r0.length(); storage_.setBase(0, r0.first()); length_[1] = r1.length(); storage_.setBase(1, r1.first()); length_[2] = r2.length(); storage_.setBase(2, r2.first()); length_[3] = r3.length(); storage_.setBase(3, r3.first()); length_[4] = r4.length(); storage_.setBase(4, r4.first()); setupStorage(4);} template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resize(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5){ BZPRECONDITION(r0.isAscendingContiguous() && r1.isAscendingContiguous() && r2.isAscendingContiguous() && r3.isAscendingContiguous() && r4.isAscendingContiguous() && r5.isAscendingContiguous()); length_[0] = r0.length(); storage_.setBase(0, r0.first()); length_[1] = r1.length(); storage_.setBase(1, r1.first()); length_[2] = r2.length(); storage_.setBase(2, r2.first()); length_[3] = r3.length(); storage_.setBase(3, r3.first()); length_[4] = r4.length(); storage_.setBase(4, r4.first()); length_[5] = r5.length(); storage_.setBase(5, r5.first()); setupStorage(5);} template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resize(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6){ BZPRECONDITION(r0.isAscendingContiguous() && r1.isAscendingContiguous() && r2.isAscendingContiguous() && r3.isAscendingContiguous() && r4.isAscendingContiguous() && r5.isAscendingContiguous() && r6.isAscendingContiguous()); length_[0] = r0.length(); storage_.setBase(0, r0.first()); length_[1] = r1.length(); storage_.setBase(1, r1.first()); length_[2] = r2.length(); storage_.setBase(2, r2.first()); length_[3] = r3.length(); storage_.setBase(3, r3.first()); length_[4] = r4.length(); storage_.setBase(4, r4.first()); length_[5] = r5.length(); storage_.setBase(5, r5.first()); length_[6] = r6.length(); storage_.setBase(6, r6.first()); setupStorage(6);} template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resize(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7){ BZPRECONDITION(r0.isAscendingContiguous() && r1.isAscendingContiguous() && r2.isAscendingContiguous() && r3.isAscendingContiguous() && r4.isAscendingContiguous() && r5.isAscendingContiguous() && r6.isAscendingContiguous() && r7.isAscendingContiguous()); length_[0] = r0.length(); storage_.setBase(0, r0.first()); length_[1] = r1.length(); storage_.setBase(1, r1.first()); length_[2] = r2.length(); storage_.setBase(2, r2.first()); length_[3] = r3.length(); storage_.setBase(3, r3.first()); length_[4] = r4.length(); storage_.setBase(4, r4.first()); length_[5] = r5.length(); storage_.setBase(5, r5.first()); length_[6] = r6.length(); storage_.setBase(6, r6.first()); length_[7] = r7.length(); storage_.setBase(7, r7.first()); setupStorage(7);} template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resize(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8){ BZPRECONDITION(r0.isAscendingContiguous() && r1.isAscendingContiguous() && r2.isAscendingContiguous() && r3.isAscendingContiguous() && r4.isAscendingContiguous() && r5.isAscendingContiguous() && r6.isAscendingContiguous() && r7.isAscendingContiguous() && r8.isAscendingContiguous()); length_[0] = r0.length(); storage_.setBase(0, r0.first()); length_[1] = r1.length(); storage_.setBase(1, r1.first()); length_[2] = r2.length(); storage_.setBase(2, r2.first()); length_[3] = r3.length(); storage_.setBase(3, r3.first()); length_[4] = r4.length(); storage_.setBase(4, r4.first()); length_[5] = r5.length(); storage_.setBase(5, r5.first()); length_[6] = r6.length(); storage_.setBase(6, r6.first()); length_[7] = r7.length(); storage_.setBase(7, r7.first()); length_[8] = r8.length(); storage_.setBase(8, r8.first()); setupStorage(8);} template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resize(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8, Range r9){ BZPRECONDITION(r0.isAscendingContiguous() && r1.isAscendingContiguous() && r2.isAscendingContiguous() && r3.isAscendingContiguous() && r4.isAscendingContiguous() && r5.isAscendingContiguous() && r6.isAscendingContiguous() && r7.isAscendingContiguous() && r8.isAscendingContiguous() && r9.isAscendingContiguous()); length_[0] = r0.length(); storage_.setBase(0, r0.first()); length_[1] = r1.length(); storage_.setBase(1, r1.first()); length_[2] = r2.length(); storage_.setBase(2, r2.first()); length_[3] = r3.length(); storage_.setBase(3, r3.first()); length_[4] = r4.length(); storage_.setBase(4, r4.first()); length_[5] = r5.length(); storage_.setBase(5, r5.first()); length_[6] = r6.length(); storage_.setBase(6, r6.first()); length_[7] = r7.length(); storage_.setBase(7, r7.first()); length_[8] = r8.length(); storage_.setBase(8, r8.first()); length_[9] = r9.length(); storage_.setBase(9, r9.first()); setupStorage(9);} template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resize(Range r0, Range r1, Range r2, Range r3, Range r4, Range r5, Range r6, Range r7, Range r8, Range r9, Range r10){ BZPRECONDITION(r0.isAscendingContiguous() && r1.isAscendingContiguous() && r2.isAscendingContiguous() && r3.isAscendingContiguous() && r4.isAscendingContiguous() && r5.isAscendingContiguous() && r6.isAscendingContiguous() && r7.isAscendingContiguous() && r8.isAscendingContiguous() && r9.isAscendingContiguous() && r10.isAscendingContiguous()); length_[0] = r0.length(); storage_.setBase(0, r0.first()); length_[1] = r1.length(); storage_.setBase(1, r1.first()); length_[2] = r2.length(); storage_.setBase(2, r2.first()); length_[3] = r3.length(); storage_.setBase(3, r3.first()); length_[4] = r4.length(); storage_.setBase(4, r4.first()); length_[5] = r5.length(); storage_.setBase(5, r5.first()); length_[6] = r6.length(); storage_.setBase(6, r6.first()); length_[7] = r7.length(); storage_.setBase(7, r7.first()); length_[8] = r8.length(); storage_.setBase(8, r8.first()); length_[9] = r9.length(); storage_.setBase(9, r9.first()); length_[10] = r10.length(); storage_.setBase(10, r10.first()); setupStorage(10);} template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resizeAndPreserve(int length0){ BZPRECONDITION(length0 > 0); BZPRECONDITION(N_rank == 1); if (length0 != length_[firstRank]) {#if defined(__KCC) || defined(__DECCXX) // NEEDS_WORK: have to discard the base() parameter for EDG, // because it gives the following bizarre error:/* * "blitz/tinyvec.h", line 421: error: the size of an array must be greater * than zero * T_numtype data_[N_length]; * ^ * detected during: * instantiation of class "blitz::TinyVector<int, 0>" at line 273 of * "./../blitz/array/resize.cc" * instantiation of * "void blitz::Array<int, 1>::resizeAndPreserve(int)" */ T_array B(length0, storage_);#else T_array B(base(), BZ_BLITZ_SCOPE(shape)(length0), storage_); // line 273#endif if (numElements()) { Range overlap0 = Range(fromStart, minmax::min(B.ubound(0), ubound(0))); B(overlap0) = (*this)(overlap0); } reference(B); }}template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resizeAndPreserve(int length0, int length1){ BZPRECONDITION((length0 > 0) && (length1 > 0)); BZPRECONDITION(N_rank == 2); if ((length0 != length_[0]) || (length1 != length_[1])) { T_array B(base(), BZ_BLITZ_SCOPE(shape)(length0, length1), storage_); if (numElements()) { Range overlap0 = Range(fromStart, minmax::min(B.ubound(0), ubound(0))); Range overlap1 = Range(fromStart, minmax::min(B.ubound(1), ubound(1))); B(overlap0, overlap1) = (*this)(overlap0, overlap1); } reference(B); }}template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resizeAndPreserve(int length0, int length1, int length2){ BZPRECONDITION((length0 > 0) && (length1 > 0) && (length2 > 0)); BZPRECONDITION(N_rank == 3); if ((length0 != length_[0]) || (length1 != length_[1]) || (length2 != length_[2])) { T_array B(base(), BZ_BLITZ_SCOPE(shape)(length0, length1, length2), storage_); if (numElements()) { Range overlap0 = Range(fromStart, minmax::min(B.ubound(0), ubound(0))); Range overlap1 = Range(fromStart, minmax::min(B.ubound(1), ubound(1))); Range overlap2 = Range(fromStart, minmax::min(B.ubound(2), ubound(2))); B(overlap0, overlap1, overlap2) = (*this)(overlap0, overlap1, overlap2); } reference(B); }}template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resizeAndPreserve(int length0, int length1, int length2, int length3){ BZPRECONDITION((length0 > 0) && (length1 > 0) && (length2 > 0) && (length3 > 0)); BZPRECONDITION(N_rank == 4); if ((length0 != length_[0]) || (length1 != length_[1]) || (length2 != length_[2]) || (length3 != length_[3])) { T_array B(base(), BZ_BLITZ_SCOPE(shape)(length0, length1, length2, length3), storage_); if (numElements()) { Range overlap0 = Range(fromStart, minmax::min(B.ubound(0), ubound(0))); Range overlap1 = Range(fromStart, minmax::min(B.ubound(1), ubound(1))); Range overlap2 = Range(fromStart, minmax::min(B.ubound(2), ubound(2))); Range overlap3 = Range(fromStart, minmax::min(B.ubound(3), ubound(3))); B(overlap0, overlap1, overlap2, overlap3) = (*this)(overlap0, overlap1, overlap2, overlap3); } reference(B); }}template<typename T_numtype, int N_rank>void Array<T_numtype, N_rank>::resizeAndPreserve(int length0, int length1,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -