#include"matrix.h" Matrix::Matrix() { m_sz_x = 3; m_sz_y = 3; m_values = new double*[m_sz_x]; for (unsigned int i =0;i<m_sz_x; ++i) m_values[i] = new double[m_sz_y]; for ( unsigned int i = 0; i < m_sz_x; ++i ) for ( unsigned int j = 0; j < m_sz_y; ++j ) m_values[i][j] = 0; } Matrix::Matrix(int x, int y ) { } Matrix::~Matrix() { for (unsigned int i =0;i<m_sz_x; ++i) delete[] m_values[i]; delete[] m_values; } double Matrix::GetVal(const unsigned int pos_x_, const unsigned int pos_y_) const { } void Matrix::SetVal(const unsigned int pos_x_, const unsigned int pos_y_, const double val_) { } void Matrix::Add(const ThisType& other) { } void Matrix::Mult(const ThisType& other) { } void Matrix::Print(std::ostream& outstream_) const { for ( unsigned int i = 0; i < m_sz_x; ++i ){ for ( unsigned int j = 0; j < m_sz_y; ++j) std::cout << m_values[i][j] << " " ; std::cout << std::endl; } } //Skalarmultiplikation, nur für Vektoren!!! double Matrix::Dot(const ThisType& other) { if (this->GetSizeY() == 1 && other.GetSizeY() == 1){ double el =0; for (unsigned int i = 0; i < this->GetSizeX(); ++i) el += this->GetVal(i,0)*other.GetVal(i,0); return el; } else{ std::cout << "Vectorproduct is not possible!" << std::endl; return 0.0; } } void Matrix::Resize(const unsigned int size_ ) { for (unsigned int i =0;i<m_sz_x; ++i) delete[] m_values[i]; delete[] m_values; m_sz_x = m_sz_y = size_; m_values = new double*[m_sz_x]; for (unsigned int i =0;i<m_sz_x; ++i) m_values[i] = new double[m_sz_y]; for ( unsigned int i = 0; i < m_sz_x; ++i ) for ( unsigned int j = 0; j < m_sz_y; ++j ) m_values[i][j] = 0; } void Matrix::Resize(const unsigned int size_x, const unsigned int size_y) { } int main() { }