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
38ed409e
Commit
38ed409e
authored
Jan 14, 2013
by
Davis King
Browse files
Added missing asserts
parent
f4221249
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
dlib/statistics/cca.h
dlib/statistics/cca.h
+30
-0
No files found.
dlib/statistics/cca.h
View file @
38ed409e
...
...
@@ -20,6 +20,15 @@ namespace dlib
const
matrix
<
T
>&
R
)
{
DLIB_ASSERT
(
L
.
size
()
>
0
&&
R
.
size
()
>
0
&&
L
.
nr
()
==
R
.
nr
(),
"
\t
matrix compute_correlations()"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
L.size(): "
<<
L
.
size
()
<<
"
\n\t
R.size(): "
<<
R
.
size
()
<<
"
\n\t
L.nr(): "
<<
L
.
nr
()
<<
"
\n\t
R.nr(): "
<<
R
.
nr
()
);
matrix
<
T
>
A
,
B
,
C
;
A
=
diag
(
trans
(
R
)
*
L
);
B
=
sqrt
(
diag
(
trans
(
L
)
*
L
));
...
...
@@ -89,6 +98,16 @@ namespace dlib
unsigned
long
q
=
2
)
{
DLIB_ASSERT
(
num_correlations
>
0
&&
L
.
size
()
>
0
&&
R
.
size
()
>
0
&&
L
.
nr
()
==
R
.
nr
(),
"
\t
matrix cca()"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
num_correlations: "
<<
num_correlations
<<
"
\n\t
L.size(): "
<<
L
.
size
()
<<
"
\n\t
R.size(): "
<<
R
.
size
()
<<
"
\n\t
L.nr(): "
<<
L
.
nr
()
<<
"
\n\t
R.nr(): "
<<
R
.
nr
()
);
using
std
::
min
;
const
unsigned
long
n
=
min
(
num_correlations
,
(
unsigned
long
)
min
(
R
.
nr
(),
min
(
L
.
nc
(),
R
.
nc
())));
return
impl_cca
(
L
,
R
,
Ltrans
,
Rtrans
,
num_correlations
,
extra_rank
,
q
,
n
);
...
...
@@ -107,6 +126,17 @@ namespace dlib
unsigned
long
q
=
2
)
{
DLIB_ASSERT
(
num_correlations
>
0
&&
L
.
size
()
==
R
.
size
()
&&
max_index_plus_one
(
L
)
>
0
&&
max_index_plus_one
(
R
)
>
0
,
"
\t
matrix cca()"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
num_correlations: "
<<
num_correlations
<<
"
\n\t
L.size(): "
<<
L
.
size
()
<<
"
\n\t
R.size(): "
<<
R
.
size
()
<<
"
\n\t
max_index_plus_one(L): "
<<
max_index_plus_one
(
L
)
<<
"
\n\t
max_index_plus_one(R): "
<<
max_index_plus_one
(
R
)
);
using
std
::
min
;
const
unsigned
long
n
=
min
(
max_index_plus_one
(
L
),
max_index_plus_one
(
R
));
const
unsigned
long
num_output_correlations
=
min
(
num_correlations
,
min
(
R
.
size
(),
n
));
...
...
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