atomsmasher atomsmasher - 1 year ago 83
Python Question

How to solve a equation of the form (A'A - yBB')x = 0 with numpy

Using numpy if I had a system of equations:

3x + 2y = 5
1x + 4y = 10

I could solve them with

a = [[3,2],[1,4]]
b = [5,10]
solution = numpy.linalg.solve(a,b)

Now, what if I had two matrices, A and B each of shape (100,100) and I wanted to solve an equation of the form: (A'A - yBB')x = 0

I'm unsure as to how I would set this up using

Answer Source

This specific equation has an analytical solution:

  1. either x is 0 and y can be anything


  1. x can be anything and then A'A - yBB' = 0 which can be linear and solved using numpy.linalg.solve

can be linear because the dimensions does not add well

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download