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
3acb55b2
Commit
3acb55b2
authored
Oct 10, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added flip()
parent
3b412f23
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
matrix_utilities.h
dlib/matrix/matrix_utilities.h
+38
-0
matrix_utilities_abstract.h
dlib/matrix/matrix_utilities_abstract.h
+16
-0
No files found.
dlib/matrix/matrix_utilities.h
View file @
3acb55b2
...
@@ -3967,6 +3967,44 @@ namespace dlib
...
@@ -3967,6 +3967,44 @@ namespace dlib
return
matrix_op
<
op
>
(
op
(
m
.
ref
()));
return
matrix_op
<
op
>
(
op
(
m
.
ref
()));
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
M
>
struct
op_flip
{
op_flip
(
const
M
&
m_
)
:
m
(
m_
){}
const
M
&
m
;
const
static
long
cost
=
M
::
cost
;
const
static
long
NR
=
M
::
NR
;
const
static
long
NC
=
M
::
NC
;
typedef
typename
M
::
type
type
;
typedef
typename
M
::
const_ret_type
const_ret_type
;
typedef
typename
M
::
mem_manager_type
mem_manager_type
;
typedef
typename
M
::
layout_type
layout_type
;
const_ret_type
apply
(
long
r
,
long
c
)
const
{
return
m
(
m
.
nr
()
-
r
-
1
,
m
.
nc
()
-
c
-
1
);
}
long
nr
()
const
{
return
m
.
nr
();
}
long
nc
()
const
{
return
m
.
nc
();
}
template
<
typename
U
>
bool
aliases
(
const
matrix_exp
<
U
>&
item
)
const
{
return
m
.
aliases
(
item
);
}
template
<
typename
U
>
bool
destructively_aliases
(
const
matrix_exp
<
U
>&
item
)
const
{
return
m
.
aliases
(
item
);
}
};
template
<
typename
M
>
const
matrix_op
<
op_flip
<
M
>
>
flip
(
const
matrix_exp
<
M
>&
m
)
{
typedef
op_flip
<
M
>
op
;
return
matrix_op
<
op
>
(
op
(
m
.
ref
()));
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
typename
T
,
long
NR
,
long
NC
,
typename
MM
,
typename
L
>
template
<
typename
T
,
long
NR
,
long
NC
,
typename
MM
,
typename
L
>
...
...
dlib/matrix/matrix_utilities_abstract.h
View file @
3acb55b2
...
@@ -400,6 +400,22 @@ namespace dlib
...
@@ -400,6 +400,22 @@ namespace dlib
M(r,c) == m(m.nr()-r-1, c)
M(r,c) == m(m.nr()-r-1, c)
!*/
!*/
// ----------------------------------------------------------------------------------------
const
matrix_exp
flip
(
const
matrix_exp
&
m
);
/*!
ensures
- flips the matrix m from up to down and left to right and returns the
result. I.e. returns flipud(fliplr(m)).
- returns a matrix M such that:
- M::type == the same type that was in m
- M has the same dimensions as m
- for all valid r and c:
M(r,c) == m(m.nr()-r-1, m.nc()-c-1)
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template
<
template
<
...
...
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