Commit e5c0c047 authored by Conor McCoid's avatar Conor McCoid
Browse files

Tetra: first version of Unfold

parent 9465e435
......@@ -23,7 +23,7 @@ T_new=T; T_new(y)=1; J_new=zeros(n,m_max); H_new=zeros(n,m_max);
for i=1:m-1
for j=i+1:m
if sign(H(y,i))~=sign(H(y,j))
if sum(xor(J(:,i),J(:,j)))==2
if nnz(xor(J(:,i),J(:,j)))==2
% calculate intersection
m_new=m_new+1;
J_new(:,m_new)=J(:,i) | J(:,j);
......
function results = SUB_simplices_Unfold_v1_20211214(inputs)
function [H_new,J_new,T_new] = SUB_simplices_Unfold_v1_20211214(H_all,J_all,T_all,X)
% UNFOLD marches through combinations of hyperplane intersections
% [H_new,J_new,T_new]=Unfold(H_all,J_all,T_all) computes the new set of
% intersections H_new with indices of X J_new and indices of Y T_new.
% H_all - set of all intersections calculated from the previous step,
% arranged in a cell array where each cell has a specific set of
% indices of Y associated with it;
% J_all - indices relating to vertices of X for each intersection in
% H_all;
% T_all - indices relating to hyperplanes of Y for the given set of
% intersections in H_all;
% This first version will feature a brute-force method that (hopefully)
% does not go over the same combination of hyperplanes twice.
% Things to improve in version 2:
% - if a combination of hyperplanes, esp. a single hyperplane, had no
% intersections then it should be excluded from future combinations;
% - is there not a faster/less involved way to remove dupliate
% combinations?
T=T_all{1}; n=length(T); d=nnz(T); m_max=nchoosek(n,d);
H_new=cell(m_max,1); J_new=H_new; T_new=H_new; m_new=0;
while ~isempty(H_all)
H=H_all{1}; J=J_all{1}; T=T_all{1};
indy=1:n; indy=indy(T==0);
for y=indy
m_new=m_new+1; % how many new hyperplane combos have we computed?
[H_new{m_new},J_new{m_new},T_new{m_new}]=SUB_simplices_Orphan_v2_20211214(H,J,T,y,X);
end
m=length(T_all); indT=zeros(m,1);
for i=1:m
if nnz(T_all{i}-T)<=2
indT(i)=1; % which hyperplane combos are nearby?
end
end
H_all=H_all(indT==0); J_all=J_all(indT==0); T_all=T_all(indT==0); % remove hyperplane combinations already completed in this iteration
end
H_new=H_new{1:m_new}; J_new=J_new{1:m_new}; T_new=T_new{1:m_new};
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment