Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
feat: rename sub_array_c -> sub_array_col
Browse files Browse the repository at this point in the history
  • Loading branch information
tiankaima committed Jan 2, 2024
1 parent 073e061 commit d69915a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/HouseholderMethod/Bidiagonalization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Bidiagonalization_Result BidiagonalizationMethod(const Matrix &matrix) {
auto V = Matrix::identity(n);

for (ull k = 0; k < n; k++) {
auto x = A.sub_array_c(k, m, k);
auto x = A.sub_array_col(k, m, k);
auto [v, beta] = HouseHolderMethod(x);

auto P = Matrix::identity(m - k);
Expand All @@ -31,7 +31,7 @@ Bidiagonalization_Result BidiagonalizationMethod(const Matrix &matrix) {
U = U * P_extended;

if (k < n - 2) {
auto x = A.sub_array_r(k, k + 1, n);
auto x = A.sub_array_row(k, k + 1, n);
auto [v, beta] = HouseHolderMethod(x);

auto Q = Matrix::identity(n - k - 1);
Expand Down
8 changes: 4 additions & 4 deletions lib/Matrix/Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ class Matrix {
/// Return a sub-matrix of the matrix [start, end) x [start, end), both use index that start from 0
[[nodiscard]] Matrix sub_matrix(ull start_row, ull end_row, ull start_col, ull end_col) const;

[[nodiscard]] Vector sub_array_r(ull row, ull start_col, ull end_col) const;
[[nodiscard]] Vector sub_array_row(ull row, ull start_col, ull end_col) const;

[[nodiscard]] Vector sub_array_c(ull start_row, ull end_row, ull col) const;
[[nodiscard]] Vector sub_array_col(ull start_row, ull end_row, ull col) const;

/// Return only the diagonal elements of the matrix
[[nodiscard]] Matrix sub_diagonal() const;
Expand All @@ -94,9 +94,9 @@ class Matrix {
/// \warning this is often used in conjunction with sub_matrix()
void set(ull start_row, ull end_row, ull start_col, ull end_col, const Matrix &other);

void set_r(ull row, ull start_col, ull end_col, const Vector &other);
void set_row(ull row, ull start_col, ull end_col, const Vector &other);

void set_c(ull start_row, ull end_row, ull col, const Vector &other);
void set_col(ull start_row, ull end_row, ull col, const Vector &other);

/*
* MatrixProperties:
Expand Down
8 changes: 4 additions & 4 deletions lib/Matrix/MatrixSubOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Matrix Matrix::sub_matrix(ull start_row, ull end_row, ull start_col, ull end_col
return result;
}

[[nodiscard]] Vector Matrix::sub_array_r(ull row, ull start_col, ull end_col) const {
[[nodiscard]] Vector Matrix::sub_array_row(ull row, ull start_col, ull end_col) const {
#ifdef DEBUG
if (end_col < start_col) {
throw std::invalid_argument("Invalid sub_array size.");
Expand All @@ -42,7 +42,7 @@ Matrix Matrix::sub_matrix(ull start_row, ull end_row, ull start_col, ull end_col
return result;
}

[[nodiscard]] Vector Matrix::sub_array_c(ull start_row, ull end_row, ull col) const {
[[nodiscard]] Vector Matrix::sub_array_col(ull start_row, ull end_row, ull col) const {
#ifdef DEBUG
if (end_row < start_row) {
throw std::invalid_argument("Invalid sub_array size.");
Expand Down Expand Up @@ -128,7 +128,7 @@ void Matrix::set(ull start_row, ull end_row, ull start_col, ull end_col, const M
}
}

void Matrix::set_r(ull row, ull start_col, ull end_col, const Vector &other) {
void Matrix::set_row(ull row, ull start_col, ull end_col, const Vector &other) {
#ifdef DEBUG
if (end_col < start_col) {
throw std::invalid_argument("Invalid sub_array size.");
Expand All @@ -148,7 +148,7 @@ void Matrix::set_r(ull row, ull start_col, ull end_col, const Vector &other) {
}
}

void Matrix::set_c(ull start_row, ull end_row, ull col, const Vector &other) {
void Matrix::set_col(ull start_row, ull end_row, ull col, const Vector &other) {
#ifdef DEBUG
if (end_row < start_row) {
throw std::invalid_argument("Invalid sub_array size.");
Expand Down

0 comments on commit d69915a

Please sign in to comment.