This GitLab instance is undergoing maintenance and is operating in read-only mode.

You are on a read-only GitLab instance.
Commit dcd38dd4 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

Ainur: ellipsis for complex vectors now works

parent 49fc8037
......@@ -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;
......@@ -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(),
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment