Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
This GitLab instance is undergoing maintenance and is operating in read-only mode.
You are on a read-only GitLab instance.
Open sidebar
Alvarez, Gonzalo
PsimagLite
Commits
dcd38dd4
Commit
dcd38dd4
authored
Sep 17, 2021
by
Alvarez, Gonzalo
Browse files
Ainur: ellipsis for complex vectors now works
parent
49fc8037
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Ainur/AinurState1.cpp
View file @
dcd38dd4
...
...
@@ -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
(),
...
...
src/Ainur/test.cpp
View file @
dcd38dd4
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment