Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
e2fdff8c
"git@developer.sourcefind.cn:OpenDAS/d2go.git" did not exist on "c12469c20a2b3c3d041253ba9903e04eecdc4c89"
Commit
e2fdff8c
authored
Oct 01, 2012
by
Davis King
Browse files
Added a stddev() for matrix objects.
parent
daecb0ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
dlib/matrix/matrix_utilities.h
dlib/matrix/matrix_utilities.h
+12
-0
dlib/matrix/matrix_utilities_abstract.h
dlib/matrix/matrix_utilities_abstract.h
+10
-0
dlib/test/statistics.cpp
dlib/test/statistics.cpp
+1
-0
No files found.
dlib/matrix/matrix_utilities.h
View file @
e2fdff8c
...
...
@@ -1767,6 +1767,18 @@ namespace dlib
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
EXP
>
const
typename
matrix_exp
<
EXP
>::
type
stddev
(
const
matrix_exp
<
EXP
>&
m
)
{
return
std
::
sqrt
(
variance
(
m
));
}
// ----------------------------------------------------------------------------------------
// this is a workaround for a bug in visual studio 7.1
...
...
dlib/matrix/matrix_utilities_abstract.h
View file @
e2fdff8c
...
...
@@ -1541,6 +1541,16 @@ namespace dlib
(i.e. 1.0/(m.nr()*m.nc() - 1)*(sum of all pow(m(i,j) - mean(m),2)))
!*/
// ----------------------------------------------------------------------------------------
const
matrix_exp
::
type
stddev
(
const
matrix_exp
&
m
);
/*!
ensures
- returns std::sqrt(variance(m))
!*/
// ----------------------------------------------------------------------------------------
const
matrix
covariance
(
...
...
dlib/test/statistics.cpp
View file @
e2fdff8c
...
...
@@ -299,6 +299,7 @@ namespace
}
DLIB_TEST
(
std
::
abs
(
variance
(
vector_to_matrix
(
a
))
-
rs1
.
variance
())
<
1e-13
);
DLIB_TEST
(
std
::
abs
(
stddev
(
vector_to_matrix
(
a
))
-
rs1
.
stddev
())
<
1e-13
);
DLIB_TEST
(
std
::
abs
(
mean
(
vector_to_matrix
(
a
))
-
rs1
.
mean
())
<
1e-13
);
for
(
int
i
=
10
;
i
<
20
;
++
i
)
...
...
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