Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProgrammationParallelle
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
JACQUIER Timeo
ProgrammationParallelle
Commits
57ddf379
Commit
57ddf379
authored
2 years ago
by
timeo
Browse files
Options
Downloads
Patches
Plain Diff
SAIS marche avec la somme simple, pas centrée
parent
9b1bb64e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ProgrammesEnVrac/main.cpp
+32
-11
32 additions, 11 deletions
src/ProgrammesEnVrac/main.cpp
src/ProgrammesEnVrac/makefile
+4
-1
4 additions, 1 deletion
src/ProgrammesEnVrac/makefile
src/ProgrammesEnVrac/testSais.cpp
+69
-0
69 additions, 0 deletions
src/ProgrammesEnVrac/testSais.cpp
with
105 additions
and
12 deletions
src/ProgrammesEnVrac/main.cpp
+
32
−
11
View file @
57ddf379
...
...
@@ -18,6 +18,8 @@ using namespace std::chrono;
string
fichier
;
int32_t
*
sommeAdditiveArray
;
SuffixTree
*
arbre
;
int32_t
maxi
=
0
;
void
parseFile
(
string
namefile
)
// Enregitrement du fichier dans une variable
{
...
...
@@ -45,7 +47,12 @@ void sommeAdditive(){
//std::cout << int(fichier[3]) - 48 << std::endl;
for
(
int
i
=
0
;
i
<=
fichier
.
size
();
i
++
){
compteur
+=
int
(
fichier
[
i
])
-
48
;
// -48 pour faire la conversation char -> int de manière explicite
sommeAdditiveArray
[
i
+
1
]
=
compteur
;
if
(
compteur
>
maxi
){
maxi
=
compteur
;
}
}
}
...
...
@@ -74,6 +81,10 @@ void sommeAdditiveCentre(){
}
compteur
+=
nb
;
sommeAdditiveArray
[
i
+
1
]
=
compteur
;
int32_t
compteur_val_absolu
=
(
compteur
*
2
)
/
2
;
if
(
compteur_val_absolu
>
maxi
){
maxi
=
compteur_val_absolu
;
}
}
}
/**
...
...
@@ -303,22 +314,32 @@ int main(){
//parseFile("motstests/ACF_100_over_0123.txt");
parseFile
(
"testfiles/10000
0
fromCorrect.txt"
);
parseFile
(
"testfiles/10000fromCorrect.txt"
);
//fichier = "00100100200100112001020011003";
std
::
cout
<<
fichier
.
size
()
<<
std
::
endl
;
sommeAdditiveCentre
();
std
::
cout
<<
sommeAdditiveArray
[
99999
]
<<
std
::
endl
;
sommeAdditive
();
/*int32_t* T = sommeAdditiveArray;
int32_t fs = 6000;
int32_t* SA = (int32_t*) malloc(11000 * sizeof(int32_t));
int32_t
*
T
=
new
int32_t
[
fichier
.
size
()
+
1
];
for
(
int
i
=
0
;
i
<
fichier
.
size
()
+
2
;
i
++
){
T
[
i
]
=
sommeAdditiveArray
[
i
];
}
int32_t
fs
=
8000
;
int32_t
*
SA
=
new
int32_t
[
fichier
.
size
()
+
fs
+
1
];
std::cout << sizeof(SA)<< endl;
//SA = malloc()
std::cout << libsais_int(T, SA, 5001, 10, fs) << std::endl;*/
int32_t
k
=
maxi
;
std
::
cout
<<
maxi
<<
std
::
endl
;
std
::
cout
<<
libsais_int
(
T
,
SA
,
10000
,
k
,
fs
)
<<
std
::
endl
;
// free(T);
// free(SA);
//arbreDesSuffixes();
}
\ No newline at end of file
}
// Avec 100 000, segfault vers 14600
// Avec 50 000 segfault vers 7375
// Avec 5 000 va jusqu'au bout
// 50 000 segfault : 0x0000555555560172
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/ProgrammesEnVrac/makefile
+
4
−
1
View file @
57ddf379
...
...
@@ -58,7 +58,10 @@ tree2: SuffixTree.cpp
$(
BIB
)
main
:
main.cpp $(OBJETS)
$(
G
)
$(
OPEN
)
$<
-L
.
-lsais
-o
$@
$(
OBJETS
)
$(
G
)
-g
$(
OPEN
)
$<
-L
.
-lsais
-o
$@
$(
OBJETS
)
testSais
:
testSais.cpp $(OBJETS)
$(
G
)
$(
OPEN
)
$<
-L
.
-lsais
-o
$@
run
:
./
$(
EXEC
)
This diff is collapsed.
Click to expand it.
src/ProgrammesEnVrac/testSais.cpp
0 → 100644
+
69
−
0
View file @
57ddf379
#include
<string>
#include
<stdio.h>
#include
<iostream>
#include
<fstream>
#include
<chrono>
#include
"libsais-master/src/libsais.h"
#include
<stdint.h>
#include
<omp.h>
int
main
(){
int32_t
*
T
=
new
int32_t
[
5
];
int32_t
*
SA
=
new
int32_t
[
10
];
srand
(
time
(
NULL
));
T
[
0
]
=
0
;
T
[
1
]
=
0
;
T
[
2
]
=
2
;
T
[
3
]
=
2
;
T
[
4
]
=
1
;
int32_t
n
=
3
;
int32_t
k
=
3
;
int32_t
fs
=
0
;
int32_t
ret
=
libsais_int
(
T
,
SA
,
n
,
k
,
fs
);
std
::
cout
<<
"Tableau 5 : "
<<
ret
<<
std
::
endl
;
/* -------------------------------------------------------- */
n
=
10000
;
T
=
new
int32_t
[
n
];
for
(
int
i
=
0
;
i
<
n
;
i
++
){
T
[
i
]
=
rand
()
%
4
;
}
k
=
4
;
SA
=
new
int32_t
[
n
];
ret
=
libsais_int
(
T
,
SA
,
n
,
k
,
fs
);
std
::
cout
<<
"Tableau 10000 : "
<<
ret
<<
std
::
endl
;
/* -------------------------------------------------------- */
T
=
new
int32_t
[
5
];
SA
=
new
int32_t
[
5
];
srand
(
time
(
NULL
));
T
[
0
]
=
0
;
T
[
1
]
=
0
;
T
[
2
]
=
-
2
;
T
[
3
]
=
-
2
;
T
[
4
]
=
-
10000000
;
n
=
3
;
k
=
3
;
fs
=
0
;
ret
=
libsais_int
(
T
,
SA
,
n
,
k
,
fs
);
std
::
cout
<<
"Tableau 5 : "
<<
ret
<<
std
::
endl
;
/* -------------------------------------------------------- */
}
// segfault quand n > size T
// double free + core dumped quand T = N > SA
/* initialize random seed:
srand (time(NULL));
/* generate secret number between 1 and 10:
iSecret = rand() % 10 + 1; */
\ No newline at end of file
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