Effacer les filtres
Effacer les filtres

lsqr constraints

13 vues (au cours des 30 derniers jours)
Bibek
Bibek le 23 Sep 2011
Commenté : elham sa le 19 Juil 2015
I am trying to solve the system of linear equations Ax=b for x by iterative least square method(using lsqr code). How can I impose constraints to solutions x like none of x are zeros and negative numbers but sum of solutions x should be unity. In the matlab help, I found preconditioners(M or M=M1*M2) and initial guess(x0). I am not sure what they are and how should I set up them.Also I am not sure which is the best solution as i can get different converged solutions with different set of tol and maxit.Can I get help on these issues with a simple example? Thanks in advance!!

Réponses (2)

Walter Roberson
Walter Roberson le 23 Sep 2011
Perhaps if you used lsqlin() with the Aeq being a row vector of 1's the same length as x, and with Beq being the scalar 1. Since x is a column vector, the row vector of 1's matrix-multiplied by x would be the same thing as summing the x, and you would then compare that sum to what you had set for Beq, namely 1. You would use [] for A and b parameters, and you would use eps(0) for each of the lower bounds in order to require that the x are strictly positive.
  3 commentaires
Walter Roberson
Walter Roberson le 18 Juil 2015
What do you have?
elham sa
elham sa le 18 Juil 2015
Modifié(e) : elham sa le 18 Juil 2015
I have a linear system to solve for a blur kernel:
||origImg * kernel - blurryImg ||
by * I mean "convolution". I have defined Ax and A'x as operator for convolution. [A represents the matrix form of the original image, x represents the blur kernel]
I have the original image and the blurry image, and would like to find the blur kernel. I know that the least square is not the best solution for this, but this is my starting point, and I will add regularizations to it.
My problem is "blur kernel" has to be non-negative, and I can not impose this constraint in lsqr function. lsqlin has this capability, but it only accepts an explicit matrix, not a function handle.
I appreciate you help!

Connectez-vous pour commenter.


John D'Errico
John D'Errico le 19 Juil 2015
1. LSQR cannot apply linear equality constraints. Initial guess and preconditioners are completely different. They do not apply to your problem.
2. LSQR cannot solve a problem with bound constraints.
Software does what it is designed to do. That you want it to solve a different problem is not relevant. If you want to solve a problem with bound constraints AND an equality constraint then you will need to use LSQLIN, or something like it. (Yes, you could use lsqnonneg to bound the unknowns above zero, but the sum equality constraint will be a problem for you.)
  3 commentaires
John D'Errico
John D'Errico le 19 Juil 2015
No. LSQLIN does not accept general function handles. You may think of this as a linear problem, but in reality, all you are providing is a black box if it is a function handle. That means you would normally use a tool that will linearize things for you by differentiating that black box. So tools like fmincon or even lsqnonlin would make sense. Those tools are in fact the equivalent to lsqlin that I think you have asked for, and they will take general function handles, as well as allow the bound constraints you have suggested.
Alternatively, you could expand the convolution as a (sparse) linear system, writing out the equations as a matrix of coefficients. Then you could use lsqlin.
elham sa
elham sa le 19 Juil 2015
Thank you very much John! Thanks for mentioning fmincon and the group of non-linear optimizers that I should be able to use in my application.
About the expansion to sparse linear system, actually that's what I'm doing right now, but it takes a long time for large images.
I appreciate your help!

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by