-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateRepresentationCompact.m
64 lines (46 loc) · 1.47 KB
/
UpdateRepresentationCompact.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
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
function [mat_compact_B] = UpdateRepresentationCompact(...
Xbase, ock_model)
all_D = ock_model.all_D;
num_sub_dic_each_partition = ock_model.num_sub_dic_each_partition;
if ock_model.is_optimize_R
Z = ock_model.R' * Xbase;
else
Z= Xbase;
end
if isfield(ock_model, 'para_encode')
para_encode = ock_model.para_encode;
end
para_encode.is_initialize = 1;
para_encode.num_grouped = ock_model.num_grouped;
if isfield(ock_model, 'is_ock')
para_encode.is_ock = ock_model.is_ock;
end
para_encode
mat_compact_B = UpdateRepresentation(...
Z, all_D, [], num_sub_dic_each_partition, ...
para_encode);
% there is no need to conduct the following.
% para_encode.is_initialize = 0;
% %
% mat_compact_B = UpdateRepresentation(...
% Z, all_D, mat_compact_B, ...
% num_sub_dic_each_partition, para_encode);
return;
if num_sub_dic_each_partition == 1
method = 0;
else
method = 102;
end
num_point = size(Xtraining, 2);
mat_compact_B = zeros(numel(all_D) * num_sub_dic_each_partition, num_point, 'int16');
idx_dim_start = 1;
for i = 1 : numel(all_D)
subD = all_D{i};
sub_dim = size(subD, 1);
idx_dim_end = idx_dim_start + sub_dim - 1;
subZ = Z(idx_dim_start : idx_dim_end, :);
idx_dim_start = idx_dim_end + 1;
new_compact_SubB = mexMatchingPersuit(subZ, subD, num_sub_dic_each_partition, method);
mat_compact_B((i - 1)* num_sub_dic_each_partition + 1 : i * num_sub_dic_each_partition, : ) = ...
new_compact_SubB;
end