Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
math_optimisation
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
scott.birner
math_optimisation
Commits
bf26daa2
Commit
bf26daa2
authored
3 years ago
by
ExtraDev
Browse files
Options
Downloads
Patches
Plain Diff
create regroupe of groups function
parent
6e02e917
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/C/descente_radiant
+0
-0
0 additions, 0 deletions
src/C/descente_radiant
src/C/equation.c
+14
-0
14 additions, 0 deletions
src/C/equation.c
src/C/equation.h
+1
-0
1 addition, 0 deletions
src/C/equation.h
src/C/main.c
+8
-0
8 additions, 0 deletions
src/C/main.c
with
23 additions
and
0 deletions
src/C/descente_radiant
+
0
−
0
View file @
bf26daa2
No preview for this file type
This diff is collapsed.
Click to expand it.
src/C/equation.c
+
14
−
0
View file @
bf26daa2
...
...
@@ -105,6 +105,20 @@ void create_group_random(group_t *group, point_t* points, int n_points, int n_gr
free
(
tmp
);
}
point_t
*
group
(
group_t
*
group
,
int
a
,
int
b
)
{
int
nb_points
=
(
int
)(
group
->
n_points
/
group
->
n_groups
)
*
2
;
// 30 / 3 * 2 = 20
point_t
*
result
=
malloc
(
sizeof
(
point_t
)
*
nb_points
);
for
(
int
i
=
0
;
i
<
nb_points
/
2
;
i
++
)
{
result
[
i
]
=
group
->
points
[
a
][
i
];
result
[
nb_points
/
2
+
i
]
=
group
->
points
[
b
][
i
];
}
return
result
;
}
void
print_group
(
group_t
*
group
){
for
(
int
i
=
0
;
i
<
group
->
n_groups
;
i
++
)
{
...
...
This diff is collapsed.
Click to expand it.
src/C/equation.h
+
1
−
0
View file @
bf26daa2
...
...
@@ -49,6 +49,7 @@ double fd(vector_t x); // test
// Gestion des groupes
void
create_group
(
group_t
*
group
,
point_t
*
points
,
int
n_points
,
int
n_groups
);
void
create_group_random
(
group_t
*
group
,
point_t
*
points
,
int
n_points
,
int
n_groups
);
point_t
*
group
(
group_t
*
group
,
int
a
,
int
b
);
void
print_group
(
group_t
*
group
);
void
destroy_group
(
group_t
*
group
);
...
...
This diff is collapsed.
Click to expand it.
src/C/main.c
+
8
−
0
View file @
bf26daa2
...
...
@@ -59,6 +59,14 @@ int main(int argc, char* argv[]) {
create_group_random
(
&
groups
,
points
,
nb_points
,
3
);
print_group
(
&
groups
);
// Exemple of grouping two groups
point_t
*
yes
=
group
(
&
groups
,
0
,
1
);
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
printf
(
"%f, %f
\n
"
,
yes
[
i
].
x
,
yes
[
i
].
y
);
}
vector_t
resAB
=
descente_radian
(
points
,
nb_points
);
point_t
*
AB
=
malloc
(
sizeof
(
point_t
));
*
AB
=
(
point_t
){
resAB
.
x
,
resAB
.
y
};
...
...
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