Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
statutils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
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
CRUS
statutils
Commits
e5200de3
Commit
e5200de3
authored
2 years ago
by
Aymeric Agon-Rambosson
Browse files
Options
Downloads
Patches
Plain Diff
Ajout quantile.
parent
d88f7ba8
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
Makefile
+8
-1
8 additions, 1 deletion
Makefile
README
+1
-1
1 addition, 1 deletion
README
src/main_quantile.c
+83
-0
83 additions, 0 deletions
src/main_quantile.c
with
93 additions
and
2 deletions
.gitignore
+
1
−
0
View file @
e5200de3
...
...
@@ -4,6 +4,7 @@ moyenne
variance
histogramme
IC_moyenne
quantile
# Tous les fichiers objets
src/*.o
...
...
This diff is collapsed.
Click to expand it.
Makefile
+
8
−
1
View file @
e5200de3
...
...
@@ -33,7 +33,10 @@ HISTOGRAMME_OBJ = \
${
COMMON_OBJ
}
\
src/histogram.o
BIN
=
total moyenne variance IC_moyenne histogramme
QUANTILE_OBJ
=
\
${
COMMON_OBJ
}
BIN
=
total moyenne variance IC_moyenne histogramme quantile
all
:
options ${BIN}
...
...
@@ -69,6 +72,10 @@ histogramme: ${HISTOGRAMME_OBJ} src/main_histogramme.o
@
echo
LD
-o
$@
@${
LD
}
-o
$@
${
HISTOGRAMME_OBJ
}
src/main_histogramme.o
${
LDFLAGS
}
quantile
:
${QUANTILE_OBJ} src/main_quantile.o
@
echo
LD
-o
$@
@${
LD
}
-o
$@
${
QUANTILE_OBJ
}
src/main_quantile.o
${
LDFLAGS
}
${
GSLLIBS
}
clean
:
@
echo
Nettoyage
rm
-f
${
BIN
}
src/
*
.o
...
...
This diff is collapsed.
Click to expand it.
README
+
1
−
1
View file @
e5200de3
...
...
@@ -19,7 +19,7 @@ par un blanc), interprètent ces nombres comme un échantillon d'une population
infinie et impriment une statistique particulière dans la sortie standard.
Ces programmes se veulent minimaux quant à leurs dépendances :
- libgsl-dev (pour IC_moyenne
seulement, quantile de la loi de Student
)
- libgsl-dev (pour IC_moyenne
et quantile
)
- libm (pour IC_moyenne seulement, calcul de la racine carrée)
- libc (pour tous les programmes)
...
...
This diff is collapsed.
Click to expand it.
src/main_quantile.c
0 → 100644
+
83
−
0
View file @
e5200de3
/* statutils - Perform statistical operations on stdin data
*
* Copyright (C) 2022 Aymeric Agon-Rambosson
*
* This file is part of statutils.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Written by Aymeric Agon-Rambosson */
#include
<stdio.h>
#include
<stdbool.h>
#include
<string.h>
#include
<gsl/gsl_sort.h>
#include
<gsl/gsl_statistics.h>
#include
"input.h"
static
void
usage
(
void
)
{
fprintf
(
stderr
,
"usage: quantile -p probabilité
\n
"
);
}
static
void
run_double
(
const
double
proba
)
{
double
*
array
;
size_t
array_size
=
get_stdin_double
(
&
array
);
double
result
;
gsl_sort
(
array
,
1
,
array_size
);
result
=
gsl_stats_quantile_from_sorted_data
(
array
,
1
,
array_size
,
proba
);
printf
(
"%lg
\n
"
,
result
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
;
double
proba
=
-
1
;
for
(
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
!
strcmp
(
argv
[
i
],
"-h"
))
{
usage
();
exit
(
0
);
}
else
if
(
!
strcmp
(
argv
[
i
],
"-p"
))
{
proba
=
strtod
(
argv
[
++
i
],
NULL
);
}
else
{
fprintf
(
stderr
,
"%s : Argument invalide
\n
"
,
argv
[
i
]);
exit
(
22
);
}
}
if
((
proba
<
0
)
||
(
proba
>
1
))
{
fprintf
(
stderr
,
"%lg : la fonction quantile est définie sur [0;1]
\n
"
,
proba
);
usage
();
exit
(
22
);
}
run_double
(
proba
);
return
0
;
}
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