-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathLieConvolution.m
36 lines (30 loc) · 1.61 KB
/
LieConvolution.m
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
%% Convolution (Applying BCH formula) for SO3 values
% made by Terry Taewoong Um ([email protected])
% Adaptive Systems Lab., University of Waterloo
function [Conv_MagDelta] = LieConvolution(model, IdxTrain)
% [nJoint ig nTraining nFiles] = size(input_LieVec);
% LieParam3 = zeros(nTraining,3);
[nJoint nDim3 nData] = size(model.LieVec);
nTrain = IdxTrain(1,2)-IdxTrain(1,1)+1;
nConv = 0;
for ii=1:nJoint-1
nConv = nConv+ii;
end
% Convolution with (LieVec(i)*delta_theta(i))
Conv_MagDelta = zeros(nTrain, 3, nConv);
ii_Conv = 1;
for kk=1:nJoint-1
MagDelta2 = (model.LieMag(:,IdxTrain(1,1)+1:IdxTrain(1,2)+1)-model.LieMag(:,IdxTrain(1,1):IdxTrain(1,2)));
LieParam1_MagDelta2 = (squeeze(model.LieVec(1,:,IdxTrain(1,1):IdxTrain(1,2))).*(ones(3,1)*MagDelta2(1,:)))';
for mm = kk:nJoint-1
LieParam2_MagDelta2 = (squeeze(model.LieVec(mm+1,:,IdxTrain(1,1):IdxTrain(1,2))).*(ones(3,1)*MagDelta2(mm+1,:)))';
for ii=1:nTrain
LieParam3_MagDelta2(ii,:) = LieParam1_MagDelta2(ii,:)+LieParam2_MagDelta2(ii,:) + 0.5*cross(LieParam1_MagDelta2(ii,:),LieParam2_MagDelta2(ii,:)) + ...
1/12*(cross(LieParam1_MagDelta2(ii,:),cross(LieParam1_MagDelta2(ii,:),LieParam2_MagDelta2(ii,:)))+cross(LieParam2_MagDelta2(ii,:),cross(LieParam2_MagDelta2(ii,:),LieParam1_MagDelta2(ii,:))));
end
LieParam1_MagDelta2 = LieParam3_MagDelta2;
Conv_MagDelta(:,:,ii_Conv) = LieParam3_MagDelta2;
ii_Conv = ii_Conv+1;
end
end
end