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
7dd725cb
Commit
7dd725cb
authored
Nov 17, 2013
by
Davis King
Browse files
Made the matrix sub expression operators work with any kind of
integer ranges rather than just long ranges.
parent
17a46669
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
dlib/matrix/matrix_subexp.h
dlib/matrix/matrix_subexp.h
+7
-7
dlib/matrix/matrix_subexp_abstract.h
dlib/matrix/matrix_subexp_abstract.h
+6
-6
No files found.
dlib/matrix/matrix_subexp.h
View file @
7dd725cb
...
@@ -186,9 +186,9 @@ namespace dlib
...
@@ -186,9 +186,9 @@ namespace dlib
const
matrix_exp
<
EXPc
>&
cols
const
matrix_exp
<
EXPc
>&
cols
)
)
{
{
// the rows and cols matrices must contain elements
of type long
// the rows and cols matrices must contain
integer
elements
COMPILE_TIME_ASSERT
(
(
is_same_type
<
typename
EXPr
::
type
,
long
>::
value
==
true
)
);
COMPILE_TIME_ASSERT
(
std
::
numeric_limits
<
typename
EXPr
::
type
>::
is_integer
);
COMPILE_TIME_ASSERT
(
(
is_same_type
<
typename
EXPc
::
type
,
long
>::
value
==
true
)
);
COMPILE_TIME_ASSERT
(
std
::
numeric_limits
<
typename
EXPc
::
type
>::
is_integer
);
DLIB_ASSERT
(
0
<=
min
(
rows
)
&&
max
(
rows
)
<
m
.
nr
()
&&
0
<=
min
(
cols
)
&&
max
(
cols
)
<
m
.
nc
()
&&
DLIB_ASSERT
(
0
<=
min
(
rows
)
&&
max
(
rows
)
<
m
.
nr
()
&&
0
<=
min
(
cols
)
&&
max
(
cols
)
<
m
.
nc
()
&&
(
rows
.
nr
()
==
1
||
rows
.
nc
()
==
1
)
&&
(
cols
.
nr
()
==
1
||
cols
.
nc
()
==
1
),
(
rows
.
nr
()
==
1
||
rows
.
nc
()
==
1
)
&&
(
cols
.
nr
()
==
1
||
cols
.
nc
()
==
1
),
...
@@ -347,8 +347,8 @@ namespace dlib
...
@@ -347,8 +347,8 @@ namespace dlib
const
matrix_exp
<
EXP2
>&
rows
const
matrix_exp
<
EXP2
>&
rows
)
)
{
{
// the rows matrix must contain elements
of type long
// the rows matrix must contain
integer
elements
COMPILE_TIME_ASSERT
(
(
is_same_type
<
typename
EXP2
::
type
,
long
>::
value
==
true
)
);
COMPILE_TIME_ASSERT
(
std
::
numeric_limits
<
typename
EXP2
::
type
>::
is_integer
);
DLIB_ASSERT
(
0
<=
min
(
rows
)
&&
max
(
rows
)
<
m
.
nr
()
&&
(
rows
.
nr
()
==
1
||
rows
.
nc
()
==
1
),
DLIB_ASSERT
(
0
<=
min
(
rows
)
&&
max
(
rows
)
<
m
.
nr
()
&&
(
rows
.
nr
()
==
1
||
rows
.
nc
()
==
1
),
"
\t
const matrix_exp rowm(const matrix_exp& m, const matrix_exp& rows)"
"
\t
const matrix_exp rowm(const matrix_exp& m, const matrix_exp& rows)"
...
@@ -502,8 +502,8 @@ namespace dlib
...
@@ -502,8 +502,8 @@ namespace dlib
const
matrix_exp
<
EXP2
>&
cols
const
matrix_exp
<
EXP2
>&
cols
)
)
{
{
// the
col
s matrix must contain elements
of type long
// the
row
s matrix must contain
integer
elements
COMPILE_TIME_ASSERT
(
(
is_same_type
<
typename
EXP2
::
type
,
long
>::
value
==
true
)
);
COMPILE_TIME_ASSERT
(
std
::
numeric_limits
<
typename
EXP2
::
type
>::
is_integer
);
DLIB_ASSERT
(
0
<=
min
(
cols
)
&&
max
(
cols
)
<
m
.
nc
()
&&
(
cols
.
nr
()
==
1
||
cols
.
nc
()
==
1
),
DLIB_ASSERT
(
0
<=
min
(
cols
)
&&
max
(
cols
)
<
m
.
nc
()
&&
(
cols
.
nr
()
==
1
||
cols
.
nc
()
==
1
),
"
\t
const matrix_exp colm(const matrix_exp& m, const matrix_exp& cols)"
"
\t
const matrix_exp colm(const matrix_exp& m, const matrix_exp& cols)"
...
...
dlib/matrix/matrix_subexp_abstract.h
View file @
7dd725cb
...
@@ -65,7 +65,7 @@ namespace dlib
...
@@ -65,7 +65,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- rows and cols contain
elements of type
long
- rows and cols contain
integral elements (e.g. int,
long
)
- 0 <= min(rows) && max(rows) < m.nr()
- 0 <= min(rows) && max(rows) < m.nr()
- 0 <= min(cols) && max(cols) < m.nc()
- 0 <= min(cols) && max(cols) < m.nc()
- rows.nr() == 1 || rows.nc() == 1
- rows.nr() == 1 || rows.nc() == 1
...
@@ -197,7 +197,7 @@ namespace dlib
...
@@ -197,7 +197,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- rows contains
elements of type
long
- rows contains
integral elements (e.g. int,
long
)
- 0 <= min(rows) && max(rows) < m.nr()
- 0 <= min(rows) && max(rows) < m.nr()
- rows.nr() == 1 || rows.nc() == 1
- rows.nr() == 1 || rows.nc() == 1
(i.e. rows must be a vector)
(i.e. rows must be a vector)
...
@@ -284,7 +284,7 @@ namespace dlib
...
@@ -284,7 +284,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- cols contains
elements of type
long
- cols contains
integral elements (e.g. int,
long
)
- 0 <= min(cols) && max(cols) < m.nc()
- 0 <= min(cols) && max(cols) < m.nc()
- cols.nr() == 1 || cols.nc() == 1
- cols.nr() == 1 || cols.nc() == 1
(i.e. cols must be a vector)
(i.e. cols must be a vector)
...
@@ -365,7 +365,7 @@ namespace dlib
...
@@ -365,7 +365,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- rows and cols contain
elements of type
long
- rows and cols contain
integral elements (e.g. int,
long
)
- 0 <= min(rows) && max(rows) < m.nr()
- 0 <= min(rows) && max(rows) < m.nr()
- 0 <= min(cols) && max(cols) < m.nc()
- 0 <= min(cols) && max(cols) < m.nc()
- rows.nr() == 1 || rows.nc() == 1
- rows.nr() == 1 || rows.nc() == 1
...
@@ -420,7 +420,7 @@ namespace dlib
...
@@ -420,7 +420,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- rows contains
elements of type
long
- rows contains
integral elements (e.g. int,
long
)
- 0 <= min(rows) && max(rows) < m.nr()
- 0 <= min(rows) && max(rows) < m.nr()
- rows.nr() == 1 || rows.nc() == 1
- rows.nr() == 1 || rows.nc() == 1
(i.e. rows must be a vector)
(i.e. rows must be a vector)
...
@@ -473,7 +473,7 @@ namespace dlib
...
@@ -473,7 +473,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- cols contains
elements of type
long
- cols contains
integral elements (e.g. int,
long
)
- 0 <= min(cols) && max(cols) < m.nc()
- 0 <= min(cols) && max(cols) < m.nc()
- cols.nr() == 1 || cols.nc() == 1
- cols.nr() == 1 || cols.nc() == 1
(i.e. cols must be a vector)
(i.e. cols must be a vector)
...
...
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