You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vectorxd.h 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef VECTORXD_H
  2. #define VECTORXD_H
  3. #include <QDebug>
  4. #include "matrixmxn.h"
  5. #define tmplx template<unsigned X>
  6. #define tmpl template<unsigned X, class T>
  7. tmpl class GenericVector: public GenericMatrix<X, 1, T >
  8. {
  9. public:
  10. using GenericMatrix<X, 1, T >::setScalar;
  11. T& setScalar(unsigned i, double value);
  12. using GenericMatrix<X, 1, T >::getScalar;
  13. double getScalar(unsigned i) const;
  14. double dotProduct(const T& other) const;
  15. T& crossProduct(const T& other);
  16. static T crossProduct(const T &v1, const T &v2);
  17. double norm() const;
  18. double operator[](unsigned i) const;
  19. protected:
  20. using GenericMatrix<X, 1, T >::_scalars;
  21. private:
  22. T* getThis() const;
  23. };
  24. tmplx using VectorXD = MatrixMxN<X, 1>;
  25. tmplx class MatrixMxN<X, 1>: public GenericVector<X, VectorXD<X>>
  26. {
  27. public:
  28. MatrixMxN();
  29. MatrixMxN(double k);
  30. MatrixMxN(const double scalars[X]);
  31. MatrixMxN(const VectorXD<X>& other);
  32. protected:
  33. using GenericMatrix<X, 1, VectorXD<X>>::_scalars;
  34. };
  35. //tmplx QDebug operator<<(QDebug dbg, const VectorXD<X>& v);
  36. #include "vectorxd.hxx"
  37. #endif // VECTORXD_H