Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
e2fdff8c
Commit
e2fdff8c
authored
Oct 02, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a stddev() for matrix objects.
parent
daecb0ec
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
0 deletions
+23
-0
matrix_utilities.h
dlib/matrix/matrix_utilities.h
+12
-0
matrix_utilities_abstract.h
dlib/matrix/matrix_utilities_abstract.h
+10
-0
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