How to solve a very large overdetermined system numerically?

Click For Summary
SUMMARY

This discussion focuses on solving a large overdetermined system of equations related to image processing, specifically for determining the surface profile of a 3D object z(x,y). The equations involve components of a surface unit vector (nx, ny, nz) and result in a matrix equation Mz=b, where M is a sparse matrix of size 2*#pixs x #pixs. The user encounters memory errors when attempting to solve this system using least squares in Python. Recommendations include utilizing specialized libraries for sparse matrices such as Scipy.sparse, Yale Sparse Matrix Package, and suitesparse to efficiently manage the computational demands.

PREREQUISITES
  • Understanding of overdetermined systems of equations
  • Familiarity with sparse matrix representations
  • Proficiency in Python programming, specifically with libraries like NumPy and SciPy
  • Basic knowledge of image processing concepts
NEXT STEPS
  • Explore the Scipy.sparse library for efficient sparse matrix operations
  • Investigate the Yale Sparse Matrix Package for advanced matrix routines
  • Learn about least squares solutions using the scipy.linalg.lstsq function
  • Research optimization techniques for handling large datasets in Python and MATLAB
USEFUL FOR

This discussion is beneficial for image processing engineers, data scientists, and researchers dealing with large-scale numerical computations, particularly those focused on solving complex systems of equations efficiently using Python or MATLAB.

dilloncyh
Messages
39
Reaction score
0
I am doing a project on image processing and I need to solve the following set of equations:

nx+nz*( z(x+1,y)-z(x,y) )=0
ny+nz*( z(x+1,y)-z(x,y) )=0
and equations of the boundary (bottom and right side of the image):
nx+nz*( z(x,y)-z(x-1,y) )=0
ny+nz*( z(x,y)-z(x,y-1) )=0

nx,ny,nz is the components of the surface unit vector which are already determined. The aim is to find the surface profile of a 3D object z(x,y).

Now the problem is that since (x,y) is the coordinates of an image, which has a typical size of say x=300 and y=200, so there are #pixs = 300*200 = 60000 unknowns. I try to rewrite the equations into Mz=b, where z and b are vectors of length #pixs, M is a matrix of size 2*#pixs x #pixs. When I try to solve this system of equations using the method of least square in python, I just get memory error.

So my question is, given that overdetermined system of equations with over ten thousand unknowns, how to solve it efficiently in python or matlab? Are there other ways of rewriting it into matrix form or other methods for solving this equation? I notice the matrix M is very sparse, but I have no idea how to utilize it.

thanks
 
Last edited:
Physics news on Phys.org
dilloncyh said:
I am doing a project on image processing and I need to solve the following set of equations:

nx+nz*( z(x+1,y)-z(x,y) )=0
ny+nz*( z(x+1,y)-z(x,y) )=0

nx,ny,nz is the components of the surface unit vector which are already determined. The aim is to find the surface profile of a 3D object z(x,y). The equations at the boundary are slightly different but they have the same form.

Now the problem is that since (x,y) is the coordinates of an image, which has a typical size of say x=300 and y=200, so there are #pixs = 300*200 = 60000 unknowns. I try to rewrite the equations into Mz=b, where z and b are vectors of length #pixs, M is a matrix of size 2*#pixs x #pixs. When I try to solve this system of equations using the method of least square in python, I just get memory error.

So my question is, given that overdetermined system of equations with over ten thousand unknowns, how to solve it efficiently in python or matlab? Are there other ways of rewriting it into matrix form or other methods for solving this equation? I notice the matrix M is very sparse, but I have no idea how to utilize it.

thanks
There are several suites of matrix routines specifically designed to handle sparse matrices and to take advantage of their nature.

Some of these routine suites are:

The Yale Sparse Matrix Package

suitesparse

Scipy.sparse

You can google each of these packages, or simple search for "sparse matrix" and find what might suit your needs. :wink:
 
I am studying the mathematical formalism behind non-commutative geometry approach to quantum gravity. I was reading about Hopf algebras and their Drinfeld twist with a specific example of the Moyal-Weyl twist defined as F=exp(-iλ/2θ^(μν)∂_μ⊗∂_ν) where λ is a constant parametar and θ antisymmetric constant tensor. {∂_μ} is the basis of the tangent vector space over the underlying spacetime Now, from my understanding the enveloping algebra which appears in the definition of the Hopf algebra...

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K