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
46072c8c
Commit
46072c8c
authored
Dec 07, 2014
by
Davis King
Browse files
Added min_point()
parent
6ca45db0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
dlib/matrix/matrix_utilities.h
dlib/matrix/matrix_utilities.h
+35
-0
dlib/matrix/matrix_utilities_abstract.h
dlib/matrix/matrix_utilities_abstract.h
+13
-0
No files found.
dlib/matrix/matrix_utilities.h
View file @
46072c8c
...
...
@@ -157,6 +157,41 @@ namespace dlib
return
best_point
;
}
// ----------------------------------------------------------------------------------------
template
<
typename
EXP
>
point
min_point
(
const
matrix_exp
<
EXP
>&
m
)
{
DLIB_ASSERT
(
m
.
size
()
>
0
,
"
\t
point min_point(const matrix_exp& m)"
<<
"
\n\t
m can't be empty"
<<
"
\n\t
m.size(): "
<<
m
.
size
()
<<
"
\n\t
m.nr(): "
<<
m
.
nr
()
<<
"
\n\t
m.nc(): "
<<
m
.
nc
()
);
typedef
typename
matrix_exp
<
EXP
>::
type
type
;
point
best_point
(
0
,
0
);
type
val
=
m
(
0
,
0
);
for
(
long
r
=
0
;
r
<
m
.
nr
();
++
r
)
{
for
(
long
c
=
0
;
c
<
m
.
nc
();
++
c
)
{
type
temp
=
m
(
r
,
c
);
if
(
dlib
::
impl
::
magnitude
(
temp
)
<
dlib
::
impl
::
magnitude
(
val
))
{
val
=
temp
;
best_point
=
point
(
c
,
r
);
}
}
}
return
best_point
;
}
// ----------------------------------------------------------------------------------------
template
<
...
...
dlib/matrix/matrix_utilities_abstract.h
View file @
46072c8c
...
...
@@ -1422,6 +1422,19 @@ namespace dlib
returned point is P then it will be the case that: m(P.y(),P.x()) == max(m).
!*/
// ----------------------------------------------------------------------------------------
point
min_point
(
const
matrix_exp
&
m
);
/*!
requires
- m.size() > 0
ensures
- returns the location of the minimum element of the array, that is, if the
returned point is P then it will be the case that: m(P.y(),P.x()) == min(m).
!*/
// ----------------------------------------------------------------------------------------
const
matrix_exp
::
type
sum
(
...
...
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