
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Distributed under a 3-Clause BSD License 
%
% Copyright 2021 Lars Eldén, Linköping University, and Maryam Dehghan,
% Federal University of Ceará,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%% Initialization of Krylov Schur Code of (1,2)-Symmetric Tensor %%%%%%%%
clc
clear
addtopath;

%% Example 1: create a (1,2)-symmetric signal plus noise tensor 
 n=[200 200 200];
 options.r=[2 2 2]; r=options.r;
 rho=input('Noise level:  ');
  
 if size(n,2)==1, n=n'; end
Asignal=tenzeros(n);
for i=1:r(3)
    B=randn(r(1),r(2));
    B=(B+B')/2;
    Asignal(1:r(1),1:r(2),i)=B;
end
for i=1:n(3)
    B1=randn(n(1),n(2));
    B1=(B1+B1')/2;
    Anoise(:,:,i)=B1;
end

Anoise=rho*Anoise;
A=Asignal+Anoise;

P=randperm(n(1));
Q=randperm(n(3));
A=A(P,P,Q);
