From 9c810200e0c58e6af5cde6e18441c906385bab81 Mon Sep 17 00:00:00 2001 From: Azusa Yamaguchi Date: Sun, 14 Jun 2015 00:55:21 +0100 Subject: [PATCH] Handle case of simd_layout not filling whole vector. Useful if real complex live on same grid --- lib/tensors/Tensor_extract_merge.h | 67 ++++++++++++++---------------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/lib/tensors/Tensor_extract_merge.h b/lib/tensors/Tensor_extract_merge.h index 75868463..cea9bb64 100644 --- a/lib/tensors/Tensor_extract_merge.h +++ b/lib/tensors/Tensor_extract_merge.h @@ -31,18 +31,17 @@ inline void merge(typename std::enable_if::value, vsimd >:: std::vector &extracted,int offset){ int Nextr=extracted.size(); int Nsimd=vsimd::Nsimd(); - int s=Nsimd/Nextr; - + int s=Nsimd/Nextr; // can have sparse occupation of simd vector if simd_layout does not fill it + // replicate n-fold. Use to allow Integer masks to + // predicate floating point of various width assignments and maintain conformable. scalar *buf =(scalar *) y; for(int i=0;i::value, const v scalar *buf = (scalar *)&y; for(int i=0;i::value, vsimd >:: for(int i=0;i -inline void AmergeA(typename std::enable_if::value, vsimd >::type &y,std::vector &extracted){ - int Nextr=extracted.size(); - int Nsimd=vsimd::Nsimd(); - int s=Nsimd/Nextr; - - scalar *buf = (scalar *)&y; - for(int i=0;i inline void extract(const vobj &vec,std::vector pointers(Nsimd); - for(int i=0;i pointers(Nextr); + for(int i=0;i &extrac const int words=sizeof(vobj)/sizeof(vector_type); const int Nsimd=vobj::vector_type::Nsimd(); - - assert(extracted.size()==Nsimd); + int Nextr=extracted.size(); + int s = Nsimd/Nextr; std::vector pointers(Nsimd); - for(int i=0;i &extracted) const int Nsimd=vobj::vector_type::Nsimd(); const int words=sizeof(vobj)/sizeof(vector_type); - assert(extracted.size()==Nsimd); + int Nextr = extracted.size(); + int splat=Nsimd/Nextr; - std::vector pointers(Nsimd); - for(int i=0;i pointers(Nextr); + for(int i=0;i &extracted,int const int Nsimd=vobj::vector_type::Nsimd(); const int words=sizeof(vobj)/sizeof(vector_type); - assert(extracted.size()==Nsimd); + int Nextr=extracted.size(); - std::vector pointers(Nsimd); - for(int i=0;i pointers(Nextr); + for(int i=0;i(&vp[w],pointers,w); }