Lines Matching refs:shp

109     shape_t shp;
113 static stride_t shape2stride(const shape_t &shp) in shape2stride() argument
115 auto ndim = shp.size(); in shape2stride()
120 res[ndim-i] = res[ndim-i+1]*ptrdiff_t(shp[ndim-i+1]); in shape2stride()
132 fmav_info() : shp(1,0), str(1,0), sz(0) {} in fmav_info()
135 : shp(shape_), str(stride_), in fmav_info()
136 sz(accumulate(shp.begin(),shp.end(),size_t(1),multiplies<>())) in fmav_info()
138 MR_assert(shp.size()==str.size(), "dimensions mismatch"); in fmav_info()
146 shp = other.shp; in assign()
151 size_t ndim() const { return shp.size(); } in ndim()
155 const shape_t &shape() const { return shp; } in shape()
157 size_t shape(size_t i) const { return shp[i]; } in shape()
171 auto ndim = shp.size(); in contiguous()
176 stride *= ptrdiff_t(shp[ndim-1-i]); in contiguous()
182 { return shp==other.shp; } in conformable()
193 shape_t res(max(shp.size(), shp2.size()), 1); in bcast_shape()
194 for (size_t i=0; i<shp.size(); ++i) in bcast_shape()
195 res[i+res.size()-shp.size()] = shp[i]; in bcast_shape()
209 MR_assert(shp2.size()>=shp.size(), "cannot reduce dimensionality"); in bcast_to_shape()
211 for (size_t i=0; i<shp.size(); ++i) in bcast_to_shape()
213 size_t i2 = i+shp2.size()-shp.size(); in bcast_to_shape()
214 if (shp[i]!=1) in bcast_to_shape()
216 MR_assert(shp[i]==shp2[i2], "arrays cannot be broadcast together"); in bcast_to_shape()
220 shp = shp2; in bcast_to_shape()
228 swap(shp[ax0], shp[ax1]); in swap_axes()
235 auto ndim = shp.size(); in subdata()
246 MR_assert(slices[i].lo<shp[i], "bad subset"); in subdata()
252 ext = shp[i]-slices[i].lo; in subdata()
253 MR_assert(slices[i].lo+ext<=shp[i], "bad subset"); in subdata()
272 shape_t shp;
276 static stride_t shape2stride(const shape_t &shp) in shape2stride() argument
282 res[ndim-i] = res[ndim-i+1]*ptrdiff_t(shp[ndim-i+1]); in shape2stride()
297 { shp[i]=0; str[i]=0; } in mav_info()
301 : shp(shape_), str(stride_), in mav_info()
302 sz(accumulate(shp.begin(),shp.end(),size_t(1),multiplies<>())) {} in mav_info()
309 shp = other.shp; in assign()
316 const shape_t &shape() const { return shp; } in shape()
318 size_t shape(size_t i) const { return shp[i]; } in shape()
336 stride *= ptrdiff_t(shp[ndim-1-i]); in contiguous()
342 { return shp==other.shp; } in conformable()
345 { return shp==other; } in conformable()
370 MR_assert(slices[i].lo<shp[i], "bad subset"); in subdata()
376 ext = shp[i]-slices[i].lo; in subdata()
377 MR_assert(slices[i].lo+ext<=shp[i], "bad subset"); in subdata()
406 ofs += (ptrdiff_t(shp[i])-1)*str[i]; in cfmav()
450 using tinfo::shp, tinfo::str;
479 ofs += (ptrdiff_t(shp[i])-1)*str[i]; in vfmav()
550 using tinfo::shp, tinfo::str;
581 return cfmav<T>(*this, {shp.begin(), shp.end()}, {str.begin(), str.end()});
615 using tinfo::shp, tinfo::str;
642 return vfmav<T>(*this, {shp.begin(), shp.end()}, {str.begin(), str.end()});
694 DUCC0_NOINLINE void opt_shp_str(fmav_info::shape_t &shp, vector<fmav_info::stride_t> &str) in opt_shp_str() argument
696 if (shp.size()>1) in opt_shp_str()
699 vector<size_t> strcrit(shp.size(),0); in opt_shp_str()
705 for (size_t lastdim=shp.size(); lastdim>1; --lastdim) in opt_shp_str()
712 swap(shp[dim], shp[lastdim-1]); in opt_shp_str()
718 size_t ndim = shp.size(); in opt_shp_str()
724 can_merge &= curstr[d0] == ptrdiff_t(shp[d0+1])*curstr[d0+1]; in opt_shp_str()
729 shp[d0+1] *= shp[d0]; in opt_shp_str()
730 shp.erase(shp.begin()+d0); in opt_shp_str()
742 fmav_info::shape_t shp; in multiprep() local
747 shp.push_back(info[0].shape(i)); in multiprep()
751 opt_shp_str(shp, str); in multiprep()
752 return make_tuple(shp, str); in multiprep()
756 void applyHelper(size_t idim, const vector<size_t> &shp, in applyHelper() argument
759 auto len = shp[idim]; in applyHelper()
761 if (idim+1<shp.size()) in applyHelper()
763 applyHelper(idim+1, shp, str, ptr0+i*str0, func); in applyHelper()
769 void applyHelper(const vector<size_t> &shp, in applyHelper() argument
772 if (shp.size()==0) in applyHelper()
775 applyHelper(0, shp, str, ptr0, func); in applyHelper()
776 else if (shp.size()==1) in applyHelper()
777 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
783 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
786 applyHelper(1, shp, str, ptr0+i*str[0][0], func); in applyHelper()
790 void applyHelper(size_t idim, const vector<size_t> &shp, in applyHelper() argument
793 auto len = shp[idim]; in applyHelper()
795 if (idim+1<shp.size()) in applyHelper()
797 applyHelper(idim+1, shp, str, ptr0+i*str0, ptr1+i*str1, func); in applyHelper()
803 void applyHelper(const vector<size_t> &shp, in applyHelper() argument
807 if (shp.size()==0) in applyHelper()
810 applyHelper(0, shp, str, ptr0, ptr1, func); in applyHelper()
811 else if (shp.size()==1) in applyHelper()
812 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
818 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
821 applyHelper(1, shp, str, ptr0+i*str[0][0], ptr1+i*str[1][0], func); in applyHelper()
825 void applyHelper(size_t idim, const vector<size_t> &shp, in applyHelper() argument
828 auto len = shp[idim]; in applyHelper()
830 if (idim+1<shp.size()) in applyHelper()
832 applyHelper(idim+1, shp, str, ptr0+i*str0, ptr1+i*str1, ptr2+i*str2, func); in applyHelper()
838 void applyHelper(const vector<size_t> &shp, in applyHelper() argument
842 if (shp.size()==0) in applyHelper()
845 applyHelper(0, shp, str, ptr0, ptr1, ptr2, func); in applyHelper()
846 else if (shp.size()==1) in applyHelper()
847 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
853 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
856 applyHelper(1, shp, str, ptr0+i*str[0][0], ptr1+i*str[1][0], in applyHelper()
861 void applyHelper(size_t idim, const vector<size_t> &shp, in applyHelper() argument
865 auto len = shp[idim]; in applyHelper()
868 if (idim+1<shp.size()) in applyHelper()
870 applyHelper(idim+1, shp, str, ptr0+i*str0, ptr1+i*str1, ptr2+i*str2, in applyHelper()
877 void applyHelper(const vector<size_t> &shp, in applyHelper() argument
881 if (shp.size()==0) in applyHelper()
884 applyHelper(0, shp, str, ptr0, ptr1, ptr2, ptr3, func); in applyHelper()
885 else if (shp.size()==1) in applyHelper()
886 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
893 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
896 applyHelper(1, shp, str, ptr0+i*str[0][0], ptr1+i*str[1][0], in applyHelper()
903 void applyHelper(size_t idim, const vector<size_t> &shp, in applyHelper() argument
907 auto len = shp[idim]; in applyHelper()
910 if (idim+1<shp.size()) in applyHelper()
912 applyHelper(idim+1, shp, str, ptr0+i*str0, ptr1+i*str1, ptr2+i*str2, in applyHelper()
921 void applyHelper(const vector<size_t> &shp, in applyHelper() argument
925 if (shp.size()==0) in applyHelper()
928 applyHelper(0, shp, str, ptr0, ptr1, ptr2, ptr3, ptr4, func); in applyHelper()
929 else if (shp.size()==1) in applyHelper()
930 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
937 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
940 applyHelper(1, shp, str, ptr0+i*str[0][0], ptr1+i*str[1][0], in applyHelper()
947 void applyHelper(size_t idim, const vector<size_t> &shp, in applyHelper() argument
951 auto len = shp[idim]; in applyHelper()
954 if (idim+1<shp.size()) in applyHelper()
956 applyHelper(idim+1, shp, str, ptr0+i*str0, ptr1+i*str1, ptr2+i*str2, in applyHelper()
965 void applyHelper(const vector<size_t> &shp, in applyHelper() argument
969 if (shp.size()==0) in applyHelper()
972 applyHelper(0, shp, str, ptr0, ptr1, ptr2, ptr3, ptr4, ptr5, func); in applyHelper()
973 else if (shp.size()==1) in applyHelper()
974 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
981 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in applyHelper()
984 applyHelper(1, shp, str, ptr0+i*str[0][0], ptr1+i*str[1][0], in applyHelper()
993 auto [shp, str] = multiprep({m0}); in mav_apply()
994 applyHelper(shp, str, m0.data(), func, nthreads); in mav_apply()
999 auto [shp, str] = multiprep({m0, m1}); in mav_apply()
1000 applyHelper(shp, str, m0.data(), m1.data(), func, nthreads); in mav_apply()
1005 auto [shp, str] = multiprep({m0, m1, m2}); in mav_apply()
1006 applyHelper(shp, str, m0.data(), m1.data(), m2.data(), func, nthreads); in mav_apply()
1011 auto [shp, str] = multiprep({m0, m1, m2, m3}); in mav_apply()
1012 applyHelper(shp, str, m0.data(), m1.data(), m2.data(), m3.data(), func, in mav_apply()
1020 auto [shp, str] = multiprep({m0, m1, m2, m3, m4}); in mav_apply()
1021 applyHelper(shp, str, m0.data(), m1.data(), m2.data(), m3.data(), m4.data(), in mav_apply()
1029 auto [shp, str] = multiprep({m0, m1, m2, m3, m4, m5}); in mav_apply()
1030 applyHelper(shp, str, m0.data(), m1.data(), m2.data(), m3.data(), m4.data(), in mav_apply()
1081 typename mav_info<ndim>::shape_t shp; in make_infos() local
1086 shp[i] = info.shape(iterdim+i); in make_infos()
1089 mav_info<ndim> iout(shp, str); in make_infos()
1095 void flexible_mav_applyHelper(size_t idim, const vector<size_t> &shp, in flexible_mav_applyHelper() argument
1099 auto len = shp[idim]; in flexible_mav_applyHelper()
1101 if (idim+1<shp.size()) in flexible_mav_applyHelper()
1103 flexible_mav_applyHelper(idim+1, shp, str, ptr0+i*str0, info0, func); in flexible_mav_applyHelper()
1109 void flexible_mav_applyHelper(const vector<size_t> &shp, in flexible_mav_applyHelper() argument
1113 if (shp.size()==0) in flexible_mav_applyHelper()
1116 flexible_mav_applyHelper(0, shp, str, ptr0, info0, func); in flexible_mav_applyHelper()
1117 else if (shp.size()==1) in flexible_mav_applyHelper()
1118 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in flexible_mav_applyHelper()
1124 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in flexible_mav_applyHelper()
1127 flexible_mav_applyHelper(1, shp, str, ptr0+i*str[0][0], info0, func); in flexible_mav_applyHelper()
1132 void flexible_mav_applyHelper(size_t idim, const vector<size_t> &shp, in flexible_mav_applyHelper() argument
1136 auto len = shp[idim]; in flexible_mav_applyHelper()
1138 if (idim+1<shp.size()) in flexible_mav_applyHelper()
1140 flexible_mav_applyHelper(idim+1, shp, str, ptr0+i*str0, info0, ptr1+i*str1, in flexible_mav_applyHelper()
1148 void flexible_mav_applyHelper(const vector<size_t> &shp, in flexible_mav_applyHelper() argument
1152 if (shp.size()==0) in flexible_mav_applyHelper()
1155 flexible_mav_applyHelper(0, shp, str, ptr0, info0, ptr1, info1, func); in flexible_mav_applyHelper()
1156 else if (shp.size()==1) in flexible_mav_applyHelper()
1157 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in flexible_mav_applyHelper()
1164 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in flexible_mav_applyHelper()
1167 flexible_mav_applyHelper(1, shp, str, ptr0+i*str[0][0], info0, in flexible_mav_applyHelper()
1175 void flexible_mav_applyHelper(size_t idim, const vector<size_t> &shp, in flexible_mav_applyHelper() argument
1179 auto len = shp[idim]; in flexible_mav_applyHelper()
1181 if (idim+1<shp.size()) in flexible_mav_applyHelper()
1183 flexible_mav_applyHelper(idim+1, shp, str, ptr0+i*str0, info0, ptr1+i*str1, info1, in flexible_mav_applyHelper()
1193 void flexible_mav_applyHelper(const vector<size_t> &shp, in flexible_mav_applyHelper() argument
1198 if (shp.size()==0) in flexible_mav_applyHelper()
1201 flexible_mav_applyHelper(0, shp, str, ptr0, info0, ptr1, info1, ptr2, info2, func); in flexible_mav_applyHelper()
1202 else if (shp.size()==1) in flexible_mav_applyHelper()
1203 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in flexible_mav_applyHelper()
1211 execParallel(shp[0], nthreads, [&](size_t lo, size_t hi) in flexible_mav_applyHelper()
1214 flexible_mav_applyHelper(1, shp, str, ptr0+i*str[0][0], info0, in flexible_mav_applyHelper()
1224 auto [shp, str] = multiprep(iterinfo); in flexible_mav_apply()
1225 flexible_mav_applyHelper(shp, str, m0.data(), i0, func, nthreads); in flexible_mav_apply()
1235 auto [shp, str] = multiprep(iterinfo); in flexible_mav_apply()
1236 flexible_mav_applyHelper(shp, str, m0.data(), i0, m1.data(), i1, func, nthreads); in flexible_mav_apply()
1249 auto [shp, str] = multiprep(iterinfo); in flexible_mav_apply()
1250 flexible_mav_applyHelper(shp, str, m0.data(), i0, m1.data(), i1, m2.data(), i2, in flexible_mav_apply()