Skip to content

Commit 784a75f

Browse files
committed
gemv null handling
1 parent 28764ee commit 784a75f

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

src/csrc/quadblas_interface.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@ qblas_gemv(char layout, char trans, size_t m, size_t n,
4646
Sleef_quad *beta, Sleef_quad *y, size_t incy)
4747
{
4848
if (m == 0 || n == 0) {
49-
if (y && beta) {
50-
int do_trans = (trans == 'T' || trans == 't' || trans == 'C' || trans == 'c');
51-
size_t y_len = do_trans ? n : m;
52-
Sleef_quad zero = Sleef_cast_from_doubleq1(0.0);
53-
int beta_zero = Sleef_icmpeqq1(*beta, zero);
54-
for (size_t i = 0; i < y_len; i++) {
55-
y[i * incy] = beta_zero ? zero : Sleef_mulq1_u05(*beta, y[i * incy]);
56-
}
49+
int do_trans = (trans == 'T' || trans == 't' || trans == 'C' || trans == 'c');
50+
size_t y_len = do_trans ? n : m;
51+
if (y_len == 0) {
52+
return 0;
53+
}
54+
if (!y || !beta) {
55+
return -1;
56+
}
57+
Sleef_quad zero = Sleef_cast_from_doubleq1(0.0);
58+
int beta_zero = Sleef_icmpeqq1(*beta, zero);
59+
for (size_t i = 0; i < y_len; i++) {
60+
y[i * incy] = beta_zero ? zero : Sleef_mulq1_u05(*beta, y[i * incy]);
5761
}
5862
return 0;
5963
}

0 commit comments

Comments
 (0)