Matrix column updation via optimization
9 次查看(过去 30 天)
显示 更早的评论
I have an initial matrix B of size (n x n). I have to update each columns of the matrix except the first column such that the updated matrix is orthogonal (BB^T =I) and it also satisfies the constraint (say Bx=c). Is there any existing optimization algorithm to solve it?
13 个评论
John D'Errico
2022-10-27
编辑:John D'Errico
2022-10-27
I'm sorry, but this makes no sense.
You are asking to modify the matrix B, reducing it to an orthogonal matrix. But then your "constraint" introduces a completely new variable, x. What is x, and what are you then hoping to optimize? Such an orthogonality reduction for B is a simple one (gram-schmidt is an example), that needs nothing more than linear algebra.
My guess is you wanted to speicify some sort of constraint on the reduction to an orthogonal matrix, and you just wrote down the first thing that came to mind, even if it made no sense in context. Are x and c known vectors?
I can see other problems too. If you will modify the columns of b, not touching the FIRST column, then it is required that the first column of B must already be unit normalized. And that would say you may need to modify even the first column of B. Otherise it is impossible for B'*B to yield the identity.
Veena Narayanan
2022-10-27
编辑:Veena Narayanan
2022-10-27
The vectors x and c are known, and c is a sparse vector. The initial matrix B is to be updated so as to satify the following conditions:
1) The first column of the matrix B remains unaltered (The first column of B is unit normalized).
2) The remainining (n-1) columns of the matrix B should be orthogonal to each other as well as to the first column of the matrix. (The first column needs to be fixed as i have to use it in another stage of the algorithm).
3) The matrix should be updated such that norm(Bx-c) is minimum.
4) The other (n-1) updated columns of B should also be unit norm vectors.
Torsten
2022-10-27
编辑:Torsten
2022-10-27
You wrote down the optimization problem you have to solve:
min: (norm(B*x - c))^2
under the constraints
B*B^T = I
B(:,1) = given from original matrix B (should be a vector of norm 1)
I don't know if there is a theoretical solution.
Try "fmincon" to solve.
Do x and c have the same vector norm ?
Veena Narayanan
2022-10-27
@Torsten I have tried fmincon but it did'nt work. Yes, the vectors x and c have the same vector norm.
Veena Narayanan
2022-11-1
@Torsten Initially I tried this code by including only the orthogonality condition to check if the updated matrix B_hat satisfies the orthogonality condition. But the matrix B_hat was same as the initial matrix B_in and there was no updation.
The initial matrix B_in considered was a random matrix of size (64x64). c and x are vectors of size (64x1).
A = []; b = []; Aeq = []; beq = []; lb = []; ub = []; x0=B_in;
fun=@(B)norm(c-B*x)^2;
nonlcon = @orthon;
[B_hat,fval,exitflag,output] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon)
---------------------------------------------------------
function [c,ceq] = orthon(B)
c = [];
ceq = norm(eye(64)- B*B','fro')^2;
----------------------------------------------------------
Torsten
2022-11-1
If this is the problem you are trying to solve, it has a simple solution:
If you define
u = (x-c)/norm(x-c)
and
B = eye(64) - 2*u*u'
then B*x = c and B is an orthogonal matrix.
The difficulty arises because you want to keep the first column of the matrix B unchanged.
Veena Narayanan
2022-11-2
@Torsten Thank you. But the orthogonality constraint should be satifiied retaining the first column same as that of the matrix B.
Torsten
2022-11-2
编辑:Torsten
2022-11-2
But the orthogonality constraint should be satifiied retaining the first column same as that of the matrix B.
I don't understand. If you construct a matrix B' as above, it is orthogonal and satisfies B'*x = c.
But it is not related to your initial matrix B. Especially if you replace the first column of B' with the first column of B, B'*x = w and B' orthogonal will no longer be true in general.
I posted this "solution" because you don't use in your code that you want to prescribe the first column of B'. So the
B' = eye(64) - 2*u*u'
from above could be one solution from your code if run successfully.
Veena Narayanan
2022-11-2
@Torsten My aim is to obtain an updated matrix B of size (n x n) that satisfies the condition Bx=c, which is orthogonal and have its first column same as that of the initial matrix. Therefore, the updation should be done such that the remaining (n-1) columns (except the first column) are mutually orthogonal as well as orthogonal to the first column.
The first column should be same as the initial matrix because i have to use that column at a later stage in my algorithm. I understand that the code above satisfies the orthogonality condition. But it cannot be used here since the first column also gets altered in the process.
采纳的回答
Bruno Luong
2022-11-2
编辑:Bruno Luong
2022-11-2
Using Housholder transformation, B is uniquely determined only for n=3.
I claim that my code solve the problem of
argmin(norm(B*x-c))
under constraints
B(;,1) = B1, and
B'*B = I
where B1, x, c are known.
PS: I assumeall variables are reals. For complex some transpose operations would be modified.
% Generate some fake data
n = 3;
[B,~] = qr(randn(n))
B = 3×3
-0.3607 -0.8710 -0.3336
0.4030 0.1770 -0.8979
0.8411 -0.4583 0.2872
x = randn(n,1);
c = B*x;
B1 = B(:,1);
clear B
% Try to recover B(:,2:end) (with sign of columns that is random) from B(:,1), x, and c
N = null(B1');
cp = c-B1*x(1);
xp = x(2:n);
cp = (cp'*N)';
vp = (cp-xp); % EDIT sign corrected
vp = vp/norm(vp);
P = eye(n-1)-2*vp*vp';
H = N*P;
B = [B1, H]
B = 3×3
-0.3607 -0.8710 -0.3336
0.4030 0.1770 -0.8979
0.8411 -0.4583 0.2872
11 个评论
Veena Narayanan
2022-11-2
@Bruno Luong This code given an orthogonal matrix and also retains the first column. But the condition Bx=c is not satisfied with the updated matrix. The error between the original c and the c^ obtained using updated matrix B is large.
Bruno Luong
2022-11-2
编辑:Bruno Luong
2022-11-2
Your claims does mean anything to me.
The solution of my code meets B*x = c in the least square sense.
Since B is orthogonal |B*x|must be equal to |x| so if you provide x and c that does not have equal norm it can NEVER meet exactly the condition.
I bet if you could find an example where where |B*x-c| with B given by my code is larger than some other B with the same constraints. Until you don't you cannot show my code doesn't work.
Torsten
2022-11-2
编辑:Torsten
2022-11-2
But your original B satisfied B*x = c exactly and was orthogonal.
So if you had recovered the original B, both conditions (B*B.' = I and B*x = c exactly) would hold.
In the case n=3, it's only the sign of P which is wrong.
I don't know if experimenting with the sign of P suffices for n > 3.
Bruno Luong
2022-11-2
Test with n =5, the norm of B*x-c is pratically 0
% Generate some fake data
n = 5;
[B,~] = qr(randn(n))
B = 5×5
-0.4189 0.3461 -0.1046 0.7862 -0.2750
0.3966 -0.2379 0.7354 0.4692 0.1584
-0.0667 -0.8680 -0.4058 0.2722 -0.0585
-0.8141 -0.2212 0.4420 -0.1957 0.2339
0.0093 0.1459 -0.2970 0.2220 0.9171
x = randn(n,1);
c = B*x;
B1 = B(:,1);
clear B
% Try to recover B(:,2:end) (with sign of columns that is random) from B(:,1), x, and c
N = null(B1');
cp = c-B1*x(1);
xp = x(2:n);
cp = (cp'*N)';
vp = (cp-xp);
vp = vp/norm(vp);
P = eye(n-1)-2*vp*vp';
H = N*P;
B = [B1, H]
B = 5×5
-0.4189 -0.5396 0.3613 0.6277 -0.0940
0.3966 0.5942 0.1535 0.6818 -0.0351
-0.0667 0.2291 0.9007 -0.3624 0.0237
-0.8141 0.5477 -0.1846 0.0399 0.0407
0.0093 -0.0579 0.0257 0.0905 0.9938
norm(B*x-c)/norm(c)
ans = 1.9173e-16
Veena Narayanan
2022-11-2
@Bruno Luong Thank you for the clarification. In the code given above, both c and x are of equal norm. Also |B*x|= |x|. Even then |B*x-c| gives a value approximately equal to 1. So do you mean to say, even if i consider some other B, i will not be able to obtain a smaller error value for |B*x-c|?
Veena Narayanan
2022-11-3
@Bruno Luong Sir, in the code above, can you clarify why we consider the Householder matrix P associated with vp? Is it to obtain a set of orthogonal vectors?
Bruno Luong
2022-11-3
编辑:Bruno Luong
2022-11-3
The purpose of P (Householder reflection) is to map the projection of x (xp) to the projection of c. The projection is on the subspace orthogonal to span<B1> whith is span(N). The Housholder are reflected vectors mirror to span(vp); computed so that xp is mapped to cp. P is orthognal so N*P.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Least Squares 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
