Program Listing for File Vector.hpp

Return to documentation for file (src/LouLib/Math/Vector.hpp)

#ifndef LOULIB_VECTOR_HPP
#define LOULIB_VECTOR_HPP

#include <vector>
#include <stdexcept>
#include <cmath>

namespace LouLib {
    namespace Math {

        class Vector {
        private:
            std::vector<double> data;

        public:
            explicit Vector(int n);

            Vector(std::initializer_list<double> vectorData);

            explicit Vector(std::vector<double> vectorData);

            Vector(const Vector& other);

            double& operator[](int i);

            const double& operator[](int i) const;

            int size() const;

            double norm();

            Vector normalize();

            std::string toString();
        };

        Vector operator+(const Vector& a, const Vector& b);

        Vector operator-(const Vector& a, const Vector& b);

        double operator*(const Vector& a, const Vector& b);

        Vector operator*(const double& a, const Vector& b);

        Vector operator*(const Vector& a, const double& b);

    } // Math
} // LouLib

#endif //LOULIB_VECTOR_HPP