In this page, different codes for calculating the fast orthogonal discrete signal-induced transforms (DsiT), including the heap transforms (DsiHT), are including and more codes will be added later. The base transformation can be defined as the Givens rotation. Many other transformations, linear and nonlinear ones can be also used for generating the unitary transforms. The DsiHT differs from the Householder transformation, and can be used in many applications as well as in the QR decomposition (in this application, the selection of the transform path can essentially reduce the number of operations). The concept of the DsiHT can be used in signal and image processing, communication, as well in cryptography. Soon we will post one of the codes for cryptography which uses the idea of heap transform; the code is very simple, and cannot be broken. If somebody is interesting, we can send him/her the encrypted text of any type of document with the key which will be used for document encryption. (Art, August 1, 2008).
.
Code "msob.m" is one of the first codes that had been written for calculating the heap transform of the vector, or discrete-time signal t(n) of any length, which is induced by a vector, or signal-generator y(n) of the same length. The set of angles, U1, for the Givens rotations performing the heap transform are also calculating. This code use the ordinary path, when components of the vectors are processed sequentially in order (0,1),2,3,...,N-1. We also call this transform the heap transform with "the week horse-drawn vehicle," other paths can be chosen with more strong “horse-drawn vehicles.” The code can be improved, by calculating the angles separately and then using these angles for vector rotation. The corersponding codes "msob_angles.m" and "msob_apply.m" are also given below. The matrix of the heap transform can be calculated indifferent way, directly, or by using the above codes (see "matrix_msob.m," "bptMat.m," and "bptMat_fast.m").
% --------------------------------------------------------------------------------
% Codes for calculating the signal-induced fast transforms for MATLAB 7
% (C) 02/07/2005-06/07/2007, Merughan and Artyom M. Grigoryans
%
function [t,U1]=msob(y,t)
N=length(y);
pi2=pi/2;
for i1=2:N
yi1=y(i1);
y1=y(1);
if abs(yi1) >eps
if y1==0
u=pi2;
else
u=acot(-y1/yi1);
end;
%
% addition of Jan 2, 2007
if y1<=0
u=u+pi;
end;
%
U1(i1)=u;
c1=cos(u); s1=sin(u);
A=[c1 -s1
s1 c1];
B=A*[y1 yi1]';
y(1) =B(1);
y(i1)=B(2);
T=A*[t(1) t(i1)]';
t(1)=T(1); t(i1)=T(2);
end;
end;
U1(1)=y(1);

function U1=msob_angles(y)
N=length(y);
pi2=pi/2;
for i1=2:N
yi1=y(i1);
y1=y(1);
if abs(yi1) >eps
if y1==0
u=pi2;
else
u=acot(-y1/yi1);
end;
% addition of Jan 2, 2007
if y1<=0
u=u+pi;
end;
U1(i1)=u;
y(1) = [cos(u) -sin(u)]*[y1 yi1]';
end;
end;
U1(1)=y(1);

function t=msob_apply(U1,t)
N=length(U1);
for i1=2:N
u=U1(i1);
c1=cos(u); s1=sin(u);
A=[c1 -s1
s1 c1];
T=A*[t(1) t(i1)]';
t(1)=T(1); t(i1)=T(2);
end;

function T=bptMat(x)
N=length(x);
T=zeros(N);
for i1=1:N
y=zeros(1,N);
y(i1)=1;
T(:,i1)=msob(x,y);
end;

function T=bptMat_fast(U1)
N=length(U1);
T=zeros(N);
for i1=1:N
y=zeros(1,N);
y(i1)=1;
T(:,i1)=msob_apply(U1,y);
end;

function [A,U]=matrix_msob(y)
% Angles are also stored
N=length(y);
A=zeros(N);
for k=1:N
A(k,k)=1;
end;
pi2=pi/2;
U=zeros(1,N);
for i1=2:N
yi1=y(i1);
y1=y(1);
if abs(yi1) >eps
if y1==0
u=pi2;
else
u=acot(-y1/yi1);
end;
% addition of Jan 2, 2007 if y1<=0 u=u+pi; end;
U(i1)=u;
c1=cos(u); s1=sin(u);
y(1)=[c1 -s1]*[y1 yi1]';
S=eye(N);
S(1,1) =c1; S(i1,1)=-s1;
S(1,i1)=s1; S(i1,i1)=c1;
A=A*S;
end;
end;
U(1)=y(1);
%A2=A/sum(sum(A));
A=A'; % to make the same as T=bptMat(y);
% --------------------------------------------------------------