PermutationTensor Namespace Reference

Utility functions to return the permutation pseudo tensor in 2D, 3D or 4D. More...

## Functions

int eps (unsigned int i, unsigned int j)
2D version More...

int eps (unsigned int i, unsigned int j, unsigned int k)
3D version More...

int eps (unsigned int i, unsigned int j, unsigned int k, unsigned int l)
4D version More...

## Detailed Description

Utility functions to return the permutation pseudo tensor in 2D, 3D or 4D.

eps(i1, i2, ..., iD) = +1 if (i1, i2, ..., iD) is an even permutation of (0, 1, ..., D) -1 if (i1, i2, ..., iD) is an odd permutation of (0, 1, ..., D) 0 otherwise The permutation tensor is also known as the Levi-Civita symbol

## Function Documentation

 int PermutationTensor::eps ( unsigned int i, unsigned int j )

2D version

Definition at line 18 of file PermutationTensor.C.

19 {
20  if (i == 0 && j == 1)
21  return 1;
22  else if (i == 1 && j == 0)
23  return -1;
24  return 0;
25 }
 int PermutationTensor::eps ( unsigned int i, unsigned int j, unsigned int k )

3D version

Definition at line 28 of file PermutationTensor.C.

29 {
30  if (i == 0 && j > 0 && k > 0)
31  return eps(j - 1, k - 1);
32  else if (j == 0 && i > 0 && k > 0)
33  return -eps(i - 1, k - 1);
34  else if (k == 0 && i > 0 && j > 0)
35  return eps(i - 1, j - 1);
36  return 0;
37 }
int eps(unsigned int i, unsigned int j)
2D version
 int PermutationTensor::eps ( unsigned int i, unsigned int j, unsigned int k, unsigned int l )

4D version

Definition at line 40 of file PermutationTensor.C.

41 {
42  if (i == 0 && j > 0 && k > 0 && l > 0)
43  return eps(j - 1, k - 1, l - 1);
44  else if (j == 0 && i > 0 && k > 0 && l > 0)
45  return -eps(i - 1, k - 1, l - 1);
46  else if (k == 0 && i > 0 && j > 0 && l > 0)
47  return eps(i - 1, j - 1, l - 1);
48  else if (l == 0 && i > 0 && j > 0 && k > 0)
49  return -eps(i - 1, j - 1, k - 1);
50  return 0;
51 }
int eps(unsigned int i, unsigned int j)
2D version