Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tinygb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
SPAENLEHAUER Pierre-Jean
tinygb
Commits
d562e20d
Commit
d562e20d
authored
Jul 21, 2020
by
SPAENLEHAUER Pierre-Jean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moving the definition of the function Compress
parent
ff2283d7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
37 deletions
+36
-37
src/matrices/rowmajmat.cc
src/matrices/rowmajmat.cc
+29
-0
src/matrices/rowmajmat.h
src/matrices/rowmajmat.h
+3
-0
src/rowech/rowech.cc
src/rowech/rowech.cc
+0
-29
src/tinygb_init/tinygb_init.cc
src/tinygb_init/tinygb_init.cc
+4
-8
No files found.
src/matrices/rowmajmat.cc
View file @
d562e20d
...
...
@@ -471,4 +471,33 @@ void ReadRowMajMat(std::shared_ptr<RowMajMat> *pR, const std::string& filename)
delete
[]
memblock_begin
;
}
void
Compress
(
std
::
shared_ptr
<
RowMajMat
>
D
,
std
::
shared_ptr
<
RowMajMat
>
B
,
std
::
list
<
std
::
size_t
>
&
pivots
)
{
assert
(
D
->
col_dec_
==
B
->
col_dec_
);
assert
(
!
B
->
col_dec_
.
empty
()
||
!
B
->
column_size
());
std
::
vector
<
Monomial
>
non_pivot_monomials
;
pivots
.
sort
();
std
::
list
<
std
::
size_t
>::
const_iterator
it
=
pivots
.
begin
();
for
(
std
::
size_t
i
=
0
;
i
<
B
->
col_dec_
.
size
();
++
i
)
if
((
i
!=
*
it
)
||
(
it
==
pivots
.
end
()))
non_pivot_monomials
.
push_back
(
B
->
col_dec_
[
i
]);
else
it
++
;
if
(
D
!=
nullptr
)
{
for
(
const
auto
&
it
:
pivots
)
D
->
row_dec_
.
push_back
(
D
->
col_dec_
[
it
]);
D
->
Compress
();
D
->
RemoveColumns
(
pivots
);
}
if
(
B
!=
nullptr
)
B
->
RemoveColumns
(
pivots
);
B
->
col_dec_
=
non_pivot_monomials
;
D
->
col_dec_
=
non_pivot_monomials
;
}
}
// namespace tinygb
src/matrices/rowmajmat.h
View file @
d562e20d
...
...
@@ -106,6 +106,9 @@ class RowMajMat {
void
WriteRowMajMat
(
const
RowMajMat
&
M
,
const
std
::
string
&
filename
);
void
ReadRowMajMat
(
std
::
shared_ptr
<
RowMajMat
>
*
pR
,
const
std
::
string
&
filename
);
void
Compress
(
std
::
shared_ptr
<
RowMajMat
>
D
,
std
::
shared_ptr
<
RowMajMat
>
B
,
std
::
list
<
std
::
size_t
>
&
pivots
);
}
// namespace tinygb
#endif
src/rowech/rowech.cc
View file @
d562e20d
...
...
@@ -9,35 +9,6 @@
namespace
tinygb
{
void
Compress
(
std
::
shared_ptr
<
RowMajMat
>
D
,
std
::
shared_ptr
<
RowMajMat
>
B
,
std
::
list
<
std
::
size_t
>
&
pivots
)
{
assert
(
D
->
col_dec_
==
B
->
col_dec_
);
assert
(
!
B
->
col_dec_
.
empty
()
||
!
B
->
column_size
());
std
::
vector
<
Monomial
>
non_pivot_monomials
;
pivots
.
sort
();
std
::
list
<
std
::
size_t
>::
const_iterator
it
=
pivots
.
begin
();
for
(
std
::
size_t
i
=
0
;
i
<
B
->
col_dec_
.
size
();
++
i
)
if
((
i
!=
*
it
)
||
(
it
==
pivots
.
end
()))
non_pivot_monomials
.
push_back
(
B
->
col_dec_
[
i
]);
else
it
++
;
if
(
D
!=
nullptr
)
{
for
(
const
auto
&
it
:
pivots
)
D
->
row_dec_
.
push_back
(
D
->
col_dec_
[
it
]);
D
->
Compress
();
D
->
RemoveColumns
(
pivots
);
}
if
(
B
!=
nullptr
)
B
->
RemoveColumns
(
pivots
);
B
->
col_dec_
=
non_pivot_monomials
;
D
->
col_dec_
=
non_pivot_monomials
;
}
// Compute the row echelon form of D, and reduce B accordingly.
void
rowech
(
std
::
string
resD_file
,
std
::
string
resB_file
,
...
...
src/tinygb_init/tinygb_init.cc
View file @
d562e20d
...
...
@@ -31,15 +31,11 @@ std::shared_ptr<const StorageMatrix> Interreduce(const std::vector<Polynomial>&
B
->
col_dec_
=
v
;
D
->
col_dec_
=
v
;
WriteRowMajMat
(
*
D
,
"matD"
);
WriteRowMajMat
(
*
B
,
"matB"
);
std
::
list
<
std
::
size_t
>
pivots
;
// This should probably not be called from inside the function
// It should probably be a function call to the row echelon function
std
::
system
((
"build/rowech/rowech "
+
WORKDIR
+
" matD2 matB2 matD matB"
).
c_str
());
D
->
RowEchelon
(
B
,
pivots
);
ReadRowMajMat
(
&
D
,
"matD2"
);
ReadRowMajMat
(
&
B
,
"matB2"
);
Compress
(
D
,
B
,
pivots
);
auto
p_current_storage_matrix
=
std
::
make_shared
<
const
StorageMatrix
>
(
D
,
D
->
col_dec_
,
D
->
row_dec_
,
"interreduced_system"
);
...
...
Write
Preview
Markdown
is supported
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