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
a4f07199
"scripts/git@developer.sourcefind.cn:change/sglang.git" did not exist on "53529f46ccc9554e8426bcfa6d666af4b0db8d6a"
Commit
a4f07199
authored
Dec 23, 2012
by
Davis King
Browse files
Added a mat() overload that works with Armadillo matrices.
parent
a0e3d2a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
dlib/matrix/matrix_mat.h
dlib/matrix/matrix_mat.h
+44
-0
dlib/matrix/matrix_mat_abstract.h
dlib/matrix/matrix_mat_abstract.h
+18
-0
No files found.
dlib/matrix/matrix_mat.h
View file @
a4f07199
...
...
@@ -247,6 +247,50 @@ namespace dlib
return
matrix_op
<
op
>
(
op
(
ptr
,
nr
,
nc
));
}
// ----------------------------------------------------------------------------------------
}
namespace
arma
{
template
<
typename
T
>
class
Mat
;
}
namespace
dlib
{
template
<
typename
T
>
struct
op_arma_Mat_to_mat
:
does_not_alias
{
op_arma_Mat_to_mat
(
const
T
&
array_
)
:
array
(
array_
){}
const
T
&
array
;
const
static
long
cost
=
1
;
const
static
long
NR
=
0
;
const
static
long
NC
=
0
;
typedef
typename
T
::
elem_type
type
;
typedef
typename
T
::
elem_type
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
array
(
r
,
c
);
}
long
nr
()
const
{
return
array
.
n_rows
;
}
long
nc
()
const
{
return
array
.
n_cols
;
}
};
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
const
matrix_op
<
op_arma_Mat_to_mat
<
::
arma
::
Mat
<
T
>
>
>
mat
(
const
::
arma
::
Mat
<
T
>&
array
)
{
typedef
op_arma_Mat_to_mat
<
::
arma
::
Mat
<
T
>
>
op
;
return
matrix_op
<
op
>
(
op
(
array
));
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// DEPRECATED FUNCTIONS
...
...
dlib/matrix/matrix_mat_abstract.h
View file @
a4f07199
...
...
@@ -147,6 +147,24 @@ namespace dlib
the pointer and thus will not delete or free it.
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
const
matrix_exp
mat
(
const
::
arma
::
Mat
<
T
>&
m
);
/*!
ensures
- Converts a matrix from the Armadillo library into a dlib matrix.
- returns a matrix R such that:
- R.nr() == m.n_rows
- R.nc() == m.n_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