Minor change of the file sweeps.h #106

Merged
merged 1 commit into from Jul 9, 2016

Conversation

Projects
None yet
2 participants
@mingpu
Contributor

mingpu commented Jun 29, 2016

Minor change of the file sweeps.h. Now if the number of row of sweep parameters in the input file is less than nsweep, the last row will repeat.

Minor change of the file sweeps.h. Now if the number of row of sweep
parameters in the input file is less than nsweep, the last row will
repeat.
@emstoudenmire

This comment has been minimized.

Show comment
Hide comment
@emstoudenmire

emstoudenmire Jun 30, 2016

Contributor

Hi Mingpu, this is a nice idea. One question is, this seems to rely on a certain behavior of the line
table.file() >> maxm_[i] >> ...
namely that it will set maxm_[i] to zero (or leave it as zero) if there is no more input. Is this relying on a particular guaranteed behavior of the >> operator for input streams? What if someone leaves a space between the last line in the table and the closing brace (closing } )? I just want to better understand if the condition we are relying on here is robust. Thanks!

Contributor

emstoudenmire commented Jun 30, 2016

Hi Mingpu, this is a nice idea. One question is, this seems to rely on a certain behavior of the line
table.file() >> maxm_[i] >> ...
namely that it will set maxm_[i] to zero (or leave it as zero) if there is no more input. Is this relying on a particular guaranteed behavior of the >> operator for input streams? What if someone leaves a space between the last line in the table and the closing brace (closing } )? I just want to better understand if the condition we are relying on here is robust. Thanks!

@mingpu

This comment has been minimized.

Show comment
Hide comment
@mingpu

mingpu Jun 30, 2016

Contributor

Hi Miles, thanks. I think ifstream ignores white spaces. So if there are white spaces at the end of the file, the value of maxm_[i] will be the default value when it is declared, which is 0 for std::vector.

Contributor

mingpu commented Jun 30, 2016

Hi Miles, thanks. I think ifstream ignores white spaces. So if there are white spaces at the end of the file, the value of maxm_[i] will be the default value when it is declared, which is 0 for std::vector.

@emstoudenmire

This comment has been minimized.

Show comment
Hide comment
@emstoudenmire

emstoudenmire Jul 9, 2016

Contributor

Thanks Mingpu - I hope it doesn't lead to any surprising behavior but it is definitely an improvement to the current behavior!

Contributor

emstoudenmire commented Jul 9, 2016

Thanks Mingpu - I hope it doesn't lead to any surprising behavior but it is definitely an improvement to the current behavior!

@emstoudenmire emstoudenmire merged commit 4df7b8c into ITensor:master Jul 9, 2016

emstoudenmire added a commit that referenced this pull request Sep 5, 2016

Fixed bug introduced in pull #106 where n_last should have been initi…
…alized to nsweep_ (thanks Bill Huggins for reporting this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment