"examples/git@developer.sourcefind.cn:OpenDAS/torchaudio.git" did not exist on "4fa77623ef2da30198855e31be5b3b8351395d27"
Commit 9926bc92 authored by Davis King's avatar Davis King
Browse files

Added missing requirement to the dot() function for matrices.

parent 8dec52ca
...@@ -577,9 +577,10 @@ namespace dlib ...@@ -577,9 +577,10 @@ namespace dlib
COMPILE_TIME_ASSERT(EXP1::NR*EXP1::NC == 0 || COMPILE_TIME_ASSERT(EXP1::NR*EXP1::NC == 0 ||
EXP2::NR*EXP2::NC == 0); EXP2::NR*EXP2::NC == 0);
DLIB_ASSERT(is_vector(m1) && is_vector(m2) && m1.size() == m2.size(), DLIB_ASSERT(is_vector(m1) && is_vector(m2) && m1.size() == m2.size() &&
m1.size() > 0,
"\t type dot(const matrix_exp& m1, const matrix_exp& m2)" "\t type dot(const matrix_exp& m1, const matrix_exp& m2)"
<< "\n\t You can only compute the dot product between vectors of equal length" << "\n\t You can only compute the dot product between non-empty vectors of equal length."
<< "\n\t is_vector(m1): " << is_vector(m1) << "\n\t is_vector(m1): " << is_vector(m1)
<< "\n\t is_vector(m2): " << is_vector(m2) << "\n\t is_vector(m2): " << is_vector(m2)
<< "\n\t m1.size(): " << m1.size() << "\n\t m1.size(): " << m1.size()
......
...@@ -93,6 +93,7 @@ namespace dlib ...@@ -93,6 +93,7 @@ namespace dlib
- is_vector(m1) == true - is_vector(m1) == true
- is_vector(m2) == true - is_vector(m2) == true
- m1.size() == m2.size() - m1.size() == m2.size()
- m1.size() > 0
ensures ensures
- returns the dot product between m1 and m2. That is, this function - returns the dot product between m1 and m2. That is, this function
computes and returns the sum, for all i, of m1(i)*m2(i). computes and returns the sum, for all i, of m1(i)*m2(i).
......
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