Skip to content

Commit

Permalink
Add ell scale function
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikvn committed Jan 12, 2024
1 parent 273153e commit fba8164
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/matrix/batch_ell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,24 @@ void Ell<ValueType, IndexType>::move_to(
GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE(GKO_DECLARE_BATCH_ELL_MATRIX);


template <typename ValueType, typename IndexType>
void two_sided_scale(const array<ValueType>& col_scale,
const array<ValueType>& row_scale,
batch::matrix::Ell<ValueType, IndexType>* in_out)
{
GKO_NOT_IMPLEMENTED;
}


#define GKO_DECLARE_TWO_SIDED_BATCH_SCALE(_vtype, _itype) \
void two_sided_scale(const array<_vtype>& col_scale, \
const array<_vtype>& row_scale, \
batch::matrix::Ell<_vtype, _itype>* in_out)

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INT32_TYPE(
GKO_DECLARE_TWO_SIDED_BATCH_SCALE);


} // namespace matrix
} // namespace batch
} // namespace gko
9 changes: 9 additions & 0 deletions include/ginkgo/core/matrix/batch_csr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,15 @@ class Csr final
};


/**
* Performs in-place row and column scaling for a given matrix.
*
* @param col_scale the column scalars
* @param row_scale the row scalars
* @param in_out the matrix to be scaled
*
* @note the operation is performed in-place
*/
template <typename ValueType, typename IndexType>
void two_sided_scale(const array<ValueType>& col_scale,
const array<ValueType>& row_scale,
Expand Down
9 changes: 9 additions & 0 deletions include/ginkgo/core/matrix/batch_dense.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,15 @@ class Dense final : public EnableBatchLinOp<Dense<ValueType>>,
};


/**
* Performs in-place row and column scaling for a given matrix.
*
* @param col_scale the column scalars
* @param row_scale the row scalars
* @param in_out the matrix to be scaled
*
* @note the operation is performed in-place
*/
template <typename ValueType>
void two_sided_scale(const array<ValueType>& col_scale,
const array<ValueType>& row_scale,
Expand Down
15 changes: 15 additions & 0 deletions include/ginkgo/core/matrix/batch_ell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,21 @@ class Ell final
};


/**
* Performs in-place row and column scaling for a given matrix.
*
* @param col_scale the column scalars
* @param row_scale the row scalars
* @param in_out the matrix to be scaled
*
* @note the operation is performed in-place
*/
template <typename ValueType, typename IndexType>
void two_sided_scale(const array<ValueType>& col_scale,
const array<ValueType>& row_scale,
batch::matrix::Ell<ValueType, IndexType>* in_out);


} // namespace matrix
} // namespace batch
} // namespace gko
Expand Down

0 comments on commit fba8164

Please sign in to comment.