Skip to content

Commit

Permalink
Added debugging method to identify if matrix represents row_vector, c…
Browse files Browse the repository at this point in the history
…olumn_vector, or a scalar value. Potential refactoring with Inheritence.
  • Loading branch information
alejandroarmas committed Jun 2, 2022
1 parent c345381 commit e4e4c4f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void Matrix::Representation::put(u_int64_t r, u_int64_t c, float val) noexcept {
Matrix::Representation::Type Matrix::Representation::get_type(void) const noexcept {
bool is_row_vector = rows == 1;
bool is_column_vector = columns == 1;
bool is_scalar = is_row_vector && is_column_vector;
bool is_scalar = is_row_vector && is_column_vector;


if (is_scalar)
Expand All @@ -69,6 +69,23 @@ Matrix::Representation::Type Matrix::Representation::get_type(void) const noexce
}


std::string_view Matrix::Representation::get_type_string(void) const noexcept {
bool is_row_vector = rows == 1;
bool is_column_vector = columns == 1;
bool is_scalar = is_row_vector && is_column_vector;


if (is_scalar)
return "SCALAR";
else if (is_column_vector)
return "COLUMN_VECTOR";
else if (is_row_vector)
return "ROW_VECTOR";
else
return "MATRIX";
}





0 comments on commit e4e4c4f

Please sign in to comment.