Commit c4a63d77 authored by Davis King's avatar Davis King

Fixed bug in the axpy/scpy BLAS bindings which triggered when empty matrices

were assigned to each other.
parent 8d217377
...@@ -545,9 +545,9 @@ namespace dlib ...@@ -545,9 +545,9 @@ namespace dlib
DLIB_ADD_BLAS_BINDING(m) DLIB_ADD_BLAS_BINDING(m)
{ {
if (transpose == false) const int N = static_cast<int>(src.size());
if (transpose == false && N != 0)
{ {
const int N = static_cast<int>(src.size());
if (add_to) if (add_to)
{ {
cblas_axpy(N, alpha, get_ptr(src), 1, get_ptr(dest), 1); cblas_axpy(N, alpha, get_ptr(src), 1, get_ptr(dest), 1);
...@@ -574,9 +574,9 @@ namespace dlib ...@@ -574,9 +574,9 @@ namespace dlib
DLIB_ADD_BLAS_BINDING(rv) DLIB_ADD_BLAS_BINDING(rv)
{ {
if (transpose == false) const int N = static_cast<int>(src.size());
if (transpose == false && N != 0)
{ {
const int N = static_cast<int>(src.size());
if (add_to) if (add_to)
{ {
cblas_axpy(N, alpha, get_ptr(src), 1, get_ptr(dest), 1); cblas_axpy(N, alpha, get_ptr(src), 1, get_ptr(dest), 1);
...@@ -603,9 +603,9 @@ namespace dlib ...@@ -603,9 +603,9 @@ namespace dlib
DLIB_ADD_BLAS_BINDING(cv) DLIB_ADD_BLAS_BINDING(cv)
{ {
if (transpose == false) const int N = static_cast<int>(src.size());
if (transpose == false && N != 0)
{ {
const int N = static_cast<int>(src.size());
if (add_to) if (add_to)
{ {
cblas_axpy(N, alpha, get_ptr(src), 1, get_ptr(dest), 1); cblas_axpy(N, alpha, get_ptr(src), 1, get_ptr(dest), 1);
......
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