11.3 Two-dimensional spin models 345
given in(11.25)is not correct fori=1ori=M, because the first new spin,s′ 1 , does
not yet have a left neighbour. Therefore, in the matrixT 1 , the termβJσ 1 ′σM′/2is
left out and replaced byβJσ 1 σM/2. Similarly, fori=M, the couplingβJσMσ 1 / 2
is replaced byβJσM′σ 1 ′/2.
How do we perform the full matrix–vector multiplication? We introduce a set of
intermediate vectorsψ(i), defined by
|ψ(^0 )〉≡|φ〉 (11.26a)
|ψ(i)〉≡Ti|ψ(i−^1 )〉, (11.26b)
so that|ψ(M)〉=|ψ〉. Suppose we have the vector|ψ(i−^1 )〉at our disposal, that
is, we have all its matrix elements〈S(i−^1 )|ψ(i−^1 )〉stored in an array (below we
shall describe how the different configurationsScorrespond to the array index).
The multiplication of the vector|ψ(i−^1 )〉by the matrixTiis done as follows ( ≡
S(i−^1 ); ′≡S(i)):
FOR all statesS(i)DO
FOR allS(i−^1 )equal toS(i)except for spin numberiDO
Calculate〈S(i)|ψ(i)〉=〈S(i)|Ti|S(i−^1 )〉〈S(i−^1 )|ψ(i−^1 )〉.
END FOR
END FOR
To do the evaluation in the inner loop, we need the vector elements〈S(i−^1 )|ψ(i−^1 )〉
and the matrix elements〈S(i)|Ti|S(i−^1 )〉. The former are stored in an array, and the
latter are given by(11.25).
It now remains to find a relation between array and loop indices, and the states
S. This is done using binary encoding, using ‘bits’biwhich assume values 0 or 1:
n=b 0 +b 121 +b 222 +···+bM− 12 M−^1 (11.27)
wherebi =1 corresponds tosi+ 1 =1 andbi =0tosi+ 1 =−1. The matrix
element〈S(i)|Ti|S(i−^1 )〉depends onsi− 1 (=s′i− 1 ),si+ 1 (=s′i+ 1 ), and onsiands′i
(the latter are not necessarily equal). For an integern, theith bit can be found
asbi− 1 =(n/ 2 i−^1 ) mod 2, where integer division is assumed. Most computer
languages have, however, an intrinsic function returning the value of any desired
bit of an integer number. It should be noted that in the algorithm given above, the
central evaluation for the first and last sites (1 andM) differs slightly from the other
ones because the respective transfer matrix elements were defined differently (see
above).
Having a routine for evaluating the transfer matrix–vector product, this can be
used in the Lanczos algorithm in order to find the lowest eigenvalue and vector.