Minor change of the file sweeps.h #106

Merged
merged 1 commit into from Jul 9, 2016

Conversation

Projects
None yet
2 participants
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.

@mingpu mingpu 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.
3edc76a
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!

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.

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 emstoudenmire added a commit that referenced this pull request Sep 5, 2016

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