Skip to content

Commit 46284fb

Browse files
committed
Add conv code
1 parent e61ed29 commit 46284fb

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

WorkSpace/AlexP/GR_2_Electric_Boogaloo.m

+33-1
Original file line numberDiff line numberDiff line change
@@ -273,4 +273,36 @@
273273
makeGRPlots(combinedGRModel,GR_a_pars)
274274

275275
save('EricModelGR_MMDex','GR_a_pars','combinedGRModel','MHResultsGR')
276-
save('workspaceDec9_2024.mat', 'GR_a_pars', 'GR_b_pars', 'ModelGR_a_fit', 'ModelGR_b_fit', 'combinedGRModel','MHResultsGR', 'log10PriorStd')
276+
save('workspaceDec9_2024.mat', 'GR_a_pars', 'GR_b_pars', 'ModelGR_a_fit', 'ModelGR_b_fit', 'combinedGRModel','MHResultsGR', 'log10PriorStd')
277+
278+
%% Convolution
279+
280+
for fsp = 1:size(FSP_GR_a_Soln.fsp,1)
281+
a = FSP_GR_a_Soln.fsp{i}.p.data;
282+
end
283+
284+
for fsp = 1:size(FSP_GR_b_Soln.fsp,1)
285+
b = FSP_GR_b_Soln.fsp{i}.p.data;
286+
end
287+
288+
a_dims = size(a); % Get the size of the sptensor as a vector
289+
a_nrows = a_dims(1); % Number of rows
290+
a_ncols = a_dims(2); % Number of columns
291+
292+
% Linearize the sparse tensor into a vector
293+
a_linear_indices = sub2ind([a_nrows, a_ncols], a.subs(:,1), a.subs(:,2)); % Convert subscripts to linear indices
294+
a_vector = zeros(a_nrows * a_ncols, 1); % Initialize a zero vector
295+
a_vector(a_linear_indices) = a.vals; % Assign the nonzero values to their correct positions
296+
aa = a_vector;
297+
298+
b_dims = size(b); % Get the size of the sptensor as a vector
299+
b_nrows = dims(1); % Number of rows
300+
b_ncols = dims(2); % Number of columns
301+
302+
% Linearize the sparse tensor into a vector
303+
b_linear_indices = sub2ind([b_nrows, b_ncols], b.subs(:,1), b.subs(:,2)); % Convert subscripts to linear indices
304+
b_vector = zeros(nrows * ncols, 1); % Initialize a zero vector
305+
b_vector(b_linear_indices) = b.vals; % Assign the nonzero values to their correct positions
306+
bb = b_vector;
307+
308+
Pz = conv(a_vector,b_vector);

0 commit comments

Comments
 (0)