Skip to content

dslima90/givens-compression

Repository files navigation

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]]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published