# MaxEntangled

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 Other toolboxes required MaxEntangled Produces a maximally entangled bipartite pure state none BellBrauerStates Special states, vectors, and operators

MaxEntangled is a function that returns the canonical maximally entangled bipartite pure state. The state can be chosen to be either full or sparse.

## Syntax

• PSI = MaxEntangled(DIM)
• PSI = MaxEntangled(DIM,SP)
• PSI = MaxEntangled(DIM,SP,NRML)

## Argument descriptions

• DIM: The dimension of the local subsystems on which PSI lives.
• SP (optional, default 0): A flag (either 1 or 0) indicating that PSI should or should not be sparse.
• NRML (optional, default 1): A flag (either 1 or 0) indicating that PSI should or should not be scaled to have Euclidean norm 1. If NRML=0 then PSI has Euclidean norm sqrt(DIM) and every element of PSI is 0 or 1.

## Examples

### A maximally entangled qubit state

To generate a maximally entangled pair of qubits you can use the following line of code:

>> MaxEntangled(2)

ans =

0.7071
0
0
0.7071

If you want an unnormalized version of this state in which each entry of the vector is 0 or 1, specify NRML=0:

>> MaxEntangled(2,0,0)

ans =

1
0
0
1

### In larger systems

When DIM is large, it is usually best to specify SP=1 in order to save memory. For example, this code produces a maximally entangled pure state in $\mathbb{C}^{10} \otimes \mathbb{C}^{10}$:

>> MaxEntangled(10,1)

ans =

(1,1)       0.3162
(12,1)       0.3162
(23,1)       0.3162
(34,1)       0.3162
(45,1)       0.3162
(56,1)       0.3162
(67,1)       0.3162
(78,1)       0.3162
(89,1)       0.3162
(100,1)       0.3162

## Source code

Click on "expand" to the right to view the MATLAB source code for this function.

1. %%  MAXENTANGLED    Produces a maximally entangled bipartite pure state
2. %   This function has one required argument:
3. %     DIM: the local dimension
4. %
5. %   PSI = MaxEntangled(DIM) is a DIM^2-by-1 column vector representing the
6. %   standard bipartite maximally entangled pure state \sum_i \ket{ii}
7. %   (normalized to have norm 1).
8. %
9. %   This function has two optional arguments:
10. %     SP (default 0)
11. %     NRML (default 1)
12. %
13. %   PSI = MaxEntangled(DIM,SP,NRML) produces a maximally entangled pure
14. %   state as above that is sparse if SP = 1 and is full if SP = 0. The pure
15. %   state is normalized to have Euclidean norm 1 if NRML = 1, and it is
16. %   unnormalized (i.e., each entry in the vector is 0 or 1 and the
17. %   Euclidean norm of the vector is sqrt(DIM)) if NRML = 0.
18. %
19. %   URL: http://www.qetlab.com/MaxEntangled
20. 
21. %   requires: iden.m, opt_args.m
22. %   author: Nathaniel Johnston (nathaniel@njohnston.ca)
23. %   package: QETLAB
24. %   last updated: November 28, 2012
25. 
26. function psi = MaxEntangled(dim,varargin)
27. 
28. % set optional argument defaults: sp=0, nrml=1
29. [sp,nrml] = opt_args({ 0, 1 },varargin{:});
30. 
31. % construct the vector
32. psi = reshape(iden(dim,sp),dim^2,1);
33. if(nrml)
34.     psi = psi/sqrt(dim);
35. end