Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef MATRIX_HPP
- #define MATRIX_HPP
- #include <cmath>
- #include <cassert>
- #include <iostream>
- class Matrix {
- private:
- int height;
- int width;
- double* coeff;
- public:
- //konstruktor, destruktor, zuweisung
- Matrix();
- Matrix(int height_new, int width_new, double init=0);
- Matrix(const Matrix&);
- ~Matrix();
- Matrix& operator=(const Matrix&);
- //size of zurueckgeben
- int rows() const;
- int columns() const;
- //lesen und schreiben von matrix eintraegen A(j, k)
- const double& operator()(int j, int k) const;
- double& operator()(int j, int k);
- //speichervektoren lesen und schreiben A[ell]
- const double& operator[](int ell) const;
- double& operator[](int ell);
- //norm berechnen
- double norm() const;
- };
- class SqMatrix : public Matrix {
- //keine neue elemente, nur neue methoden
- public:
- SqMatrix();
- SqMatrix(int dim, double init=0);
- SqMatrix(const Matrix&); //type cast Matrix to SqMatrix
- int dimension() const;
- };
- //matrix-matrix summe und produkt
- const Matrix operator+(const Matrix&, const Matrix&);
- const Matrix operator*(const Matrix&, const Matrix&);
- //print via output stream
- std::ostream& operator<<(std::ostream& output, const Matrix&);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement