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
6efc800b
Commit
6efc800b
authored
Dec 24, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added another mat() overload for Eigen matrices.
parent
a4f07199
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
matrix_mat.h
dlib/matrix/matrix_mat.h
+43
-0
matrix_mat_abstract.h
dlib/matrix/matrix_mat_abstract.h
+23
-0
No files found.
dlib/matrix/matrix_mat.h
View file @
6efc800b
...
...
@@ -290,6 +290,49 @@ namespace dlib
typedef
op_arma_Mat_to_mat
<
::
arma
::
Mat
<
T
>
>
op
;
return
matrix_op
<
op
>
(
op
(
array
));
}
}
namespace
Eigen
{
template
<
typename
_Scalar
,
int
_Rows
,
int
_Cols
,
int
_Options
,
int
_MaxRows
,
int
_MaxCols
>
class
Matrix
;
}
namespace
dlib
{
template
<
typename
T
,
int
_Rows
,
int
_Cols
>
struct
op_eigen_Matrix_to_mat
:
does_not_alias
{
op_eigen_Matrix_to_mat
(
const
T
&
array_
)
:
m
(
array_
){}
const
T
&
m
;
const
static
long
cost
=
1
;
const
static
long
NR
=
(
_Rows
>
0
)
?
_Rows
:
0
;
const
static
long
NC
=
(
_Cols
>
0
)
?
_Cols
:
0
;
typedef
typename
T
::
Scalar
type
;
typedef
typename
T
::
Scalar
const_ret_type
;
typedef
default_memory_manager
mem_manager_type
;
typedef
row_major_layout
layout_type
;
const_ret_type
apply
(
long
r
,
long
c
)
const
{
return
m
(
r
,
c
);
}
long
nr
()
const
{
return
m
.
rows
();
}
long
nc
()
const
{
return
m
.
cols
();
}
};
// ----------------------------------------------------------------------------------------
template
<
typename
_Scalar
,
int
_Rows
,
int
_Cols
,
int
_Options
,
int
_MaxRows
,
int
_MaxCols
>
const
matrix_op
<
op_eigen_Matrix_to_mat
<
::
Eigen
::
Matrix
<
_Scalar
,
_Rows
,
_Cols
,
_Options
,
_MaxRows
,
_MaxCols
>
,
_Rows
,
_Cols
>
>
mat
(
const
::
Eigen
::
Matrix
<
_Scalar
,
_Rows
,
_Cols
,
_Options
,
_MaxRows
,
_MaxCols
>&
m
)
{
typedef
op_eigen_Matrix_to_mat
<
::
Eigen
::
Matrix
<
_Scalar
,
_Rows
,
_Cols
,
_Options
,
_MaxRows
,
_MaxCols
>
,
_Rows
,
_Cols
>
op
;
return
matrix_op
<
op
>
(
op
(
m
));
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
dlib/matrix/matrix_mat_abstract.h
View file @
6efc800b
...
...
@@ -165,6 +165,29 @@ namespace dlib
R(r,c) == m(r,c)
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
_Scalar
,
int
_Rows
,
int
_Cols
,
int
_Options
,
int
_MaxRows
,
int
_MaxCols
>
const
matrix_exp
mat
(
const
::
Eigen
::
Matrix
<
_Scalar
,
_Rows
,
_Cols
,
_Options
,
_MaxRows
,
_MaxCols
>&
m
);
/*!
ensures
- Converts a matrix from the Eigen library into a dlib matrix.
- returns a matrix R such that:
- R.nr() == m.rows()
- R.nc() == m.cols()
- for all valid r:
R(r,c) == m(r,c)
!*/
// ----------------------------------------------------------------------------------------
}
...
...
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