⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tuckrunsapproxfit.m

📁 这是一个三面阵列的数学工具软件
💻 M
字号:
function out=tuckrunsApproxFit(X,n,m,p,maxa,maxb,maxc)
% out=tuckrunsApproxFit(X,n,m,p,maxa,maxb,maxc)
%
% Uses PCASUP results and computes all approx tucker3 solutions r1=1:maxdim,r2=1:maxdim,r3=1:maxdim
%
% Input: 
%	X: data
%	n,m,p: order
%  maxa, maxb, maxc: maximum dimensionality 
%			(if only maxa specified, then same for all modes)
% Output:
%  out = table with columns: r1 r2 r3 fit% n_of_local_optima total_n_of_comp 
%
%
% uses tuck3abk pcasup ssq

[A,B,C,la,lb,lc]=pcasup3(X,n,m,p);
rr1=n;if n>m*p,rr1=m*p;A=A(:,1:rr1);end;
rr2=m;if m>n*p,rr2=n*p;B=B(:,1:rr2);end;
rr3=p;if p>m*n,rr3=m*n;C=C(:,1:rr3);end;
Z=permnew(A'*X,rr1,m,p);
Z=permnew(B'*Z,rr2,p,rr1);
Z=permnew(C'*Z,rr3,rr1,rr2);    
HH=Z.^2/ssq(X)*100;       % HH contains squared core values, divided by SS(X), multiplied by 100
if nargin<7,maxb=maxa;maxc=maxa;end;
if maxa>rr1,maxa=rr1;end;
if maxb>rr2,maxb=rr2;end;
if maxc>rr3,maxc=rr3;end;
conv=1e-6;
out=[];
for r1=1:maxa
  for r2=1:maxb
    for r3=1:maxc
      func=[];
      if r1*r2>=r3 & r1*r3>=r2 & r2*r3>=r1
      H=permnew(HH(1:r1,:),r1,rr2,rr3);
      H=permnew(H(1:r2,:),r2,rr3,r1);
      H=H(1:r3,:);
      fp=sum(H(:));
      out=[out;r1 r2 r3 fp];
      end;
    end;
  end;
end;
s=sum(out(:,1:3)')';
out=[out s];
[ss,si]=sort(s);
out=out(si,:);
         

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -