Skip to content

Commit ac8873a

Browse files
Gilkarlnapf
Gil
authored andcommitted
Fix matrix string (#4624)
1 parent d140884 commit ac8873a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/shogun/lib/SGMatrix.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -518,15 +518,15 @@ std::string SGMatrix<T>::to_string(const T* matrix, index_t rows, index_t cols)
518518
{
519519
std::stringstream ss;
520520
ss << std::boolalpha << "[\n";
521-
if (rows == 0 || cols == 0)
521+
if (rows != 0 && cols != 0)
522522
{
523523
for (int64_t i=0; i<rows; ++i)
524524
{
525525
ss << "[";
526526
for (int64_t j=0; j<cols; ++j)
527527
ss << "\t" << matrix[j*rows+i]
528528
<< (j == cols - 1 ? "" : ",");
529-
ss << "]\n" << (i == rows-1 ? "" : ",");
529+
ss << "]" << (i == rows-1 ? "" : ",") << "\n";
530530
}
531531
}
532532
ss << "]";

0 commit comments

Comments
 (0)