atomsmasher atomsmasher - 10 months ago 29
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


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