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
46072c8c
Commit
46072c8c
authored
Dec 07, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added min_point()
parent
6ca45db0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
matrix_utilities.h
dlib/matrix/matrix_utilities.h
+35
-0
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