Skip to content

Latest commit

 

History

History
85 lines (65 loc) · 3.49 KB

README.md

File metadata and controls

85 lines (65 loc) · 3.49 KB

Implementação da matriz de rotação de givens

O código exemplo mostra todas as formas da matriz de givens

import givens
from itertools import combinations
from numpy import pi

# Tamanho
SIZE = 5

# Angulo 
THETA = pi/6

# Exemplo de código para combinações possíveis de uma matriz de givens

for i,j in combinations(xrange(SIZE),2):
    print givens.givens(i,j,THETA,SIZE)
    print 
[[ 0.8660254  0.5        0.         0.         0.       ]
 [-0.5        0.8660254  0.         0.         0.       ]
 [ 0.         0.         1.         0.         0.       ]
 [ 0.         0.         0.         1.         0.       ]
 [ 0.         0.         0.         0.         1.       ]]

[[ 0.8660254  0.         0.5        0.         0.       ]
 [ 0.         1.         0.         0.         0.       ]
 [-0.5        0.         0.8660254  0.         0.       ]
 [ 0.         0.         0.         1.         0.       ]
 [ 0.         0.         0.         0.         1.       ]]

[[ 0.8660254  0.         0.         0.5        0.       ]
 [ 0.         1.         0.         0.         0.       ]
 [ 0.         0.         1.         0.         0.       ]
 [-0.5        0.         0.         0.8660254  0.       ]
 [ 0.         0.         0.         0.         1.       ]]

[[ 0.8660254  0.         0.         0.         0.5      ]
 [ 0.         1.         0.         0.         0.       ]
 [ 0.         0.         1.         0.         0.       ]
 [ 0.         0.         0.         1.         0.       ]
 [-0.5        0.         0.         0.         0.8660254]]

[[ 1.         0.         0.         0.         0.       ]
 [ 0.         0.8660254  0.5        0.         0.       ]
 [ 0.        -0.5        0.8660254  0.         0.       ]
 [ 0.         0.         0.         1.         0.       ]
 [ 0.         0.         0.         0.         1.       ]]

[[ 1.         0.         0.         0.         0.       ]
 [ 0.         0.8660254  0.         0.5        0.       ]
 [ 0.         0.         1.         0.         0.       ]
 [ 0.        -0.5        0.         0.8660254  0.       ]
 [ 0.         0.         0.         0.         1.       ]]

[[ 1.         0.         0.         0.         0.       ]
 [ 0.         0.8660254  0.         0.         0.5      ]
 [ 0.         0.         1.         0.         0.       ]
 [ 0.         0.         0.         1.         0.       ]
 [ 0.        -0.5        0.         0.         0.8660254]]

[[ 1.         0.         0.         0.         0.       ]
 [ 0.         1.         0.         0.         0.       ]
 [ 0.         0.         0.8660254  0.5        0.       ]
 [ 0.         0.        -0.5        0.8660254  0.       ]
 [ 0.         0.         0.         0.         1.       ]]

[[ 1.         0.         0.         0.         0.       ]
 [ 0.         1.         0.         0.         0.       ]
 [ 0.         0.         0.8660254  0.         0.5      ]
 [ 0.         0.         0.         1.         0.       ]
 [ 0.         0.        -0.5        0.         0.8660254]]

[[ 1.         0.         0.         0.         0.       ]
 [ 0.         1.         0.         0.         0.       ]
 [ 0.         0.         1.         0.         0.       ]
 [ 0.         0.         0.         0.8660254  0.5      ]
 [ 0.         0.         0.        -0.5        0.8660254]]