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
1ca9c0cc
Commit
1ca9c0cc
authored
Apr 07, 2016
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug that caused the matrix to throw an error during some assignment
statements when used inside a matlab mex file.
parent
4f367471
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
matrix.h
dlib/matrix/matrix.h
+28
-0
matrix_data_layout.h
dlib/matrix/matrix_data_layout.h
+18
-0
No files found.
dlib/matrix/matrix.h
View file @
1ca9c0cc
...
...
@@ -1114,14 +1114,42 @@ namespace dlib
#ifdef DLIB_HAS_RVALUE_REFERENCES
matrix
(
matrix
&&
item
)
{
#ifdef MATLAB_MEX_FILE
// You can't move memory around when compiled in a matlab mex file and the
// different locations have different persistence settings.
if
(
data
.
_private_is_persistent
()
==
item
.
data
.
_private_is_persistent
())
{
swap
(
item
);
}
else
{
data
.
set_size
(
item
.
nr
(),
item
.
nc
());
matrix_assign
(
*
this
,
item
);
}
#else
swap
(
item
);
#endif
}
matrix
&
operator
=
(
matrix
&&
rhs
)
{
#ifdef MATLAB_MEX_FILE
// You can't move memory around when compiled in a matlab mex file and the
// different locations have different persistence settings.
if
(
data
.
_private_is_persistent
()
==
rhs
.
data
.
_private_is_persistent
())
{
swap
(
rhs
);
}
else
{
data
.
set_size
(
rhs
.
nr
(),
rhs
.
nc
());
matrix_assign
(
*
this
,
rhs
);
}
#else
swap
(
rhs
);
#endif
return
*
this
;
}
#endif
...
...
dlib/matrix/matrix_data_layout.h
View file @
1ca9c0cc
...
...
@@ -188,6 +188,7 @@ namespace dlib
void
_private_set_mxArray
(
mxArray
*
)
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
mxArray
*
_private_release_mxArray
(){
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
bool
_private_is_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
#endif
private
:
...
...
@@ -257,6 +258,7 @@ namespace dlib
void
_private_set_mxArray
(
mxArray
*
)
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
mxArray
*
_private_release_mxArray
(){
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
bool
_private_is_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
#endif
private
:
...
...
@@ -338,6 +340,7 @@ namespace dlib
void
_private_set_mxArray
(
mxArray
*
)
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
mxArray
*
_private_release_mxArray
(){
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
bool
_private_is_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
#endif
private
:
...
...
@@ -422,6 +425,7 @@ namespace dlib
void
_private_set_mxArray
(
mxArray
*
)
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
mxArray
*
_private_release_mxArray
(){
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
bool
_private_is_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
#endif
private
:
...
...
@@ -508,6 +512,7 @@ namespace dlib
void
_private_set_mxArray
(
mxArray
*
)
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
mxArray
*
_private_release_mxArray
(){
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
bool
_private_is_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
#endif
private
:
T
*
data
;
...
...
@@ -630,6 +635,7 @@ namespace dlib
void
_private_set_mxArray
(
mxArray
*
)
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
mxArray
*
_private_release_mxArray
(){
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
bool
_private_is_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
#endif
private
:
...
...
@@ -699,6 +705,7 @@ namespace dlib
void
_private_set_mxArray
(
mxArray
*
)
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
mxArray
*
_private_release_mxArray
(){
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
bool
_private_is_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
#endif
private
:
...
...
@@ -780,6 +787,7 @@ namespace dlib
void
_private_set_mxArray
(
mxArray
*
)
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
mxArray
*
_private_release_mxArray
(){
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
bool
_private_is_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
#endif
private
:
...
...
@@ -864,6 +872,7 @@ namespace dlib
void
_private_set_mxArray
(
mxArray
*
)
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
mxArray
*
_private_release_mxArray
(){
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
bool
_private_is_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
#endif
private
:
...
...
@@ -930,6 +939,7 @@ namespace dlib
void
_private_set_mxArray
(
mxArray
*
)
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
mxArray
*
_private_release_mxArray
(){
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
void
_private_mark_non_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
bool
_private_is_persistent
()
{
DLIB_CASSERT
(
false
,
"This function should never be called."
);
}
#endif
long
nr
(
...
...
@@ -1031,6 +1041,10 @@ namespace dlib
DLIB_CASSERT
(
mem
==
0
,
"You can't convert a persistent matlab array to non-persistent."
);
make_persistent
=
false
;
}
bool
_private_is_persistent
()
{
return
make_persistent
;
}
void
swap
(
layout
&
item
...
...
@@ -1153,6 +1167,10 @@ namespace dlib
DLIB_CASSERT
(
mem
==
0
,
"You can't convert a persistent matlab array to non-persistent."
);
make_persistent
=
false
;
}
bool
_private_is_persistent
()
{
return
make_persistent
;
}
void
swap
(
layout
&
item
...
...
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