Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
algpath
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Numerical algebraic geometry
algpath
Commits
74b18257
Commit
74b18257
authored
2 months ago
by
GUILLEMOT Alexandre
Browse files
Options
Downloads
Patches
Plain Diff
remove paths as a generic type for the trait sep
parent
4d897ef9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sep.rs
+40
-40
40 additions, 40 deletions
src/sep.rs
with
40 additions
and
40 deletions
src/sep.rs
+
40
−
40
View file @
74b18257
...
@@ -57,21 +57,23 @@ impl Symbol {
...
@@ -57,21 +57,23 @@ impl Symbol {
}
}
}
}
pub
trait
Sep
<
Paths
,
R
>
{
pub
trait
Sep
<
R
>
{
fn
sep
(
&
self
,
paths
:
&
Paths
,
i
:
usize
,
j
:
usize
,
t
:
&
R
)
->
Result
<
(
Symbol
,
R
)
>
;
fn
sep
(
&
self
,
i
:
usize
,
j
:
usize
,
t
:
&
R
)
->
Result
<
(
Symbol
,
R
)
>
;
}
}
pub
struct
TrackOutputSeperator
<
CtxT
>
{
pub
struct
TrackOutputSeperator
<
'a
,
CtxT
,
R
,
VecTm
,
MatC
>
{
types
:
PhantomData
<
CtxT
>
,
types
:
PhantomData
<
CtxT
>
,
pub
path
:
&
'a
Vec
<
Vec
<
MooreBox
<
R
,
VecTm
,
MatC
>>>
,
pub
indices
:
Vec
<
usize
>
,
pub
indices
:
Vec
<
usize
>
,
pub
projection
:
usize
,
pub
projection
:
usize
,
}
}
impl
<
CtxT
>
TrackOutputSeperator
<
CtxT
>
{
impl
<
'a
,
CtxT
,
R
,
VecTm
,
MatC
>
TrackOutputSeperator
<
'a
,
CtxT
,
R
,
VecTm
,
MatC
>
{
pub
fn
new
(
nstrands
:
usize
,
projection
:
usize
)
->
Self
{
pub
fn
new
(
projection
:
usize
,
path
:
&
'a
Vec
<
Vec
<
MooreBox
<
R
,
VecTm
,
MatC
>>>
)
->
Self
{
Self
{
Self
{
types
:
PhantomData
,
types
:
PhantomData
,
indices
:
(
0
..
nstrands
)
.map
(|
_
|
0
)
.collect
(),
path
,
indices
:
(
0
..
path
.len
())
.map
(|
_
|
0
)
.collect
(),
projection
:
projection
,
projection
:
projection
,
}
}
}
}
...
@@ -155,7 +157,7 @@ impl PartialOrd for Arb {
...
@@ -155,7 +157,7 @@ impl PartialOrd for Arb {
}
}
}
}
impl
<
R
,
VecTm
,
MatC
,
CtxT
>
Sep
<
Vec
<
Vec
<
MooreBox
<
R
,
VecTm
,
MatC
>
>>
,
R
>
for
TrackOutputSeperator
<
CtxT
>
impl
<
'a
,
CtxT
,
R
,
VecTm
,
MatC
>
Sep
<
R
>
for
TrackOutputSeperator
<
'a
,
CtxT
,
R
,
VecTm
,
MatC
>
where
where
R
:
Clone
+
RealInterval
+
IntervalComparisons
+
One
+
Debug
+
From
<
f64
>
+
Zero
,
R
:
Clone
+
RealInterval
+
IntervalComparisons
+
One
+
Debug
+
From
<
f64
>
+
Zero
,
for
<
'l
,
'r
>
&
'l
R
:
PartialOrd
+
Sub
<&
'r
R
,
Output
=
R
>
+
Add
<
R
,
Output
=
R
>
,
for
<
'l
,
'r
>
&
'l
R
:
PartialOrd
+
Sub
<&
'r
R
,
Output
=
R
>
+
Add
<
R
,
Output
=
R
>
,
...
@@ -170,11 +172,11 @@ where
...
@@ -170,11 +172,11 @@ where
+
Debug
,
+
Debug
,
CtxT
:
PrecCtx
,
CtxT
:
PrecCtx
,
{
{
fn
sep
(
&
self
,
paths
:
&
Vec
<
Vec
<
MooreBox
<
R
,
VecTm
,
MatC
>>>
,
i
:
usize
,
j
:
usize
,
t
:
&
R
)
->
Result
<
(
Symbol
,
R
)
>
{
fn
sep
(
&
self
,
i
:
usize
,
j
:
usize
,
t
:
&
R
)
->
Result
<
(
Symbol
,
R
)
>
{
type
C
<
VecTm
>
=
<<
VecTm
as
TaylorModel
>
::
Coeffs
as
Vector
>
::
T
;
type
C
<
VecTm
>
=
<<
VecTm
as
TaylorModel
>
::
Coeffs
as
Vector
>
::
T
;
let
(
k_i
,
t_i
)
=
search_next_interval
(
self
.indices
[
i
],
&
path
s
[
i
],
t
);
let
(
k_i
,
t_i
)
=
search_next_interval
(
self
.indices
[
i
],
&
self
.
path
[
i
],
t
);
let
(
k_j
,
t_j
)
=
search_next_interval
(
self
.indices
[
j
],
&
path
s
[
j
],
t
);
let
(
k_j
,
t_j
)
=
search_next_interval
(
self
.indices
[
j
],
&
self
.
path
[
j
],
t
);
//TODO: manage indices in the separator struct
//TODO: manage indices in the separator struct
let
t_res
=
if
&
t_i
<
&
t_j
{
t_i
}
else
{
t_j
};
let
t_res
=
if
&
t_i
<
&
t_j
{
t_i
}
else
{
t_j
};
...
@@ -193,21 +195,21 @@ where
...
@@ -193,21 +195,21 @@ where
bail!
(
"step size is {} which looks ridiculously small"
,
auxi
.diam
());
bail!
(
"step size is {} which looks ridiculously small"
,
auxi
.diam
());
}
}
let
interval_i
=
&
auxi
-
&
path
s
[
i
][
k_i
]
.params
;
let
interval_i
=
&
auxi
-
&
self
.
path
[
i
][
k_i
]
.params
;
let
interval_j
=
&
auxi
-
&
path
s
[
j
][
k_j
]
.params
;
let
interval_j
=
&
auxi
-
&
self
.
path
[
j
][
k_j
]
.params
;
let
enclosure_i
=
path
s
[
i
][
k_i
]
let
enclosure_i
=
self
.
path
[
i
][
k_i
]
.pt
.pt
.coord
.coord
.enclosure
(
&
interval_i
.intersection
(
&
path
s
[
i
][
k_i
]
.pt.coord
.domain
()))[
self
.projection
]
.enclosure
(
&
interval_i
.intersection
(
&
self
.
path
[
i
][
k_i
]
.pt.coord
.domain
()))[
self
.projection
]
.clone
()
.clone
()
+
C
::
<
VecTm
>
::
square
(
path
s
[
i
][
k_i
]
.rad
);
+
C
::
<
VecTm
>
::
square
(
self
.
path
[
i
][
k_i
]
.rad
);
let
enclosure_j
=
path
s
[
j
][
k_j
]
let
enclosure_j
=
self
.
path
[
j
][
k_j
]
.pt
.pt
.coord
.coord
.enclosure
(
&
interval_j
.intersection
(
&
path
s
[
j
][
k_j
]
.pt.coord
.domain
()))[
self
.projection
]
.enclosure
(
&
interval_j
.intersection
(
&
self
.
path
[
j
][
k_j
]
.pt.coord
.domain
()))[
self
.projection
]
.clone
()
.clone
()
+
C
::
<
VecTm
>
::
square
(
path
s
[
j
][
k_j
]
.rad
);
+
C
::
<
VecTm
>
::
square
(
self
.
path
[
j
][
k_j
]
.rad
);
if
enclosure_i
.real
()
.interval_lt
(
&
enclosure_j
.real
())
{
if
enclosure_i
.real
()
.interval_lt
(
&
enclosure_j
.real
())
{
return
Ok
((
Symbol
::
RealLower
,
t_res
));
return
Ok
((
Symbol
::
RealLower
,
t_res
));
...
@@ -244,10 +246,8 @@ pub mod tests {
...
@@ -244,10 +246,8 @@ pub mod tests {
#[test]
#[test]
fn
test_1
()
{
fn
test_1
()
{
let
path
=
PathBuf
::
from
(
let
path
=
"/home/aguillem/documents/travail/these/numerical_algebraic_geometry/braids/code/braid_group
PathBuf
::
from
(
"/home/aguillem/documents/travail/these/numerical_algebraic_geometry/braids/code/braid_group/tmp.json"
);
/tmp.json"
,
);
let
mut
conf
=
crate
::
cli
::
Configuration
{
let
mut
conf
=
crate
::
cli
::
Configuration
{
path
:
Some
(
path
),
path
:
Some
(
path
),
..
Default
::
default
()
..
Default
::
default
()
...
@@ -261,13 +261,13 @@ pub mod tests {
...
@@ -261,13 +261,13 @@ pub mod tests {
let
j
=
1
;
let
j
=
1
;
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
reckless
);
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
reckless
);
let
separator
:
TrackOutputSeperator
<
FixedPrecCtx
>
=
TrackOutputSeperator
::
new
(
reds
.len
(),
0
);
let
separator
:
TrackOutputSeperator
<
'_
,
FixedPrecCtx
,
_
,
_
,
_
>
=
TrackOutputSeperator
::
new
(
0
,
&
reds
);
let
mut
t
=
Rif
::
from
(
0.04057978317160819
);
let
mut
t
=
Rif
::
from
(
0.04057978317160819
);
let
mut
s
;
let
mut
s
;
let
mut
cpt
=
0
;
let
mut
cpt
=
0
;
while
t
<
Rif
::
from
(
0.04443077070344210
)
{
while
t
<
Rif
::
from
(
0.04443077070344210
)
{
(
s
,
t
)
=
separator
.sep
(
&
reds
,
i
,
j
,
&
t
)
.unwrap
();
(
s
,
t
)
=
separator
.sep
(
i
,
j
,
&
t
)
.unwrap
();
dbg!
(
t
);
dbg!
(
t
);
dbg!
(
s
);
dbg!
(
s
);
cpt
+=
1
;
cpt
+=
1
;
...
@@ -292,13 +292,13 @@ pub mod tests {
...
@@ -292,13 +292,13 @@ pub mod tests {
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
reckless
);
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
reckless
);
let
mut
rng
=
rand
::
rng
();
let
mut
rng
=
rand
::
rng
();
let
separator
:
TrackOutputSeperator
<
FixedPrecCtx
>
=
TrackOutputSeperator
::
new
(
reds
.len
(),
0
);
let
separator
:
TrackOutputSeperator
<
'_
,
FixedPrecCtx
,
_
,
_
,
_
>
=
TrackOutputSeperator
::
new
(
0
,
&
reds
);
for
i
in
0
..
reds
.len
()
{
for
i
in
0
..
reds
.len
()
{
for
j
in
0
..
i
{
for
j
in
0
..
i
{
for
_
in
0
..
10
{
for
_
in
0
..
10
{
let
t
=
Rif
::
from
(
rng
.random
::
<
f64
>
());
let
t
=
Rif
::
from
(
rng
.random
::
<
f64
>
());
assert!
(
&
t
<=
&
separator
.sep
(
&
reds
,
i
,
j
,
&
t
)
.unwrap
()
.1
);
assert!
(
&
t
<=
&
separator
.sep
(
i
,
j
,
&
t
)
.unwrap
()
.1
);
}
}
}
}
}
}
...
@@ -318,13 +318,13 @@ pub mod tests {
...
@@ -318,13 +318,13 @@ pub mod tests {
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
reckless
);
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
reckless
);
let
mut
rng
=
rand
::
rng
();
let
mut
rng
=
rand
::
rng
();
let
separator
:
TrackOutputSeperator
<
FixedPrecCtx
>
=
TrackOutputSeperator
::
new
(
reds
.len
(),
0
);
let
separator
:
TrackOutputSeperator
<
'_
,
FixedPrecCtx
,
_
,
_
,
_
>
=
TrackOutputSeperator
::
new
(
0
,
&
reds
);
for
i
in
0
..
reds
.len
()
{
for
i
in
0
..
reds
.len
()
{
for
j
in
0
..
i
{
for
j
in
0
..
i
{
for
_
in
0
..
100
{
for
_
in
0
..
100
{
let
t
=
Rif
::
from
(
rng
.random
::
<
f64
>
());
let
t
=
Rif
::
from
(
rng
.random
::
<
f64
>
());
assert!
(
&
t
<=
&
separator
.sep
(
&
reds
,
i
,
j
,
&
t
)
.unwrap
()
.1
);
assert!
(
&
t
<=
&
separator
.sep
(
i
,
j
,
&
t
)
.unwrap
()
.1
);
}
}
}
}
}
}
...
@@ -344,13 +344,13 @@ pub mod tests {
...
@@ -344,13 +344,13 @@ pub mod tests {
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
arb
);
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
arb
);
let
mut
rng
=
rand
::
rng
();
let
mut
rng
=
rand
::
rng
();
let
separator
:
TrackOutputSeperator
<
AdaptivePrecCtx
>
=
TrackOutputSeperator
::
new
(
reds
.len
(),
0
);
let
separator
:
TrackOutputSeperator
<
'_
,
AdaptivePrecCtx
,
_
,
_
,
_
>
=
TrackOutputSeperator
::
new
(
0
,
&
reds
);
for
i
in
0
..
reds
.len
()
{
for
i
in
0
..
reds
.len
()
{
for
j
in
0
..
i
{
for
j
in
0
..
i
{
for
_
in
0
..
100
{
for
_
in
0
..
100
{
let
t
=
Arb
::
from
(
rng
.random
::
<
f64
>
());
let
t
=
Arb
::
from
(
rng
.random
::
<
f64
>
());
assert!
(
&
t
<=
&
separator
.sep
(
&
reds
,
i
,
j
,
&
t
)
.unwrap
()
.1
);
assert!
(
&
t
<=
&
separator
.sep
(
i
,
j
,
&
t
)
.unwrap
()
.1
);
}
}
}
}
}
}
...
@@ -358,7 +358,7 @@ pub mod tests {
...
@@ -358,7 +358,7 @@ pub mod tests {
#[test]
#[test]
fn
test_5
()
{
fn
test_5
()
{
let
path
=
PathBuf
::
from
(
"
data
/tmp.json"
);
let
path
=
PathBuf
::
from
(
"
/home/aguillem/documents/travail/these/numerical_algebraic_geometry/braids/code/braid_group
/tmp.json"
);
let
mut
conf
=
crate
::
cli
::
Configuration
{
let
mut
conf
=
crate
::
cli
::
Configuration
{
path
:
Some
(
path
),
path
:
Some
(
path
),
..
Default
::
default
()
..
Default
::
default
()
...
@@ -372,13 +372,13 @@ pub mod tests {
...
@@ -372,13 +372,13 @@ pub mod tests {
let
j
=
4
;
let
j
=
4
;
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
arb
);
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
arb
);
let
separator
:
TrackOutputSeperator
<
AdaptivePrecCtx
>
=
TrackOutputSeperator
::
new
(
reds
.len
(),
0
);
let
separator
:
TrackOutputSeperator
<
'_
,
AdaptivePrecCtx
,
_
,
_
,
_
>
=
TrackOutputSeperator
::
new
(
0
,
&
reds
);
let
mut
t
=
Arb
::
from
(
0.0
);
let
mut
t
=
Arb
::
from
(
0.0
);
let
mut
s
;
let
mut
s
;
let
mut
cpt
=
0
;
let
mut
cpt
=
0
;
while
t
<
Arb
::
from
(
1.0
)
{
while
t
<
Arb
::
from
(
1.0
)
{
(
s
,
t
)
=
separator
.sep
(
&
reds
,
i
,
j
,
&
t
)
.unwrap
();
(
s
,
t
)
=
separator
.sep
(
i
,
j
,
&
t
)
.unwrap
();
dbg!
(
&
t
);
dbg!
(
&
t
);
dbg!
(
&
s
);
dbg!
(
&
s
);
cpt
+=
1
;
cpt
+=
1
;
...
@@ -389,7 +389,7 @@ pub mod tests {
...
@@ -389,7 +389,7 @@ pub mod tests {
dbg!
(
reds
[
j
]
.len
());
dbg!
(
reds
[
j
]
.len
());
}
}
#[test]
//
#[test]
fn
test_6
()
{
fn
test_6
()
{
let
path
=
PathBuf
::
from
(
"data/1000_1.json"
);
let
path
=
PathBuf
::
from
(
"data/1000_1.json"
);
let
mut
conf
=
crate
::
cli
::
Configuration
{
let
mut
conf
=
crate
::
cli
::
Configuration
{
...
@@ -405,13 +405,13 @@ pub mod tests {
...
@@ -405,13 +405,13 @@ pub mod tests {
let
j
=
415
;
let
j
=
415
;
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
legacy_arb_reckless
);
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
legacy_arb_reckless
);
let
separator
:
TrackOutputSeperator
<
AdaptivePrecCtx
>
=
TrackOutputSeperator
::
new
(
reds
.len
(),
0
);
let
separator
:
TrackOutputSeperator
<
'_
,
AdaptivePrecCtx
,
_
,
_
,
_
>
=
TrackOutputSeperator
::
new
(
0
,
&
reds
);
let
mut
t
=
Arb
::
zero
();
let
mut
t
=
Arb
::
zero
();
let
mut
s
;
let
mut
s
;
let
mut
cpt
=
0
;
let
mut
cpt
=
0
;
while
&
t
<
&
Arb
::
one
()
{
while
&
t
<
&
Arb
::
one
()
{
(
s
,
t
)
=
separator
.sep
(
&
reds
,
i
,
j
,
&
t
)
.unwrap
();
(
s
,
t
)
=
separator
.sep
(
i
,
j
,
&
t
)
.unwrap
();
dbg!
(
&
t
);
dbg!
(
&
t
);
dbg!
(
&
s
);
dbg!
(
&
s
);
cpt
+=
1
;
cpt
+=
1
;
...
@@ -436,12 +436,12 @@ pub mod tests {
...
@@ -436,12 +436,12 @@ pub mod tests {
conf
.arithmetic
=
Arithmetic
::
Reckless
;
conf
.arithmetic
=
Arithmetic
::
Reckless
;
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
reckless
);
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
reckless
);
let
separator
:
TrackOutputSeperator
<
FixedPrecCtx
>
=
TrackOutputSeperator
::
new
(
reds
.len
(),
0
);
let
separator
:
TrackOutputSeperator
<
'_
,
FixedPrecCtx
,
_
,
_
,
_
>
=
TrackOutputSeperator
::
new
(
0
,
&
reds
);
let
i
=
3
;
let
i
=
3
;
let
j
=
1
;
let
j
=
1
;
let
t
=
Rif
::
from
(
0.009330666825934752
);
let
t
=
Rif
::
from
(
0.009330666825934752
);
assert!
(
separator
.sep
(
&
reds
,
i
,
j
,
&
t
)
.is_err_and
(|
e
|
{
assert!
(
separator
.sep
(
i
,
j
,
&
t
)
.is_err_and
(|
e
|
{
println!
(
"{}"
,
e
);
println!
(
"{}"
,
e
);
true
true
}));
}));
...
@@ -461,13 +461,13 @@ pub mod tests {
...
@@ -461,13 +461,13 @@ pub mod tests {
conf
.arithmetic
=
Arithmetic
::
Arb
;
conf
.arithmetic
=
Arithmetic
::
Arb
;
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
arb
);
let
reds
=
track_from_conf_and_arith!
(
&
conf
,
arb
);
let
separator
:
TrackOutputSeperator
<
AdaptivePrecCtx
>
=
TrackOutputSeperator
::
new
(
reds
.len
(),
0
);
let
separator
:
TrackOutputSeperator
<
'_
,
FixedPrecCtx
,
_
,
_
,
_
>
=
TrackOutputSeperator
::
new
(
0
,
&
reds
);
let
i
=
3
;
let
i
=
3
;
let
j
=
1
;
let
j
=
1
;
let
t
=
Arb
::
from
(
0.009330666825934752
);
let
t
=
Arb
::
from
(
0.009330666825934752
);
assert!
(
separator
.sep
(
&
reds
,
i
,
j
,
&
t
)
.is_err_and
(|
e
|
{
assert!
(
separator
.sep
(
i
,
j
,
&
t
)
.is_err_and
(|
e
|
{
println!
(
"{}"
,
e
);
println!
(
"{}"
,
e
);
true
true
}));
}));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment