# GenGellMann

 Other toolboxes required GenGellMann Produces a generalized Gell-Mann operator none GellMannGenPauliPauli 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.

## Syntax

• G = GenGellMann(IND1,IND2,DIM)
• G = GenGellMann(IND1,IND2,DIM,SP)

## Argument descriptions

• 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.

## Examples

### Gives the Pauli operators when DIM = 2

>> GenGellMann(0,0,2) % identity

ans =

1     0
0     1

>> GenGellMann(0,1,2) % Pauli X

ans =

0     1
1     0

>> GenGellMann(1,0,2) % Pauli Y

ans =

0.0000 + 0.0000i   0.0000 - 1.0000i
0.0000 + 1.0000i   0.0000 + 0.0000i

>> GenGellMann(1,1,2) % Pauli Z

ans =

1     0
0    -1

### Gives the Gell-Mann operators when DIM = 3

>> GenGellMann(0,1,3)

ans =

0     1     0
1     0     0
0     0     0

>> GenGellMann(0,2,3)

ans =

0     0     1
0     0     0
1     0     0

>> GenGellMann(2,2,3)

ans =

0.5774         0         0
0    0.5774         0
0         0   -1.1547

### 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.

>> GenGellMann(2,3,4)

ans =

0     0     0     0
0     0     0     0
0     0     0     1
0     0     1     0

>> GenGellMann(205,34,500,1) % a 500-by-500 sparse generalized Gell-Mann matrix

ans =

(206,35)     0.0000 + 1.0000i
(35,206)    0.0000 - 1.0000i