"git@developer.sourcefind.cn:change/sglang.git" did not exist on "e290303ea19ebc2287ed55d46dfa078411408bf2"
Commit 7dd725cb authored by Davis King's avatar Davis King
Browse files

Made the matrix sub expression operators work with any kind of

integer ranges rather than just long ranges.
parent 17a46669
...@@ -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),
"\tconst matrix_exp rowm(const matrix_exp& m, const matrix_exp& rows)" "\tconst 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 cols 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(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),
"\tconst matrix_exp colm(const matrix_exp& m, const matrix_exp& cols)" "\tconst matrix_exp colm(const matrix_exp& m, const matrix_exp& cols)"
......
...@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment