Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
islpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Kaushik Kulkarni
islpy
Commits
7c6a0c16
Commit
7c6a0c16
authored
9 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Plain Diff
Merge bodge:src/islpy
parents
69022fcd
9183f686
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
islpy/__init__.py
+0
-120
0 additions, 120 deletions
islpy/__init__.py
with
0 additions
and
120 deletions
islpy/__init__.py
+
0
−
120
View file @
7c6a0c16
...
...
@@ -129,30 +129,6 @@ EXPR_CLASSES = tuple(cls for cls in ALL_CLASSES
if
"
Aff
"
in
cls
.
__name__
or
"
Polynomial
"
in
cls
.
__name__
)
def
_runs_in_integer_set
(
s
,
max_int
=
None
):
if
not
s
:
return
if
max_int
is
None
:
max_int
=
max
(
s
)
i
=
0
while
i
<
max_int
:
if
i
in
s
:
start
=
i
i
+=
1
while
i
<
max_int
and
i
in
s
:
i
+=
1
end
=
i
yield
(
start
,
end
-
start
)
else
:
i
+=
1
def
_add_functionality
():
# {{{ Context
...
...
@@ -1209,100 +1185,4 @@ def align_two(obj1, obj2, across_dim_types=False):
return
(
obj1
,
obj2
)
# {{{ performance tweak for dim_{min,max}: project first
class
TooManyInteractingDims
(
Exception
):
pass
def
_find_aff_dims
(
aff
,
dim_types_and_gen_dim_types
):
result
=
[]
for
dt
,
gen_dt
in
dim_types_and_gen_dim_types
:
for
i
in
range
(
aff
.
dim
(
dt
)):
if
not
aff
.
get_coefficient_val
(
dt
,
i
).
is_zero
():
result
.
append
((
gen_dt
,
i
))
result
=
set
(
result
)
for
i
in
range
(
aff
.
dim
(
dim_type
.
div
)):
result
.
update
(
_find_aff_dims
(
aff
.
get_div
(
i
)))
return
result
def
_transitive_closure
(
graph_dict
):
pass
def
_find_noninteracting_dims
(
obj
,
dt
,
idx
,
other_dt
,
stop_at
=
6
):
if
isinstance
(
obj
,
BasicSet
):
basics
=
[
obj
]
elif
isinstance
(
obj
,
Set
):
basics
=
obj
.
get_basic_sets
()
else
:
raise
TypeError
(
"
unsupported arg type
'
%s
'"
%
type
(
obj
))
connections
=
[]
for
bs
in
basics
:
for
c
in
bs
.
get_constraints
():
conn
=
_find_aff_dims
(
c
.
get_aff
(),
[(
dim_type
.
param
,
dim_type
.
param
),
(
dim_type
.
in_
,
dim_type
.
set
)])
if
len
(
conn
)
>
1
:
connections
.
append
(
conn
)
interacting
=
set
([(
dt
,
idx
)])
while
True
:
changed_something
=
False
# Compute the connected component near (dt, idx) by fixed point iteration
for
conn
in
connections
:
prev_len
=
len
(
interacting
)
overlap
=
interacting
&
conn
if
overlap
:
interacting
.
update
(
conn
)
if
len
(
interacting
)
!=
prev_len
:
changed_something
=
True
if
len
(
interacting
)
>=
stop_at
:
raise
TooManyInteractingDims
()
if
not
changed_something
:
break
return
set
(
range
(
obj
.
dim
(
other_dt
)))
-
set
(
idx
for
dt
,
idx
in
interacting
if
dt
==
other_dt
)
def
_eliminate_noninteracting
(
obj
,
dt
,
idx
,
other_dt
):
try
:
nonint
=
_find_noninteracting_dims
(
obj
,
dt
,
idx
,
other_dt
)
except
TooManyInteractingDims
:
return
obj
for
first
,
n
in
_runs_in_integer_set
(
nonint
):
obj
=
obj
.
eliminate
(
other_dt
,
first
,
n
)
return
obj
def
dim_min_with_elimination
(
obj
,
idx
):
obj_elim
=
_eliminate_noninteracting
(
obj
,
dim_type
.
out
,
idx
,
dim_type
.
param
)
return
obj_elim
.
dim_min
(
idx
)
def
dim_max_with_elimination
(
obj
,
idx
):
obj_elim
=
_eliminate_noninteracting
(
obj
,
dim_type
.
out
,
idx
,
dim_type
.
param
)
return
obj_elim
.
dim_max
(
idx
)
# }}}
# vim: foldmethod=marker
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