|Produces a generalized Gell-Mann operator|
|Other toolboxes required||none|
|Related functions|| GellMann|
|Function category||Special states, vectors, and operators|
GenGellMann is a function that produces generalized Gell-Mann matrices. That is, it produces Hermitian matrices that form a traceless orthogonal basis for the space of $d \times d$ complex matrices.
- G = GenGellMann(IND1,IND2,DIM)
- G = GenGellMann(IND1,IND2,DIM,SP)
- IND1 and IND2: Integers between 0 and DIM-1, inclusive. If IND1 == IND2 then G will be diagonal. If IND1 < IND2 then G will be real and have exactly 2 nonzero entries. If IND1 > IND2 then G will be imaginary and have exactly 2 nonzero entries.
- DIM: The size of the output matrix.
- SP (optional, default 0): A flag (either 1 or 0) indicating that the generalized Gell-Mann matrix produced should or should not be sparse.
Gives the Pauli operators when DIM = 2
Gives the Gell-Mann operators when DIM = 3
In Higher Dimensions
Generalized Gell-Mann matrices can be generated in arbitrary dimensions. It is recommended that you set SP = 1 if DIM is large in order to save memory.
Click on "expand" to the right to view the MATLAB source code for this function.
%% GENGELLMANN Produces a generalized Gell-Mann operator
% This function has three required arguments:
% IND1 (a nonnegative integer from 0 to DIM-1 inclusive)
% IND2 (a nonnegative integer from 0 to DIM-1 inclusive)
% DIM (a positive integer indicating the dimension)
% G = GenGellMann(IND1,IND2,DIM) is a DIM-by-DIM Hermitian operator.
% These matrices span the entire space of DIM-by-DIM matrices as IND1 and
% IND2 range from 0 to DIM-1, inclusive, and they generalize the Pauli
% operators when DIM = 2 and the Gell-Mann operators when DIM = 3.
% This function has one optional argument:
% SP (default 0)
% G = GenGellMann(IND1,IND2,DIM,SP) is as above, with sparsity of the
% output determined by the value of SP. If SP = 0 then the output will be
% full, if SP = 1 then the output will be sparse.
% URL: http://www.qetlab.com/GenGellMann
% requires: opt_args.m
% author: Nathaniel Johnston (email@example.com)
% package: QETLAB
% last updated: December 18, 2013
function g = GenGellMann(ind1,ind2,dim,varargin)
% set optional argument defaults: sp=0
if(ind1 == ind2)
if(ind1 == 0)
g = speye(dim);
E = sparse(dim,dim);
E(ind1+1,ind2+1) = 1;
if(ind1 < ind2)
g = E + E';
g = 1i*E - 1i*E';
g = full(g);
- Generalizations of the Pauli matrices at Wikipedia