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
6a8b0e74
Commit
6a8b0e74
authored
May 24, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Relaxed some excessively restrictive requires clauses.
parent
29f22685
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
matrix_utilities.h
dlib/matrix/matrix_utilities.h
+15
-11
matrix_utilities_abstract.h
dlib/matrix/matrix_utilities_abstract.h
+7
-7
No files found.
dlib/matrix/matrix_utilities.h
View file @
6a8b0e74
...
@@ -1677,7 +1677,7 @@ namespace dlib
...
@@ -1677,7 +1677,7 @@ namespace dlib
const
T
&
val
const
T
&
val
)
)
{
{
DLIB_ASSERT
(
nr
>
0
&&
nc
>
0
,
DLIB_ASSERT
(
nr
>
=
0
&&
nc
>=
0
,
"
\t
const matrix_exp uniform_matrix<T>(nr, nc, val)"
"
\t
const matrix_exp uniform_matrix<T>(nr, nc, val)"
<<
"
\n\t
nr and nc have to be bigger than 0"
<<
"
\n\t
nr and nc have to be bigger than 0"
<<
"
\n\t
nr: "
<<
nr
<<
"
\n\t
nr: "
<<
nr
...
@@ -1697,9 +1697,9 @@ namespace dlib
...
@@ -1697,9 +1697,9 @@ namespace dlib
long
nc
long
nc
)
)
{
{
DLIB_ASSERT
(
nr
>
0
&&
nc
>
0
,
DLIB_ASSERT
(
nr
>
=
0
&&
nc
>=
0
,
"
\t
const matrix_exp zeros_matrix<T>(nr, nc)"
"
\t
const matrix_exp zeros_matrix<T>(nr, nc)"
<<
"
\n\t
nr and nc have to be
bigger than
0"
<<
"
\n\t
nr and nc have to be
>=
0"
<<
"
\n\t
nr: "
<<
nr
<<
"
\n\t
nr: "
<<
nr
<<
"
\n\t
nc: "
<<
nc
<<
"
\n\t
nc: "
<<
nc
);
);
...
@@ -1716,9 +1716,9 @@ namespace dlib
...
@@ -1716,9 +1716,9 @@ namespace dlib
const
matrix_exp
<
EXP
>&
mat
const
matrix_exp
<
EXP
>&
mat
)
)
{
{
DLIB_ASSERT
(
mat
.
nr
()
>
0
&&
mat
.
nc
()
>
0
,
DLIB_ASSERT
(
mat
.
nr
()
>
=
0
&&
mat
.
nc
()
>=
0
,
"
\t
const matrix_exp zeros_matrix(mat)"
"
\t
const matrix_exp zeros_matrix(mat)"
<<
"
\n\t
nr and nc have to be
bigger than
0"
<<
"
\n\t
nr and nc have to be
>=
0"
<<
"
\n\t
mat.nr(): "
<<
mat
.
nr
()
<<
"
\n\t
mat.nr(): "
<<
mat
.
nr
()
<<
"
\n\t
mat.nc(): "
<<
mat
.
nc
()
<<
"
\n\t
mat.nc(): "
<<
mat
.
nc
()
);
);
...
@@ -1737,9 +1737,9 @@ namespace dlib
...
@@ -1737,9 +1737,9 @@ namespace dlib
long
nc
long
nc
)
)
{
{
DLIB_ASSERT
(
nr
>
0
&&
nc
>
0
,
DLIB_ASSERT
(
nr
>
=
0
&&
nc
>=
0
,
"
\t
const matrix_exp ones_matrix<T>(nr, nc)"
"
\t
const matrix_exp ones_matrix<T>(nr, nc)"
<<
"
\n\t
nr and nc have to be
bigger than
0"
<<
"
\n\t
nr and nc have to be
>=
0"
<<
"
\n\t
nr: "
<<
nr
<<
"
\n\t
nr: "
<<
nr
<<
"
\n\t
nc: "
<<
nc
<<
"
\n\t
nc: "
<<
nc
);
);
...
@@ -1756,9 +1756,9 @@ namespace dlib
...
@@ -1756,9 +1756,9 @@ namespace dlib
const
matrix_exp
<
EXP
>&
mat
const
matrix_exp
<
EXP
>&
mat
)
)
{
{
DLIB_ASSERT
(
mat
.
nr
()
>
0
&&
mat
.
nc
()
>
0
,
DLIB_ASSERT
(
mat
.
nr
()
>
=
0
&&
mat
.
nc
()
>=
0
,
"
\t
const matrix_exp ones_matrix(mat)"
"
\t
const matrix_exp ones_matrix(mat)"
<<
"
\n\t
nr and nc have to be
bigger than
0"
<<
"
\n\t
nr and nc have to be
>=
0"
<<
"
\n\t
mat.nr(): "
<<
mat
.
nr
()
<<
"
\n\t
mat.nr(): "
<<
mat
.
nr
()
<<
"
\n\t
mat.nc(): "
<<
mat
.
nc
()
<<
"
\n\t
mat.nc(): "
<<
mat
.
nc
()
);
);
...
@@ -4007,11 +4007,13 @@ namespace dlib
...
@@ -4007,11 +4007,13 @@ namespace dlib
// don't have the same number of rows
// don't have the same number of rows
COMPILE_TIME_ASSERT
(
EXP1
::
NR
==
EXP2
::
NR
||
(
EXP1
::
NR
*
EXP2
::
NR
==
0
));
COMPILE_TIME_ASSERT
(
EXP1
::
NR
==
EXP2
::
NR
||
(
EXP1
::
NR
*
EXP2
::
NR
==
0
));
DLIB_ASSERT
(
a
.
nr
()
==
b
.
nr
(),
DLIB_ASSERT
(
a
.
nr
()
==
b
.
nr
()
||
a
.
size
()
==
0
||
b
.
size
()
==
0
,
"
\t
const matrix_exp join_rows(const matrix_exp& a, const matrix_exp& b)"
"
\t
const matrix_exp join_rows(const matrix_exp& a, const matrix_exp& b)"
<<
"
\n\t
You can only use join_rows() if both matrices have the same number of rows"
<<
"
\n\t
You can only use join_rows() if both matrices have the same number of rows"
<<
"
\n\t
a.nr(): "
<<
a
.
nr
()
<<
"
\n\t
a.nr(): "
<<
a
.
nr
()
<<
"
\n\t
b.nr(): "
<<
b
.
nr
()
<<
"
\n\t
b.nr(): "
<<
b
.
nr
()
<<
"
\n\t
a.nc(): "
<<
a
.
nc
()
<<
"
\n\t
b.nc(): "
<<
b
.
nc
()
);
);
typedef
op_join_rows
<
EXP1
,
EXP2
>
op
;
typedef
op_join_rows
<
EXP1
,
EXP2
>
op
;
...
@@ -4081,9 +4083,11 @@ namespace dlib
...
@@ -4081,9 +4083,11 @@ namespace dlib
// don't have the same number of columns
// don't have the same number of columns
COMPILE_TIME_ASSERT
(
EXP1
::
NC
==
EXP2
::
NC
||
(
EXP1
::
NC
*
EXP2
::
NC
==
0
));
COMPILE_TIME_ASSERT
(
EXP1
::
NC
==
EXP2
::
NC
||
(
EXP1
::
NC
*
EXP2
::
NC
==
0
));
DLIB_ASSERT
(
a
.
nc
()
==
b
.
nc
(),
DLIB_ASSERT
(
a
.
nc
()
==
b
.
nc
()
||
a
.
size
()
==
0
||
b
.
size
()
==
0
,
"
\t
const matrix_exp join_cols(const matrix_exp& a, const matrix_exp& b)"
"
\t
const matrix_exp join_cols(const matrix_exp& a, const matrix_exp& b)"
<<
"
\n\t
You can only use join_cols() if both matrices have the same number of columns"
<<
"
\n\t
You can only use join_cols() if both matrices have the same number of columns"
<<
"
\n\t
a.nr(): "
<<
a
.
nr
()
<<
"
\n\t
b.nr(): "
<<
b
.
nr
()
<<
"
\n\t
a.nc(): "
<<
a
.
nc
()
<<
"
\n\t
a.nc(): "
<<
a
.
nc
()
<<
"
\n\t
b.nc(): "
<<
b
.
nc
()
<<
"
\n\t
b.nc(): "
<<
b
.
nc
()
);
);
...
...
dlib/matrix/matrix_utilities_abstract.h
View file @
6a8b0e74
...
@@ -241,7 +241,7 @@ namespace dlib
...
@@ -241,7 +241,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- nr >
0 && nc >
0
- nr >
= 0 && nc >=
0
ensures
ensures
- returns an nr by nc matrix with elements of type T and all set to val.
- returns an nr by nc matrix with elements of type T and all set to val.
!*/
!*/
...
@@ -253,7 +253,7 @@ namespace dlib
...
@@ -253,7 +253,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- mat.nr() >
0 && mat.nc() >
0
- mat.nr() >
= 0 && mat.nc() >=
0
ensures
ensures
- Let T denote the type of element in mat. Then this function
- Let T denote the type of element in mat. Then this function
returns uniform_matrix<T>(mat.nr(), mat.nc(), 1)
returns uniform_matrix<T>(mat.nr(), mat.nc(), 1)
...
@@ -270,7 +270,7 @@ namespace dlib
...
@@ -270,7 +270,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- nr >
0 && nc >
0
- nr >
= 0 && nc >=
0
ensures
ensures
- returns uniform_matrix<T>(nr, nc, 1)
- returns uniform_matrix<T>(nr, nc, 1)
!*/
!*/
...
@@ -282,7 +282,7 @@ namespace dlib
...
@@ -282,7 +282,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- mat.nr() >
0 && mat.nc() >
0
- mat.nr() >
= 0 && mat.nc() >=
0
ensures
ensures
- Let T denote the type of element in mat. Then this function
- Let T denote the type of element in mat. Then this function
returns uniform_matrix<T>(mat.nr(), mat.nc(), 0)
returns uniform_matrix<T>(mat.nr(), mat.nc(), 0)
...
@@ -299,7 +299,7 @@ namespace dlib
...
@@ -299,7 +299,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- nr >
0 && nc >
0
- nr >
= 0 && nc >=
0
ensures
ensures
- returns uniform_matrix<T>(nr, nc, 0)
- returns uniform_matrix<T>(nr, nc, 0)
!*/
!*/
...
@@ -797,7 +797,7 @@ namespace dlib
...
@@ -797,7 +797,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- a.nr() == b.nr()
- a.nr() == b.nr()
|| a.size() == 0 || b.size() == 0
- a and b both contain the same type of element
- a and b both contain the same type of element
ensures
ensures
- This function joins two matrices together by concatenating their rows.
- This function joins two matrices together by concatenating their rows.
...
@@ -820,7 +820,7 @@ namespace dlib
...
@@ -820,7 +820,7 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- a.nc() == b.nc()
- a.nc() == b.nc()
|| a.size() == 0 || b.size() == 0
- a and b both contain the same type of element
- a and b both contain the same type of element
ensures
ensures
- This function joins two matrices together by concatenating their columns.
- This function joins two matrices together by concatenating their columns.
...
...
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