Created
February 15, 2019 19:04
-
-
Save Robofied/8708543e40c86af51267b466b6b17e9c to your computer and use it in GitHub Desktop.
Numpy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## performing svd using svd() function. | |
## Returns full matrices by default. | |
U,V,S = lnp.svd(a = np.random.randn(9, 6)) | |
## Printing the shapes of all matrices. | |
print(U.shape,V.shape,S.shape) | |
#[Output]: | |
#(9, 9) (6,) (6, 6) | |
## Eigen vectors | |
##1. eig() | |
##Compute the eigenvalues and right eigenvectors of a square array.In [11]: | |
## It is returning eigenvalues and eigenvectors. | |
w, v = lnp.eig(np.array([[1, -1], [1, 1]])) | |
## eigenvalues | |
print(w) | |
#[Output]: | |
#array([1.+1.j, 1.-1.j]) | |
## eigenvectors | |
print(v) | |
#[Output]: | |
#array([[0.70710678+0.j , 0.70710678-0.j ], | |
# [0. -0.70710678j, 0. +0.70710678j]]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment