Bug in Real ITensor::operator() #89

Closed
BapRoyer opened this Issue Oct 29, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@BapRoyer

I think there is a scale_.real()* missing in the case that the tensor is diagonal.

Real ITensor::
operator()(const IndexVal& iv1, const IndexVal& iv2) const
    {
    ITENSOR_CHECK_NULL
    if(type_ == Diag)
        {
        if(iv1.i != iv2.i) return 0;
        return r_->v.at(iv1.i-1);
        }
    return scale_.real()*r_->v[_ind2(iv1,iv2)];
    }
@emstoudenmire

This comment has been minimized.

Show comment
Hide comment
@emstoudenmire

emstoudenmire Oct 29, 2015

Contributor

Thanks for pointing this out! In the new version coming out soon, all storage types (Dense, Diag, etc.) and versions of operator() taking different numbers of IndexVals all share the same (templated) element access code, so bugs like this will be much less likely to happen.

Contributor

emstoudenmire commented Oct 29, 2015

Thanks for pointing this out! In the new version coming out soon, all storage types (Dense, Diag, etc.) and versions of operator() taking different numbers of IndexVals all share the same (templated) element access code, so bugs like this will be much less likely to happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment