https://github.com/ITensor/ITensor
Tip revision: 6b54fa39438c296f80049dc937ca966746eded68 authored by Miles Stoudenmire on 11 April 2016, 18:02:29 UTC
Updated localop.h diag method to correctly use delta function to tie indices. Fixes #96 - thanks to Xiongjie Yu for reporting it.
Updated localop.h diag method to correctly use delta function to tie indices. Fixes #96 - thanks to Xiongjie Yu for reporting it.
Tip revision: 6b54fa3
arrow.h
//
// Distributed under the ITensor Library License, Version 1.2
// (See accompanying LICENSE file.)
//
#ifndef __ITENSOR_ARROW_H
#define __ITENSOR_ARROW_H
#include <iostream>
namespace itensor {
/*
*
* The Arrow enum is used to label how indices
* transform under a particular symmetry group.
* Indices with an Out Arrow transform as vectors
* (kets) and with an In Arrow as dual vectors (bras).
*
* Conventions regarding arrows:
*
* * Arrows point In or Out, never right/left/up/down.
*
* * The Site indices of an MPS representing a ket point Out.
*
* * Conjugation switches arrow directions.
*
* * All arrows flow Out from the ortho center of an MPS
* (assuming it's a ket - In if it's a bra).
*
* * IQMPOs are created with the same arrow structure as if they are
* orthogonalized to site 1, but this is just a default since they
* aren't actually ortho. If position is called on an IQMPO it follows
* the same convention as for an MPS except Site indices point In and
* Site' indices point Out.
*
* * Local site operators have two IQIndices, one unprimed and pointing In,
* the other primed and pointing Out.
*
*/
enum Arrow { In = -1, Out = 1, Neither = 0 };
Arrow inline
operator-(Arrow dir)
{
#ifdef DEBUG
if(dir == Neither)
Error("Cannot reverse Arrow direction 'Neither'");
#endif
return (dir == In ? Out : In);
}
inline std::ostream&
operator<<(std::ostream& s, Arrow D)
{
switch(D)
{
case In:
s << "In";
return s;
case Out:
s << "Out";
return s;
case Neither:
s << "Neither";
return s;
default:
Error("Missing Arrow case");
}
return s;
}
struct ArrowError : ITError
{
ArrowError(const std::string& message)
: ITError(message)
{ }
};
} // namespace itensor
#endif