2727 # error("download escalator video from http://cvxr.com/tfocs/demos/rpca/escalator_data.mat")
2828end
2929
30- mtrue = read(file, " X" )
31- n1 = convert(Integer,read(file, " m" ))
32- n2 = convert(Integer,read(file, " n" ))
33- m_mat = convert(Array{TF,2 },mtrue)
34- m_tensor = convert(Array{TF,3 },reshape(mtrue,n1,n2,Integer(200 )))
30+ mtrue = read(file, " X" );
31+ n1 = convert(Integer,read(file, " m" ));
32+ n2 = convert(Integer,read(file, " n" ));
33+ m_mat = convert(Array{TF,2 },mtrue);
34+ m_tensor = convert(Array{TF,3 },reshape(mtrue,n1,n2,Integer(200 )));
3535
3636# computational grid for the video
37- comp_grid = compgrid((1f0 ,1f0 ,1f0 ),(size(m_tensor,1 ),size(m_tensor,2 ), size(m_tensor,3 )))
37+ comp_grid = compgrid((1f0 ,1f0 ,1f0 ),(size(m_tensor,1 ),size(m_tensor,2 ), size(m_tensor,3 )));
3838
39- comp_grid_time_slice = compgrid((1f0 ,1f0 ),(size(m_tensor,1 ),size(m_tensor,2 )))
39+ comp_grid_time_slice = compgrid((1f0 ,1f0 ),(size(m_tensor,1 ),size(m_tensor,2 )));
4040
4141
4242# #####################################################################
@@ -52,7 +52,7 @@ options = PARSDMM_options()
5252# l1 (total variation) constraints (in one direction)
5353
5454# find a reasonable value for the l1-ball
55- (TD_OP, AtA_diag, dense, TD_n) = get_TD_operator(comp_grid," D_z" ,options. FL)
55+ (TD_OP, AtA_diag, dense, TD_n) = get_TD_operator(comp_grid," D_z" ,options. FL);
5656TV_z = norm(TD_OP* vec(m_tensor),1 )
5757
5858m_min = 0.0
@@ -61,15 +61,15 @@ set_type = "l1"
6161TD_OP = " D_z"
6262app_mode = (" tensor" ," " )
6363custom_TD_OP = ([],false )
64- push!(constraint, set_definitions(set_type,TD_OP,m_min,m_max,app_mode,custom_TD_OP))
64+ push!(constraint, set_definitions(set_type,TD_OP,m_min,m_max,app_mode,custom_TD_OP));
6565
66- (P_sub,TD_OP,set_Prop) = setup_constraints(constraint,comp_grid,options. FL)
67- (TD_OP,AtA,l,y) = PARSDMM_precompute_distribute(TD_OP,set_Prop,comp_grid,options)
66+ (P_sub,TD_OP,set_Prop) = setup_constraints(constraint,comp_grid,options. FL);
67+ (TD_OP,AtA,l,y) = PARSDMM_precompute_distribute(TD_OP,set_Prop,comp_grid,options);
6868
6969@time (x,log_PARSDMM) = PARSDMM(vec(m_tensor),AtA,TD_OP,set_Prop,P_sub,comp_grid,options);
7070@time (x,log_PARSDMM) = PARSDMM(vec(m_tensor),AtA,TD_OP,set_Prop,P_sub,comp_grid,options);
7171
72- m_proj = reshape(x,comp_grid. n)
72+ m_proj = reshape(x,comp_grid. n);
7373
7474figure();
7575for i= 1 : comp_grid. n[3 ]
8383# ####### (anisotropic) total-variation on the time-derivative ########
8484# ####### using JOLI operators ########
8585
86- options = PARSDMM_options()
86+ options = PARSDMM_options();
8787
8888# TV operator per time-slice
89- (TV, AtA_diag, dense, TD_n) = get_TD_operator(comp_grid_time_slice," TV" ,options. FL)
89+ (TV, AtA_diag, dense, TD_n) = get_TD_operator(comp_grid_time_slice," TV" ,options. FL);
9090# time derivative over the time-slices
91- (D, AtA_diag, dense, TD_n) = get_TD_operator(comp_grid," D_z" ,options. FL)
91+ (D, AtA_diag, dense, TD_n) = get_TD_operator(comp_grid," D_z" ,options. FL);
9292
93- CustomOP_explicit_sparse = kron(TV, SparseMatrixCSC{TF}(LinearAlgebra. I, comp_grid. n[3 ]- 1 ,comp_grid. n[3 ]- 1 ))* D
93+ CustomOP_explicit_sparse = kron(TV, SparseMatrixCSC{TF}(LinearAlgebra. I, comp_grid. n[3 ]- 1 ,comp_grid. n[3 ]- 1 ))* D;
9494
95- D = joMatrix(D)
96- TV = joMatrix(TV)
97- CustomOP_JOLI = joKron(TV, joEye(comp_grid. n[3 ]- 1 ,DDT= Float32,RDT= Float32))* D
95+ D = joMatrix(D);
96+ TV = joMatrix(TV);
97+ CustomOP_JOLI = joKron(TV, joEye(comp_grid. n[3 ]- 1 ,DDT= Float32,RDT= Float32))* D;
9898
9999# # Solve using JOLI ##
100100
101101 # initialize constraints
102- constraint = Vector{SetIntersectionProjection. set_definitions}()
102+ constraint = Vector{SetIntersectionProjection. set_definitions}();
103103
104104 m_min = 0.0
105105 m_max = 0.1 * norm(CustomOP_JOLI* vec(m_tensor),1 )
@@ -122,25 +122,25 @@ CustomOP_JOLI = joKron(TV, joEye(comp_grid.n[3]-1,DDT=Float32,RDT=Float32))* D
122122 @time (x_joli,log_PARSDMM) = PARSDMM(vec(m_tensor),AtA,TD_OP,set_Prop,P_sub,comp_grid,options);
123123
124124# # solve using explicit sparse array ##
125- constraint = Vector{SetIntersectionProjection. set_definitions}()
125+ constraint = Vector{SetIntersectionProjection. set_definitions}();
126126
127127 m_min = 0.0
128128 m_max = 0.025 * norm(CustomOP_explicit_sparse* vec(m_tensor),1 )
129129 set_type = " l1"
130130 TD_OP = " identity"
131131 app_mode = (" matrix" ," " )
132132 custom_TD_OP = (CustomOP_explicit_sparse,false )
133- push!(constraint, set_definitions(set_type,TD_OP,m_min,m_max,app_mode,custom_TD_OP))
133+ push!(constraint, set_definitions(set_type,TD_OP,m_min,m_max,app_mode,custom_TD_OP));
134134
135135 options= PARSDMM_options()
136- (P_sub,TD_OP,set_Prop) = setup_constraints(constraint,comp_grid,options. FL)
136+ (P_sub,TD_OP,set_Prop) = setup_constraints(constraint,comp_grid,options. FL);
137137
138138 # set properties of custom operator
139139 set_Prop. AtA_diag[1 ] = false
140140 set_Prop. dense[1 ] = false
141141 set_Prop. banded[1 ] = true
142142
143- (TD_OP,AtA,l,y) = PARSDMM_precompute_distribute(TD_OP,set_Prop,comp_grid,options)
143+ (TD_OP,AtA,l,y) = PARSDMM_precompute_distribute(TD_OP,set_Prop,comp_grid,options);
144144
145145 @time (x_sp,log_PARSDMM) = PARSDMM(vec(m_tensor),AtA,TD_OP,set_Prop,P_sub,comp_grid,options);
146146 @time (x_sp,log_PARSDMM) = PARSDMM(vec(m_tensor),AtA,TD_OP,set_Prop,P_sub,comp_grid,options);
0 commit comments