Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
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
Model registry
Operate
Environments
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
simon.cirilli
Optimisation
Commits
66207fbe
Commit
66207fbe
authored
4 years ago
by
simon.cirilli
Browse files
Options
Downloads
Patches
Plain Diff
descente de gradient pas précise
parent
9aed84e8
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
prog
+0
-0
0 additions, 0 deletions
prog
src/main.c
+10
-10
10 additions, 10 deletions
src/main.c
src/main.o
+0
-0
0 additions, 0 deletions
src/main.o
src/regressionLin.c
+15
-16
15 additions, 16 deletions
src/regressionLin.c
src/regressionLin.o
+0
-0
0 additions, 0 deletions
src/regressionLin.o
with
25 additions
and
26 deletions
prog
+
0
−
0
View file @
66207fbe
No preview for this file type
This diff is collapsed.
Click to expand it.
src/main.c
+
10
−
10
View file @
66207fbe
...
@@ -10,23 +10,23 @@ int main() {
...
@@ -10,23 +10,23 @@ int main() {
point
pt0
;
point
pt0
;
pt0
.
x
=
0
;
pt0
.
x
=
0
;
pt0
.
y
=
0
;
pt0
.
y
=
1
;
point
pt1
;
point
pt1
;
pt1
.
x
=
1
;
pt1
.
x
=
1
;
pt1
.
y
=
1
;
pt1
.
y
=
2
;
point
pt2
;
point
pt2
;
pt2
.
x
=
2
;
pt2
.
x
=
2
;
pt2
.
y
=
2
;
pt2
.
y
=
3
;
point
pt3
;
point
pt3
;
pt3
.
x
=
3
;
pt3
.
x
=
3
;
pt3
.
y
=
3
;
pt3
.
y
=
4
;
point
pt4
;
point
pt4
;
pt4
.
x
=
4
;
pt4
.
x
=
4
;
pt4
.
y
=
4
;
pt4
.
y
=
5
;
vector
v
;
vector
v
;
vector_init
(
&
v
);
vector_init
(
&
v
);
...
@@ -37,12 +37,12 @@ int main() {
...
@@ -37,12 +37,12 @@ int main() {
vector_push
(
&
v
,
pt4
);
vector_push
(
&
v
,
pt4
);
point
p
=
findBestDroite
(
v
);
point
p
=
findBestDroite
(
v
);
printf
(
"Sol Analytique :
%f
%f
\n
"
,
p
.
x
,
p
.
y
);
printf
(
"Sol Analytique :
a: %f b:
%f
\n
"
,
p
.
x
,
p
.
y
);
point
drt
;
point
drt
;
drt
.
x
=
1
;
drt
.
x
=
3
;
drt
.
y
=
0
;
drt
.
y
=
3
;
p
=
descenteGradient
(
0
.
000
0
1
,
drt
,
v
);
p
=
descenteGradient
(
0
.
0001
,
drt
,
v
);
printf
(
"Sol Numérique :
%f
%f
\n
"
,
p
.
x
,
p
.
y
);
printf
(
"Sol Numérique :
a: %f b:
%f
\n
"
,
p
.
x
,
p
.
y
);
vector_free
(
&
v
);
vector_free
(
&
v
);
...
...
This diff is collapsed.
Click to expand it.
src/main.o
+
0
−
0
View file @
66207fbe
No preview for this file type
This diff is collapsed.
Click to expand it.
src/regressionLin.c
+
15
−
16
View file @
66207fbe
...
@@ -36,37 +36,36 @@ point descenteGradient(double precision, point drt, vector pts){
...
@@ -36,37 +36,36 @@ point descenteGradient(double precision, point drt, vector pts){
double
gradienty
=
0
;
double
gradienty
=
0
;
double
oldptx
=
0
;
double
oldptx
=
0
;
double
oldpty
=
0
;
double
oldpty
=
0
;
double
testSortie
;
double
testSortie
=
1
;
double
lambda
=
0
.
000001
;
while
(
1
){
while
(
testSortie
>
precision
){
gradientx
=
0
;
gradientx
=
0
;
gradienty
=
0
;
gradienty
=
0
;
testSortie
=
0
;
testSortie
=
0
;
//drt.x est a et drt.y est b
for
(
int
i
=
0
;
i
<
pts
.
length
;
i
++
){
for
(
int
i
=
0
;
i
<
pts
.
length
;
i
++
){
gradientx
+=
((
pts
.
content
[
i
].
x
*
pts
.
content
[
i
].
x
)
*
dr
t
.
x
)
+
(
dr
t
.
y
*
pts
.
content
[
i
].
x
)
-
(
pts
.
content
[
i
].
x
*
pts
.
content
[
i
].
y
);
gradientx
+=
(
pow
(
pts
.
content
[
i
].
x
,
2
)
*
p
t
.
x
)
+
(
p
t
.
y
*
pts
.
content
[
i
].
x
)
-
(
pts
.
content
[
i
].
x
*
pts
.
content
[
i
].
y
);
gradienty
+=
(
dr
t
.
x
*
pts
.
content
[
i
].
x
)
-
pts
.
content
[
i
].
y
;
gradienty
+=
(
p
t
.
x
*
pts
.
content
[
i
].
x
)
-
pts
.
content
[
i
].
y
;
}
}
gradientx
=
gradientx
*
2
;
gradientx
=
gradientx
*
2
;
gradienty
+=
drt
.
y
*
pts
.
length
;
gradienty
+=
drt
.
y
*
pts
.
length
;
gradienty
=
gradienty
*
2
;
gradienty
=
gradienty
*
2
;
double
lambda
=
0
.
1
;
//drt.x est a et drt.b est b
oldptx
=
pt
.
x
;
oldptx
=
pt
.
x
;
oldpty
=
pt
.
y
;
oldpty
=
pt
.
y
;
pt
.
x
=
drt
.
x
-
lambda
*
(
gradientx
);
pt
.
x
=
oldptx
-
(
lambda
*
gradientx
);
pt
.
y
=
drt
.
y
-
lambda
*
(
gradienty
);
printf
(
"ptx : %f
\n
"
,
pt
.
x
);
pt
.
y
=
oldpty
-
(
lambda
*
gradienty
);
printf
(
"pty : %f
\n
"
,
pt
.
y
);
//Sortie
testSortie
=
sqrt
(
pow
(
pt
.
x
-
oldptx
,
2
)
+
pow
(
pt
.
y
-
oldpty
,
2
));
testSortie
=
sqrt
(
pow
(
pt
.
x
-
oldptx
,
2
)
+
pow
(
pt
.
y
-
oldpty
,
2
));
printf
(
"%f
\n
"
,
testSortie
);
if
(
testSortie
<
precision
){
break
;
}
}
}
return
pt
;
return
pt
;
...
...
This diff is collapsed.
Click to expand it.
src/regressionLin.o
+
0
−
0
View file @
66207fbe
No preview for this file type
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