Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(matrix): add row and col getters #37

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/include/jml/math/matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ int get_position(int i, int j);
public:
Matrix(int m, int n);
~Matrix();
int get_n_rows();
int get_n_cols();
void set_entry(int i, int j, double value);
std::unique_ptr<Vector> multiply(std::unique_ptr<Vector>);

Expand Down
8 changes: 8 additions & 0 deletions core/src/math/matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ Matrix::~Matrix() {
delete this->entries;
}

int Matrix::get_n_rows() {
return m;
}

int Matrix::get_n_cols() {
return n;
}

int Matrix::get_position(int i, int j) {
return i * this->n + j;
}
Expand Down
Loading