message: Cleanup apply and one useless line
diff: @@ -71,19 +71,13 @@ struct TemplatedOperation {
  template <typename ValueType, typename IndexType>
  void Coo<ValueType, IndexType>::apply(const LinOp *b, LinOp *x) const
  {
  + ASSERT_CONFORMANT(this, b);
  + ASSERT_EQUAL_ROWS(this, x);
  + ASSERT_EQUAL_COLS(b, x);
  using Dense = Dense<ValueType>;
  - auto dense_b = dynamic_cast<const Dense *>(b);
  - auto dense_x = dynamic_cast<Dense *>(x);
  - if (dense_b == nullptr || dense_b->get_executor() != this->get_executor()) {
  - throw NOT_SUPPORTED(b);
  - }
  - if (dense_x == nullptr || dense_x->get_executor() != this->get_executor()) {
  - throw NOT_SUPPORTED(x);
  - }
  -
  this->get_executor()->run(
  TemplatedOperation<ValueType, IndexType>::make_spmv_operation(
  - this, dense_b, dense_x));
  + this, as<Dense>(b), as<Dense>(x)));
  }
  @@ -91,39 +85,16 @@ template <typename ValueType, typename IndexType>
  void Coo<ValueType, IndexType>::apply(const LinOp *alpha, const LinOp *b,
  const LinOp *beta, LinOp *x) const
  {
  + ASSERT_CONFORMANT(this, b);
  + ASSERT_EQUAL_ROWS(this, x);
  + ASSERT_EQUAL_COLS(b, x);
  + ASSERT_EQUAL_DIMENSIONS(alpha, size(1, 1));
  + ASSERT_EQUAL_DIMENSIONS(beta, size(1, 1));
  using Dense = Dense<ValueType>;
  - auto dense_b = dynamic_cast<const Dense *>(b);
  - auto dense_alpha = dynamic_cast<const Dense *>(alpha);
  - auto dense_beta = dynamic_cast<const Dense *>(beta);
  - auto dense_x = dynamic_cast<Dense *>(x);
  - if (dense_b == nullptr || dense_b->get_executor() != this->get_executor()) {
  - throw NOT_SUPPORTED(b);
  - }
  - if (dense_alpha == nullptr ||
  - dense_alpha->get_executor() != this->get_executor()) {
  - throw NOT_SUPPORTED(alpha);
  - }
  - if (dense_beta == nullptr ||
  - dense_beta->get_executor() != this->get_executor()) {
  - throw NOT_SUPPORTED(beta);
  - }
  - if (dense_x == nullptr || dense_x->get_executor() != this->get_executor()) {
  - throw NOT_SUPPORTED(x);
  - }
  -
  this->get_executor()->run(
  TemplatedOperation<ValueType, IndexType>::make_advanced_spmv_operation(
  - dense_alpha, this, dense_b, dense_beta, dense_x));
  -}
  -
  -
  -template <typename ValueType, typename IndexType>
  -void Coo<ValueType, IndexType>::clear()
  -{
  - this->set_dimensions(0, 0, 0);
  - values_.clear();
  - col_idxs_.clear();
  - row_idxs_.clear();
  + as<Dense>(alpha), this, as<Dense>(b), as<Dense>(beta),
  + as<Dense>(x)));
  }
  @@ -158,7 +129,6 @@ void Coo<ValueType, IndexType>::move_to(Csr<ValueType, IndexType> *result)
  template <typename ValueType, typename IndexType>
  void Coo<ValueType, IndexType>::read_from_mtx(const std::string &filename)
  {
  - auto exec = this->get_executor();
  auto data = read_raw_from_mtx<ValueType, IndexType>(filename);
  size_type nnz = 0;
  for (const auto &elem : data.nonzeros) {
  