Skip to content

Commit 0c97cab

Browse files
Anthony AgbyAnthony Agby
authored andcommitted
add matrix math
1 parent 41d3810 commit 0c97cab

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

HyperSpectral/matrixMath.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import numpy as np
2+
3+
#calculating Eigen values, Eigen vectors, and the Coefficient Matrix for a matrix
4+
def matrixMath(valA1, valA2, valB1, valB2):
5+
matrix = np.array([[valA1, valA2], [valB1, valB2]], dtype=float)
6+
7+
eigenValues, eigenVectors = np.linalg.eig(matrix)
8+
9+
print('The eigenvalues of the covariance matrix are: ')
10+
print(eigenValues)
11+
12+
print('The eigenvectors for covariance matrix are: ')
13+
print(eigenVectors)
14+
15+
coefficentMatrix = eigenVectors.transpose()
16+
print('The coefficient matrix is: ')
17+
print(coefficentMatrix)

0 commit comments

Comments
 (0)