Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Conor Joseph Mccoid
UNIGE
Commits
93b1cb81
Commit
93b1cb81
authored
Dec 17, 2021
by
Conor McCoid
Browse files
Tetra: algo v1 for higher dim
parent
4961681e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Research/Edge Intersection/Tetrahedra/Higher dimensions/ALGO_simplices_IntersectSimplices_v1_20211216.m
View file @
93b1cb81
...
...
@@ -29,10 +29,11 @@ S=prod(S);
Z
=
U
(:,
S
==
1
);
%--Intersections--%
D
=
zeros
(
2
^
n
,
2
^
(
n
+
1
));
% storage for determinants
H
=
cell
(
1
);
J
=
H
;
T
=
H
;
H
{
1
}
=
X
;
J
{
1
}
=
eye
(
n
);
T
{
1
}
=
zeros
(
n
,
1
);
for
i
=
1
:
n
-
1
[
H
,
J
,
T
]
=
SUB_simplices_Unfold_v1_20211214
(
H
,
J
,
T
,
X
);
[
H
,
J
,
T
]
=
SUB_simplices_Unfold_v1_20211214
(
H
,
J
,
T
,
X
,
D
);
if
isempty
(
H
)
% if no intersections are calculated for a given step then there are no more intersections to be found
return
end
...
...
Research/Edge Intersection/Tetrahedra/Higher dimensions/SUB_simplices_IntersectHyperplane_v1_20211217.m
0 → 100644
View file @
93b1cb81
function
[
h
,
D
]
=
SUB_simplices_IntersectHyperplane_v1_20211217
(
D
,
J
,
T
,
X
)
% INTERSECTHYPERPLANE computes the intersection of an m-face of X and a
% collection of hyperplanes of Y
% Uses Cramer's rule with a look-up table to find determinants indexed by J
% and T
%--Initialize outputs--%
n
=
length
(
T
);
m
=
nnz
(
T
)
+
1
;
h
=
zeros
(
n
,
1
);
%--Determine which coordinates of the intersection are needed--%
indT
=
1
:
n
;
indT
=
indT
(
T
==
0
);
%--Denominator is the same for all--%
j
=
bit2int
(
J
,
n
);
k1
=
bit2int
([
1
;
T
],
n
+
1
);
if
D
(
j
,
k1
)
==
0
D
(
j
,
k1
)
=
det
([
ones
(
m
,
1
),
X
(
J
==
1
,
T
==
1
)]);
% could also be calculated with other entries of D now that they're indexed with binary
end
for
i
=
indT
%--Convert T with i to coordinates of D--%
T_new
=
T
;
T_new
(
i
)
=
1
;
k
=
bit2int
([
0
;
T_new
],
n
+
1
);
if
D
(
j
,
k
)
==
0
D
(
j
,
k
)
=
det
(
X
(
J
==
1
,
T_new
==
1
));
end
h
(
i
)
=
(
-
1
)
^
(
i
-
1
)
*
D
(
j
,
k
)/
D
(
j
,
k1
);
% need to multiply by a sign to indicate column swaps between num and denom
end
\ No newline at end of file
Research/Edge Intersection/Tetrahedra/Higher dimensions/SUB_simplices_Orphan_v2_20211214.m
View file @
93b1cb81
function
[
H_new
,
J_new
,
T_new
]
=
SUB_simplices_Orphan_v2_20211214
(
H
,
J
,
T
,
y
,
X
)
function
[
H_new
,
J_new
,
T_new
,
D
]
=
SUB_simplices_Orphan_v2_20211214
(
H
,
J
,
T
,
y
,
D
,
X
)
% ORPHAN determines adjacent intersections and generates index set
% [H_new,J_new,T_new] = Orphan(H,J,T,A,y,X) finds all intersections
% H_new between the n-simplex X and the hyperplanes indexed by T and y.
...
...
@@ -27,7 +27,7 @@ for i=1:m-1
% calculate intersection
m_new
=
m_new
+
1
;
J_new
(:,
m_new
)
=
J
(:,
i
)
|
J
(:,
j
);
%
H_new(:,m_new)=SUB_simplices_Intersect
ion_v1_?(X
,J_new(:,m_new),T_new);
[
H_new
(:,
m_new
)
,
D
]
=
SUB_simplices_Intersect
Hyperplane_v1_20211217
(
D
,
J_new
(:,
m_new
),
T_new
,
X
);
end
end
end
...
...
Research/Edge Intersection/Tetrahedra/Higher dimensions/SUB_simplices_Unfold_v1_20211214.m
View file @
93b1cb81
function
[
H_new
,
J_new
,
T_new
]
=
SUB_simplices_Unfold_v1_20211214
(
H_all
,
J_all
,
T_all
,
X
)
function
[
H_new
,
J_new
,
T_new
]
=
SUB_simplices_Unfold_v1_20211214
(
H_all
,
J_all
,
T_all
,
X
,
D
)
% 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.
...
...
@@ -22,12 +22,13 @@ function [H_new,J_new,T_new] = SUB_simplices_Unfold_v1_20211214(H_all,J_all,T_al
T
=
T_all
{
1
};
n
=
length
(
T
);
d
=
nnz
(
T
)
+
1
;
m_max
=
nchoosek
(
n
,
d
);
H_new
=
cell
(
m_max
,
1
);
J_new
=
H_new
;
T_new
=
H_new
;
m_new
=
0
;
% D=zeros(m_max,nchoosek(n+1,d)); % possibly a faster way to get second input from first
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
);
[
H_new
{
m_new
},
J_new
{
m_new
},
T_new
{
m_new
}
,
D
]
=
SUB_simplices_Orphan_v2_20211214
(
H
,
J
,
T
,
y
,
D
,
X
);
end
m
=
length
(
T_all
);
indT
=
zeros
(
m
,
1
);
for
i
=
1
:
m
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment