//#####################################################################
// Copyright 2006-2007, Geoffrey Irving, Andrew Selle.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Function Dot_Product 
//#####################################################################
#ifndef __Dot_Product__
#define __Dot_Product__

#include <Core/Utilities/TYPE_UTILITIES.h>
#include <Core/Vectors/SCALAR_POLICY.h>
namespace PhysBAM{

template<class TV>
inline typename TV::SCALAR Dot_Product(const TV& v1,const TV& v2)
{return v1.Dot(v2);}

template<class T>
inline enable_if_t<is_same<SCALAR_TYPE<T>,T>::value,T> Dot_Product(const T a1,const T a2)
{return a1*a2;}

template<class T>
inline enable_if_t<is_same<SCALAR_TYPE<T>,T>::value,T> Magnitude_Squared(const T a)
{return a*a;}

template<class TV>
inline typename TV::SCALAR Magnitude_Squared(const TV& v)
{return v.Magnitude_Squared();}
}
#endif
