Loading src/Ainur/AinurState1.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,18 @@ struct MyProxyFor<ComplexOrRealType, true> { static void copy(std::vector<ComplexOrRealType>& dest, const std::vector<Type>& src) { const SizeType ndest = dest.size(); // ellipsis for complex vectors goes here: if (src.size() == 2 && src[1] == "...") { if (ndest == 0) err("Vector of unknown size cannot use ellipsis\n"); const std::string copystr = src[0]; ComplexOrRealType val = toComplex(copystr); for (SizeType i = 0; i < ndest; ++i) dest[i] = val; return; } dest.clear(); const SizeType n = src.size(); if (n == 0) return; Loading Loading @@ -136,7 +148,7 @@ ruleElipsis<DoubleOrFloatType>() { return "[" >> boost::spirit::DoubleOrFloatUnderscore >> "," >> "..." >> "]"; } // Needed but apparently does not match template<> boost::spirit::qi::rule<std::string::iterator, std::string(), Loading src/Ainur/test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ void partiallyReadSomething(const PsimagLite::Ainur& ainur) PsimagLite::String m; ainur.readValue(m, "Model"); std::cout<<m<<"\n"; std::vector<std::complex<double> > v2(10); ainur.readValue(v2, "myv2"); std::cout<<v2; } int main(int argc, char** argv) Loading Loading
src/Ainur/AinurState1.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -32,6 +32,18 @@ struct MyProxyFor<ComplexOrRealType, true> { static void copy(std::vector<ComplexOrRealType>& dest, const std::vector<Type>& src) { const SizeType ndest = dest.size(); // ellipsis for complex vectors goes here: if (src.size() == 2 && src[1] == "...") { if (ndest == 0) err("Vector of unknown size cannot use ellipsis\n"); const std::string copystr = src[0]; ComplexOrRealType val = toComplex(copystr); for (SizeType i = 0; i < ndest; ++i) dest[i] = val; return; } dest.clear(); const SizeType n = src.size(); if (n == 0) return; Loading Loading @@ -136,7 +148,7 @@ ruleElipsis<DoubleOrFloatType>() { return "[" >> boost::spirit::DoubleOrFloatUnderscore >> "," >> "..." >> "]"; } // Needed but apparently does not match template<> boost::spirit::qi::rule<std::string::iterator, std::string(), Loading
src/Ainur/test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ void partiallyReadSomething(const PsimagLite::Ainur& ainur) PsimagLite::String m; ainur.readValue(m, "Model"); std::cout<<m<<"\n"; std::vector<std::complex<double> > v2(10); ainur.readValue(v2, "myv2"); std::cout<<v2; } int main(int argc, char** argv) Loading