コード例 #1
0
ファイル: AMatrix.hpp プロジェクト: rjk9w5/NinjasProject
Vector<T> operator*(const AMatrix<T>& lhs, const Vector<T>& rhs)
{
  assert(lhs.cols() == rhs.size());
  Vector<T> ret(lhs.rows());
  for(int i=0; i<lhs.rows(); ++i)
  {
    ret[i] = lhs.getRow(i)*rhs;
  }

  return ret;
}
コード例 #2
0
ファイル: AMatrix.hpp プロジェクト: rjk9w5/NinjasProject
bool AMatrix<T>::isEqual(const AMatrix<T>& other) const
{
  if(this->rows() != other.rows() || this->cols() != other.cols())
  {
    return false;
  }

  for(SizeType i = 0; i < this->rows(); i++)
  {
    for(SizeType j = 0; j < this->cols(); j++)
    {
      if(this->get(i, j) != other.get(i, j))
      {
        return false;
      }
    }
  }
  return true;
}