<jupyter_start><jupyter_text>Diagonalization of rectangular matrices Required Python libraries<jupyter_code>import numpy as np<jupyter_output><empty_output><jupyter_text>Functions<jupyter_code>def myFunc(matrix):
    # Create Symmetric matrix from rectangular matrix
    symmetricMatrix = np.matmul(np.transpose(matrix),matrix) 
    # Obtain eigenvalues and eigenvectors
    eigenValues, eigenVectors = np.linalg.eig(symmetricMatrix)
    
    # Create D from the eigenvalues
    diagonalizedMatrix = np.eye(len(eigenValues))*eigenValues
    # We already have P in the eigenvectors 
    # because the function returns a matrix 
    # that includes all of them
    
    # P*D*inv(P)
    pdp = eigenVectors * diagonalizedMatrix * np.linalg.inv(eigenVectors)
    # P*D*transpose(P)
    pdpT = eigenVectors * diagonalizedMatrix * np.transpose(eigenVectors)
    
    print(pdp)
    print(pdpT)<jupyter_output><empty_output><jupyter_text>Sample<jupyter_code>A = np.array([[1,3,4],[2,0,1],[5,8,1],[0,1,1]])
myFunc(A)<jupyter_output>[[26.71036803  0.         -0.        ]
 [ 0.          1.03415815 -0.        ]
 [-0.         -0.         11.67237521]]
[[26.71036803  0.         -0.        ]
 [ 0.          1.03415815 -0.        ]
 [-0.         -0.         11.67237521]]
{'fraction_non_alphanumeric': 0.11914217633042097, 'fraction_numerical': 0.06513105639396347, 'mean_word_length': 2.949843260188088, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '352133', 'license': 'MIT', 'n_tokens_mistral': 499, 'n_tokens_neox': 448, 'n_words': 82, 'path': 'code/RectangularMatrixDiagonalization.ipynb', 'repo_name': 'der-coder/Cinvestav-Mathematics-I-2019', 'size': '1259'}