Tensor Network Theory Library  Beta release 1.2.1
A library of routines for performing TNT-based operations
 All Data Structures Functions Variables Groups Pages
tntMatBosonOps.m
1 %======================================================================
2 %> @ingroup matscripts
3 %> Creates matrices for N-species boson operators. These matrices can then be used to build Hamiltonian terms
4 %> If you wish to turn these matrices into nodes that can be loaded into the library use tntMatCreateOpArray().
5 %>
6 %> Returns the result in a cell having a number of elements equal to the
7 %> number of species.
8 %> i.e. n{1}, bdag{1} and b{1} will be the operators for the first species and
9 %> n{2}, bdag{2} and b{2} will be the operators for the second species etc.
10 %>
11 %> @param nmax Maximum number of bosons allowed on each site
12 %> @param N The number of species
13 %>
14 %> @retval bdag A cell, each entry containing the matrix representing \f$\hat{b}^{\dagger}\f$ for a given species.
15 %> @retval b A cell, each entry containing the matrix representing \f$\hat{b}\f$ for a given species.
16 %> @retval n A cell, each entry containing the matrix representing \f$\hat{n}\f$ for a given species.
17 %======================================================================
18 
19 function [bdag,b,n] = tntMatBosonOps(nmax,N)
20 
21 % Build sparse matrix version of basic spin operators :
22 bdags = diag(sqrt(1:nmax),-1);
23 bs = diag(sqrt(1:nmax),1);
24 ns = diag((0:nmax)',0);
25 
26 % Construct spin operators for each spin in the full Hilbert space :
27 b = tntMatExpandBasis(bs,N);
28 bdag = tntMatExpandBasis(bdags,N);
29 n = tntMatExpandBasis(ns,N);
30 
31 
function tntMatBosonOps(in nmax, in N)
function tntMatCreateOpArray(in ops)