-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorzCanonicalAngles.m
More file actions
71 lines (58 loc) · 1.51 KB
/
orzCanonicalAngles.m
File metadata and controls
71 lines (58 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
function C = orzCanonicalAngles(X,varargin)
%function C = orzCanonicalAngles(X,varargin)
% Agerage
if nargin < 1
error('error');
end
if nargin == 1
X = X(:,:,:);
[nDim nSubDim1,nSet1] = size(X);
[nDim nSubDim2,nSet2] = size(X);
B = reshape((X(:,:)'*X(:,:)).^2,nSubDim1,nSet1,nSubDim2,nSet2);
clear X
C =( cumsum(cumsum(B,1),3));
clear B
for S1 = 1:nSubDim1
for S2 = 1:nSubDim2
C(S1,:,S2,:) = C(S1,:,S2,:)/min([S1,S2]);
end
end
C = permute(C,[2,4,1,3]);
end
% if nargin == 1
% X = X(:,:,:);
% Y = X(:,:,:);
%
% [nDim nSubDim1,nSet1] = size(X);
% [nDim nSubDim2,nSet2] = size(Y);
% B = reshape((X(:,:)'*Y(:,:)).^2,nSubDim1,nSet1,nSubDim2,nSet2);
%
% C =( cumsum(cumsum(B,1),3));
%
% for S1 = 1:nSubDim1
% for S2 = 1:nSubDim2
% C(S1,:,S2,:) = C(S1,:,S2,:)/min([S1,S2]);
% end
% end
%
% C = permute(C,[2,4,1,3]);
%
% end
if nargin == 2
Y = varargin{1};
X = X(:,:,:);
Y = Y(:,:,:);
[nDim nSubDim1,nSet1] = size(X);
[nDim nSubDim2,nSet2] = size(Y);
B = reshape((X(:,:)'*Y(:,:)).^2,nSubDim1,nSet1,nSubDim2,nSet2);
C = squeeze( cumsum(cumsum(B,1),3));
for S1 = 1:nSubDim1
for S2 = 1:nSubDim2
C(S1,:,S2,:) = C(S1,:,S2,:)/min([S1,S2]);
end
end
C = permute(C,[2,4,1,3]);
end
if nargin > 2
error('error');
end