Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
group-connectivity-pub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
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
Radek Hušek
group-connectivity-pub
Commits
21e5f5db
Commit
21e5f5db
authored
9 years ago
by
Radek Hušek
Committed by
Radek Hušek
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add compile time option SAVE_MEMORY
parent
df13f946
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
compileTimeOptions.h
+11
-0
11 additions, 0 deletions
compileTimeOptions.h
group-connectivity.h
+21
-4
21 additions, 4 deletions
group-connectivity.h
with
33 additions
and
5 deletions
Makefile
+
1
−
1
View file @
21e5f5db
default
:
groupConnectivity.so clean_obj
default
:
groupConnectivity.so clean_obj
groupConnectivity.so
:
groupConnectivity.pyx group-connectivity.h setup.py
groupConnectivity.so
:
groupConnectivity.pyx group-connectivity.h setup.py
compileTimeOptions.h
python setup.py build_ext
python setup.py build_ext
cp
build/lib
*
/groupConnectivity.so .
cp
build/lib
*
/groupConnectivity.so .
...
...
This diff is collapsed.
Click to expand it.
compileTimeOptions.h
0 → 100644
+
11
−
0
View file @
21e5f5db
#ifndef __COMPILE_TIME_OPTIONS_H__
#define __COMPILE_TIME_OPTIONS_H__
// bool; use vector<bool> instead of vector<size_t> for classes
#ifndef SAVE_MEMORY
#define SAVE_MEMORY 0
#endif
#endif
This diff is collapsed.
Click to expand it.
group-connectivity.h
+
21
−
4
View file @
21e5f5db
#ifndef __GROUP_CONNECTIVITY_H__
#ifndef __GROUP_CONNECTIVITY_H__
#define __GROUP_CONNECTIVITY_H__
#define __GROUP_CONNECTIVITY_H__
#include
"compileTimeOptions.h"
namespace
Ring
{
namespace
Ring
{
#define MakeRing(Name, Size, Plus, Negate, Multiply, One) \
#define MakeRing(Name, Size, Plus, Negate, Multiply, One) \
...
@@ -24,7 +26,12 @@ MakeRing(Z2_2, 4, a^b, a, a&b, 3);
...
@@ -24,7 +26,12 @@ MakeRing(Z2_2, 4, a^b, a, a&b, 3);
struct
AbstractTester
{
struct
AbstractTester
{
bool
isConnected
;
bool
isConnected
;
std
::
vector
<
size_t
>
classes
;
#if SAVE_MEMORY
typedef
std
::
vector
<
bool
>
ClassesType
;
#else
typedef
std
::
vector
<
size_t
>
ClassesType
;
#endif
ClassesType
classes
;
typedef
int
EdgeId
;
typedef
int
EdgeId
;
typedef
int
DirectedEdgeId
;
typedef
int
DirectedEdgeId
;
...
@@ -75,7 +82,7 @@ struct Tester : public AbstractTester {
...
@@ -75,7 +82,7 @@ struct Tester : public AbstractTester {
size_t
num_classes
=
1
;
size_t
num_classes
=
1
;
edges_
=
spanningTree
.
size
();
edges_
=
spanningTree
.
size
();
while
(
edges_
--
>
0
)
num_classes
*=
Ring
::
size
;
while
(
edges_
--
>
0
)
num_classes
*=
Ring
::
size
;
std
::
vector
<
size_t
>
C
(
num_classes
,
0
);
ClassesType
C
(
num_classes
,
0
);
C
.
swap
(
classes
);
C
.
swap
(
classes
);
for
(
auto
e
:
spanningTree
)
for
(
auto
e
:
spanningTree
)
...
@@ -127,7 +134,13 @@ struct Tester : public AbstractTester {
...
@@ -127,7 +134,13 @@ struct Tester : public AbstractTester {
virtual
std
::
vector
<
size_t
>
getClasses
()
{
virtual
std
::
vector
<
size_t
>
getClasses
()
{
#if SAVE_MEMORY
std
::
vector
<
size_t
>
ret
(
classes
.
size
());
for
(
size_t
i
=
0
;
i
<
classes
.
size
();
i
++
)
ret
[
i
]
=
classes
[
i
];
return
ret
;
#else
return
classes
;
return
classes
;
#endif
}
}
...
@@ -135,9 +148,13 @@ struct Tester : public AbstractTester {
...
@@ -135,9 +148,13 @@ struct Tester : public AbstractTester {
Mapping
forb
(
edges
,
0
);
Mapping
forb
(
edges
,
0
);
for
(
size_t
i
=
0
;
i
<
numForb
;
i
++
)
for
(
size_t
i
=
0
;
i
<
numForb
;
i
++
)
#if SAVE_MEMORY
classes
[
pack
(
cannonize
(
unpack
(
i
,
forb
)))]
=
true
;
#else
classes
[
pack
(
cannonize
(
unpack
(
i
,
forb
)))]
++
;
classes
[
pack
(
cannonize
(
unpack
(
i
,
forb
)))]
++
;
#endif
for
(
auto
&
c
:
classes
)
if
(
!
c
)
return
(
isConnected
=
false
);
for
(
const
auto
&
c
:
classes
)
if
(
!
c
)
return
(
isConnected
=
false
);
return
(
isConnected
=
true
);
return
(
isConnected
=
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