Example #1
0
     [0, 0, 0, 0, 0, 0, 0, 0, b, 0, 0, 0, b, 0, 0, 0, 0, 0, 0, 0],
     [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, b, 0, 0, 0, 0, 0, 0, 0],
     [0, 0, 0, 0, a, 0, 0, 0, b, 0, b, 0, 0, 0, 0, c, 0, 0, 0, 0],
     [0, 0, 0, 0, a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, c, 0, 0, 0, 0],
     [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, b, 0, 0, 0, 0, 0, 0, 0, 0, 0],
     [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a, 0, 0, 0, 1, 0, 0],
     [0, 0, 0, 0, 0, 0, 0, 0, 0, c, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
     [0, 0, 0, 0, 0, 0, 0, 0, 0, c, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
     [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0],
     [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, b, 0, 0, 0, 1, 0, 0, 0],
     [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a, 0, 0, 0, 0, 0, 0],
     [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, c, 0, 0, 1, 0],
     [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, c, 0, 0, 0, 0]])

testMatrix = np.array([
    [a, a, 0, 0],
    [a, 0, b, 0],
    [0, a, b, 0],
    [0, 0, b, 0],
])
testMatrix2 = np.array([[a, a, 0], [a, 0, 0], [0, a, 0]])
# Assign the matrix to a Coordinator for both algorithms
coord = Coordinator(initMatrix)

# Run the power iteration algorithm and print vector
coord.runPowerIteration()

# test multiplication
testMatrix3 = np.array([[a, a, 0], [a, 0, 0], [0, a, 1]])
testMatrix4 = np.array([[b, b, b], [b, b, b], [b, b, b]])