乘以大向量和内存不足。输入 HELP MEMORY 作为您的选项
实际上这就是我想做的 Ad=<100820x20164 double>且 b=<100820x1 双> Ad 也是稀疏矩阵,b 是非稀疏矩阵。下面是原始问题,我尝试更改语句 A=V'*V + y_0*y_0';正如您告诉我的那样使用块处理技术,现在问题出在下面提到的赋值语句上。
V=Ad;
b_1=b;
x_0=ones(size(V ,1) ,1);
y_0=V'*x_0;
A=V'*V + y_0*y_0';
b=V'*b_1 + dot(x_0,b_1)*y_0;
%%%%%%%%%使用下面的块处理进行修改%%%%%%
V=Ad;
b_1=b;
x_0=ones(size(V ,1) ,1);
y_0=V'*x_0;
v=V'*V ; %%% v is updated here which is left hand side of equation
%%% Block Processing code %% For right hand side of equation
y_01 = y_0(1:size(y_0)/2);
y_02 = y_0(size(y_0)/2 + 1:end);
res =( y_01 * y_01'); % Upper left
Temp=v(1:size(v ,1)/2 , 1:size(v ,1)/2) + res ;
v(1:size(v ,1)/2 , 1:size(v ,1)/2) = Temp; %%%% Problem here gets hang
clear Temp; clear res ;
res = y_02 * y_02'; % Bottom right
Temp=v(size(v ,1)/2 + 1 :end , size(v ,1)/2 + 1 :end) + res ;
v(size(v ,1)/2 + 1:end , size(v ,1)/2 + 1:end) = Temp;
clear Temp; clear res ;
res = y_01 * y_02'; % Upper right
Temp=v(1:size(v ,1)/2 , size(v ,1)/2 + 1:end) + res ;
v(1:size(v ,1)/2 , size(v ,1)/2 + 1:end) = Temp;
clear Temp; clear res ;
res = y_02 * y_01'; % Bottom left
Temp=v(size(v ,1)/2 + 1:end, 1:size(v ,1)/2 ) + res ;
v(size(v ,1)/2 + 1:end, 1:size(v ,1)/2 ) = Temp;
clear Temp; clear res ;
Actually this is what i am trying to do Ad=<100820x20164 double> and b= <100820x1 double> also Ad is sparse matrix and b is non-sparse .Below is the original Problem and i try to change the statement A=V'*V + y_0*y_0'; using the block processing technique as you told me , now the problem is on the assignment statement mentioned below.
V=Ad;
b_1=b;
x_0=ones(size(V ,1) ,1);
y_0=V'*x_0;
A=V'*V + y_0*y_0';
b=V'*b_1 + dot(x_0,b_1)*y_0;
%%%%%%%%% Modified using block processing below %%%%%%
V=Ad;
b_1=b;
x_0=ones(size(V ,1) ,1);
y_0=V'*x_0;
v=V'*V ; %%% v is updated here which is left hand side of equation
%%% Block Processing code %% For right hand side of equation
y_01 = y_0(1:size(y_0)/2);
y_02 = y_0(size(y_0)/2 + 1:end);
res =( y_01 * y_01'); % Upper left
Temp=v(1:size(v ,1)/2 , 1:size(v ,1)/2) + res ;
v(1:size(v ,1)/2 , 1:size(v ,1)/2) = Temp; %%%% Problem here gets hang
clear Temp; clear res ;
res = y_02 * y_02'; % Bottom right
Temp=v(size(v ,1)/2 + 1 :end , size(v ,1)/2 + 1 :end) + res ;
v(size(v ,1)/2 + 1:end , size(v ,1)/2 + 1:end) = Temp;
clear Temp; clear res ;
res = y_01 * y_02'; % Upper right
Temp=v(1:size(v ,1)/2 , size(v ,1)/2 + 1:end) + res ;
v(1:size(v ,1)/2 , size(v ,1)/2 + 1:end) = Temp;
clear Temp; clear res ;
res = y_02 * y_01'; % Bottom left
Temp=v(size(v ,1)/2 + 1:end, 1:size(v ,1)/2 ) + res ;
v(size(v ,1)/2 + 1:end, 1:size(v ,1)/2 ) = Temp;
clear Temp; clear res ;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然
V'*V
是稀疏的,但y_0*y_0'
却不是。当然,除非V'
有许多空行。您可以逐块计算
y_0*y_0'
:在“Process”部分,您可以将其与
V'*V
的适当部分结合起来。我还建议重构我的代码片段以避免冗余。While
V'*V
is sparse,y_0*y_0'
is not. Unless of courseV'
has many empty rows.You could calculate
y_0*y_0'
block-wise:In the 'Process' section you can combine it with the appropriate portion of
V'*V
. I would also suggest re-factoring my code snippet to avoid redundancy.