0

I want to extract linearly independent samples from a matrix. For which I want to use eigen values. But the issue is numpy/scipy based functions give sorted list of eigen values. Through which I loose the information that which eigen value corresponds to which row vector of original matrix, in order to carefully drop them.

I tried to create my own code to compute eigen values as:

   numpy.linalg.solve(numpy.linalg.det(I,A)) 

where, A is the original matrix and I is identity. But this gives error and is incorrect. What way I can solve this problem?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
shaifali Gupta
  • 380
  • 1
  • 4
  • 16

1 Answers1

1

They do not give sorted lists by default, try for example

import numpy as np
from numpy import linalg as LA
A = np.array([[1,2,3],[3,2,1],[1,0,-1]])
w, v = LA.eig(A)
print(w)
    [  4.31662479e+00  -2.31662479e+00   3.43699053e-17]
print(v)
    [[ 0.58428153  0.73595785  0.40824829]
     [ 0.80407569 -0.38198836 -0.81649658]
     [ 0.10989708 -0.55897311  0.40824829]]

The eigenvalue w[0] corresponds to the 0th column of v. The eigenvalue w[1] to column 1, .... To extract the ith column vector, just use

u = v[:,i]
benito_h
  • 460
  • 5
  • 16