How to solve a very large overdetermined system numerically?

In summary, the conversation discusses a project on image processing that involves solving a set of equations to find the surface profile of a 3D object. The equations are rewritten into matrix form, but there are over 60000 unknowns which causes a memory error when using the method of least square in Python. The speaker is looking for efficient ways to solve this overdetermined system of equations, potentially utilizing the sparsity of the matrix. Several packages, such as the Yale Sparse Matrix Package, suitesparse, and Scipy.sparse, are mentioned as potential solutions.
  • #1
dilloncyh
39
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
  • #2
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:
 

FAQ: How to solve a very large overdetermined system numerically?

How do I determine if a system is overdetermined?

A system is considered overdetermined if it has more equations than unknown variables. This means that there are more constraints or conditions than there are variables to satisfy them.

What is the best method for solving a very large overdetermined system numerically?

The best method for solving a large overdetermined system numerically depends on the specific characteristics of the system, such as the number of equations and variables, as well as the structure and complexity of the equations. Some commonly used methods include least squares, matrix factorization, and iterative methods like Gauss-Seidel or Jacobi.

How can I improve the accuracy of my numerical solution for a large overdetermined system?

There are several ways to improve the accuracy of a numerical solution for a large overdetermined system. This includes using a more precise numerical method, increasing the number of iterations, reducing the tolerance for convergence, or using higher precision data types.

What are the challenges of solving a very large overdetermined system numerically?

One of the main challenges of solving a large overdetermined system numerically is the increased computational complexity and time required, especially for systems with a large number of equations and variables. Additionally, the choice of numerical method and its implementation can also affect the accuracy and stability of the solution.

Are there any alternative approaches to solving a very large overdetermined system numerically?

Yes, there are alternative approaches to solving a large overdetermined system numerically. These include symbolic methods, where the system is simplified and solved algebraically, as well as probabilistic methods, such as Monte Carlo simulation. However, these approaches may not always be feasible or accurate for very large systems.

Similar threads

Replies
1
Views
704
Replies
3
Views
3K
Replies
4
Views
2K
Replies
1
Views
2K
Replies
11
Views
2K
Replies
4
Views
2K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
9
Views
2K
Back
Top