#pragma once


#include "./utils/vector.h"
#include "./utils/matrix.h"


namespace numerics{

	template <typename T>
	void inplace_vecclip_high(utils::Vector<T>& a, T high){
		uint64_t N = a.size();

		for (uint64_t i = 0; i < N; ++i){
			if (a[i] > high){
				a[i] = high;
			}
		}
	}
	template <typename T>
	void inplace_vecclip_low(utils::Vector<T>& a, T low){
		uint64_t N = a.size();

		for (uint64_t i = 0; i < N; ++i){
			if (a[i] < low){
				a[i] = low;
			}
		}
	}
	template <typename T>
	void inplace_vecclip(utils::Vector<T>& a, T low, T high){
		uint64_t N = a.size();

		for (uint64_t i = 0; i < N; ++i){
			if (a[i] > high){
				a[i] = high;
			}else if (a[i] < low){
				a[i] = low;
			}
		}
	}
	template <typename Td, typename Ti>
	utils::Vector<Td> vecclip_high(const utils::Vector<Ti>& a, Td high){

		utils::Vector<Td> b = a;
		inplace_vecclip_high(b, high);

		return b;
	}
	template <typename Td, typename Ti>
	utils::Vector<Td> vecclip_low(const utils::Vector<Ti>& a, Td low){

		utils::Vector<Td> b = a;
		inplace_vecclip_low(b, low);

		return b;
	}
	template <typename Td, typename Ti>
	utils::Vector<Td> vecclip(const utils::Vector<Ti>& a, Td low, Td high){

		utils::Vector<Td> b = a;
		inplace_vecclip(b, low, high);

		return b;
	}


} // namespace numerics

