Loading src/TNL/Containers/StaticVector.h +23 −56 Original line number Diff line number Diff line Loading @@ -17,14 +17,14 @@ namespace TNL { namespace Containers { template< int Size, typename Real = double > class StaticVector : public Containers::StaticArray< Size, Real > class StaticVector : public StaticArray< Size, Real > { public: typedef Real RealType; typedef StaticVector< Size, Real > ThisType; enum { size = Size }; using Containers::StaticArray< Size, Real >::operator=; using StaticArray< Size, Real >::operator=; __cuda_callable__ StaticVector(); Loading Loading @@ -92,32 +92,23 @@ class StaticVector : public Containers::StaticArray< Size, Real > __cuda_callable__ operator StaticVector< Size, OtherReal >() const; __cuda_callable__ ThisType abs() const; #ifdef HAVE_MIC __cuda_callable__ inline StaticVector< Size, Real >& operator = ( const StaticVector< Size, Real >& vct ); template< typename Vct > __cuda_callable__ inline StaticVector< Size, Real >& operator = ( const Vct& Real ); #endif __cuda_callable__ Real lpNorm( const Real& p ) const; }; template< typename Real > class StaticVector< 1, Real > : public Containers::StaticArray< 1, Real > class StaticVector< 1, Real > : public StaticArray< 1, Real > { public: typedef Real RealType; typedef StaticVector< 1, Real > ThisType; enum { size = 1 }; using StaticArray< 1, Real >::operator=; __cuda_callable__ StaticVector(); Loading Loading @@ -187,27 +178,20 @@ class StaticVector< 1, Real > : public Containers::StaticArray< 1, Real > __cuda_callable__ ThisType abs() const; #ifdef HAVE_MIC __cuda_callable__ inline StaticVector< 1, Real >& operator = ( const StaticVector< 1, Real >& vct ); template< typename Vct > __cuda_callable__ inline StaticVector< 1, Real >& operator = ( const Vct& Real ); #endif __cuda_callable__ Real lpNorm( const Real& p ) const; }; template< typename Real > class StaticVector< 2, Real > : public Containers::StaticArray< 2, Real > class StaticVector< 2, Real > : public StaticArray< 2, Real > { public: typedef Real RealType; typedef StaticVector< 2, Real > ThisType; enum { size = 2 }; using StaticArray< 2, Real >::operator=; __cuda_callable__ StaticVector(); Loading Loading @@ -280,28 +264,20 @@ class StaticVector< 2, Real > : public Containers::StaticArray< 2, Real > __cuda_callable__ ThisType abs() const; #ifdef HAVE_MIC __cuda_callable__ inline StaticVector< 2, Real >& operator = ( const StaticVector< 2, Real >& vct ); template< typename Vct > __cuda_callable__ inline StaticVector< 2, Real >& operator = ( const Vct& Real ); #endif __cuda_callable__ Real lpNorm( const Real& p ) const; }; template< typename Real > class StaticVector< 3, Real > : public Containers::StaticArray< 3, Real > class StaticVector< 3, Real > : public StaticArray< 3, Real > { public: typedef Real RealType; typedef StaticVector< 3, Real > ThisType; enum { size = 3 }; using StaticArray< 3, Real >::operator=; __cuda_callable__ StaticVector(); Loading Loading @@ -374,15 +350,6 @@ class StaticVector< 3, Real > : public Containers::StaticArray< 3, Real > __cuda_callable__ ThisType abs() const; #ifdef HAVE_MIC __cuda_callable__ inline StaticVector< 3, Real >& operator = ( const StaticVector< 3, Real >& vct ); template< typename Vct > __cuda_callable__ inline StaticVector< 3, Real >& operator = ( const Vct& Real ); #endif __cuda_callable__ Real lpNorm( const Real& p ) const; }; Loading Loading @@ -417,21 +384,21 @@ StaticVector< 3, Real > VectorProduct( const StaticVector< 3, Real >& u, p[ 1 ] = u[ 2 ] * v[ 0 ] - u[ 0 ] * v[ 2 ]; p[ 2 ] = u[ 0 ] * v[ 1 ] - u[ 1 ] * v[ 0 ]; return p; }; } template< typename Real > Real tnlScalarProduct( const StaticVector< 2, Real >& u, const StaticVector< 2, Real >& v ) { return u[ 0 ] * v[ 0 ] + u[ 1 ] * v[ 1 ]; }; } template< typename Real > Real tnlScalarProduct( const StaticVector< 3, Real >& u, const StaticVector< 3, Real >& v ) { return u[ 0 ] * v[ 0 ] + u[ 1 ] * v[ 1 ] + u[ 2 ] * v[ 2 ]; }; } template< typename Real > Real tnlTriangleArea( const StaticVector< 2, Real >& a, Loading @@ -447,8 +414,8 @@ Real tnlTriangleArea( const StaticVector< 2, Real >& a, u2. z() = 0; const StaticVector< 3, Real > v = VectorProduct( u1, u2 ); return 0.5 * ::sqrt( tnlScalarProduct( v, v ) ); }; return 0.5 * TNL::sqrt( tnlScalarProduct( v, v ) ); } template< typename Real > Real tnlTriangleArea( const StaticVector< 3, Real >& a, Loading @@ -464,8 +431,8 @@ Real tnlTriangleArea( const StaticVector< 3, Real >& a, u2. z() = c. z() - a. z(); const StaticVector< 3, Real > v = VectorProduct( u1, u2 ); return 0.5 * ::sqrt( tnlScalarProduct( v, v ) ); }; return 0.5 * TNL::sqrt( tnlScalarProduct( v, v ) ); } } // namespace Containers } // namespace TNL src/TNL/Containers/StaticVector1D_impl.h +3 −22 Original line number Diff line number Diff line Loading @@ -25,21 +25,21 @@ template< typename Real > template< typename _unused > __cuda_callable__ StaticVector< 1, Real >::StaticVector( const Real v[ 1 ] ) : Containers::StaticArray< 1, Real >( v ) : StaticArray< 1, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 1, Real >::StaticVector( const Real& v ) : Containers::StaticArray< 1, Real >( v ) : StaticArray< 1, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 1, Real >::StaticVector( const StaticVector< 1, Real >& v ) : Containers::StaticArray< 1, Real >( v ) : StaticArray< 1, Real >( v ) { } Loading Loading @@ -148,25 +148,6 @@ bool StaticVector< 1, Real >::operator >= ( const StaticVector& v ) const return ( this->data[ 0 ] >= v[ 0 ] ); } #ifdef HAVE_MIC template<typename Real > __cuda_callable__ inline StaticVector< 1, Real >& StaticVector< 1, Real >::operator = ( const StaticVector< 1, Real >& vct ) { StaticArray<1,Real>::operator =(vct); return *this; } template<typename Real > template< typename Vct > __cuda_callable__ inline StaticVector< 1, Real >& StaticVector< 1, Real >::operator = ( const Vct& vct ) { StaticArray<1,Real>::operator =(vct); return *this; } #endif template< typename Real > template< typename OtherReal > __cuda_callable__ Loading src/TNL/Containers/StaticVector2D_impl.h +9 −26 Original line number Diff line number Diff line Loading @@ -25,28 +25,28 @@ template< typename Real > template< typename _unused > __cuda_callable__ StaticVector< 2, Real >::StaticVector( const Real v[ 2 ] ) : Containers::StaticArray< 2, Real >( v ) : StaticArray< 2, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 2, Real >::StaticVector( const Real& v ) : Containers::StaticArray< 2, Real >( v ) : StaticArray< 2, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 2, Real >::StaticVector( const Real& v1, const Real& v2 ) : Containers::StaticArray< 2, Real >( v1, v2 ) : StaticArray< 2, Real >( v1, v2 ) { } template< typename Real > __cuda_callable__ StaticVector< 2, Real >::StaticVector( const StaticVector< 2, Real >& v ) : Containers::StaticArray< 2, Real >( v ) : StaticArray< 2, Real >( v ) { } Loading Loading @@ -167,23 +167,6 @@ bool StaticVector< 2, Real >::operator >= ( const StaticVector& v ) const this->data[ 1 ] >= v[ 1 ] ); } #ifdef HAVE_MIC template<typename Real > __cuda_callable__ inline StaticVector< 2, Real >& StaticVector< 2, Real >::operator = ( const StaticVector< 2, Real >& vct ) { StaticArray<1,Real>::operator =(vct); } template<typename Real > template< typename Vct > __cuda_callable__ inline StaticVector< 2, Real >& StaticVector< 2, Real >::operator = ( const Vct& vct ) { StaticArray<2,Real>::operator =(vct); } #endif template< typename Real > template< typename OtherReal > __cuda_callable__ Loading @@ -201,8 +184,8 @@ __cuda_callable__ StaticVector< 2, Real > StaticVector< 2, Real >::abs() const { return StaticVector< 2, Real >( ::abs( this->data[ 0 ] ), ::abs( this->data[ 1 ] ) ); return StaticVector< 2, Real >( TNL::abs( this->data[ 0 ] ), TNL::abs( this->data[ 1 ] ) ); } template< typename Real > Loading @@ -213,10 +196,10 @@ StaticVector< 2, Real >::lpNorm( const Real& p ) const if( p == 1.0 ) return TNL::abs( this->data[ 0 ] ) + TNL::abs( this->data[ 1 ] ); if( p == 2.0 ) return std::sqrt( this->data[ 0 ] * this->data[ 0 ] + return TNL::sqrt( this->data[ 0 ] * this->data[ 0 ] + this->data[ 1 ] * this->data[ 1 ] ); return std::pow( std::pow( TNL::abs( this->data[ 0 ] ), p ) + std::pow( TNL::abs( this->data[ 1 ] ), p ), 1.0 / p ); return TNL::pow( TNL::pow( TNL::abs( this->data[ 0 ] ), p ) + TNL::pow( TNL::abs( this->data[ 1 ] ), p ), 1.0 / p ); } #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION Loading src/TNL/Containers/StaticVector3D_impl.h +11 −28 Original line number Diff line number Diff line Loading @@ -25,28 +25,28 @@ template< typename Real > template< typename _unused > __cuda_callable__ StaticVector< 3, Real >::StaticVector( const Real v[ 3 ] ) : Containers::StaticArray< 3, Real >( v ) : StaticArray< 3, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 3, Real >::StaticVector( const Real& v ) : Containers::StaticArray< 3, Real >( v ) : StaticArray< 3, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 3, Real >::StaticVector( const Real& v1, const Real& v2, const Real& v3 ) : Containers::StaticArray< 3, Real >( v1, v2, v3 ) : StaticArray< 3, Real >( v1, v2, v3 ) { } template< typename Real > __cuda_callable__ StaticVector< 3, Real >::StaticVector( const StaticVector< 3, Real >& v ) : Containers::StaticArray< 3, Real >( v ) : StaticArray< 3, Real >( v ) { } Loading Loading @@ -179,23 +179,6 @@ bool StaticVector< 3, Real >::operator >= ( const StaticVector& v ) const this->data[ 2 ] >= v[ 2 ] ); } #ifdef HAVE_MIC template<typename Real > __cuda_callable__ inline StaticVector< 3, Real >& StaticVector< 3, Real >::operator = ( const StaticVector< 3, Real >& vct ) { StaticArray<1,Real>::operator =(vct); } template<typename Real > template< typename Vct > __cuda_callable__ inline StaticVector< 3, Real >& StaticVector< 3, Real >::operator = ( const Vct& vct ) { StaticArray<3,Real>::operator =(vct); } #endif template< typename Real > template< typename OtherReal > __cuda_callable__ Loading @@ -214,9 +197,9 @@ __cuda_callable__ StaticVector< 3, Real > StaticVector< 3, Real >::abs() const { return StaticVector< 3, Real >( ::abs( this->data[ 0 ] ), ::abs( this->data[ 1 ] ), ::abs( this->data[ 2 ] ) ); return StaticVector< 3, Real >( TNL::abs( this->data[ 0 ] ), TNL::abs( this->data[ 1 ] ), TNL::abs( this->data[ 2 ] ) ); } template< typename Real > Loading @@ -229,12 +212,12 @@ StaticVector< 3, Real >::lpNorm( const Real& p ) const TNL::abs( this->data[ 1 ] ) + TNL::abs( this->data[ 2 ] ); if( p == 2.0 ) return std::sqrt( this->data[ 0 ] * this->data[ 0 ] + return TNL::sqrt( this->data[ 0 ] * this->data[ 0 ] + this->data[ 1 ] * this->data[ 1 ] + this->data[ 2 ] * this->data[ 2 ] ); return std::pow( std::pow( TNL::abs( this->data[ 0 ] ), p ) + std::pow( TNL::abs( this->data[ 1 ] ), p ) + std::pow( TNL::abs( this->data[ 2 ] ), p ), 1.0 / p ); return TNL::pow( TNL::pow( TNL::abs( this->data[ 0 ] ), p ) + TNL::pow( TNL::abs( this->data[ 1 ] ), p ) + TNL::pow( TNL::abs( this->data[ 2 ] ), p ), 1.0 / p ); } Loading src/TNL/Containers/StaticVector_impl.h +7 −24 Original line number Diff line number Diff line Loading @@ -25,21 +25,21 @@ template< int Size, typename Real > template< typename _unused > __cuda_callable__ StaticVector< Size, Real >::StaticVector( const Real v[ Size ] ) : Containers::StaticArray< Size, Real >( v ) : StaticArray< Size, Real >( v ) { } template< int Size, typename Real > __cuda_callable__ StaticVector< Size, Real >::StaticVector( const Real& v ) : Containers::StaticArray< Size, Real >( v ) : StaticArray< Size, Real >( v ) { } template< int Size, typename Real > __cuda_callable__ StaticVector< Size, Real >::StaticVector( const StaticVector< Size, Real >& v ) : Containers::StaticArray< Size, Real >( v ) : StaticArray< Size, Real >( v ) { } Loading Loading @@ -211,12 +211,12 @@ StaticVector< Size, Real >::lpNorm( const Real& p ) const Real aux = this->data[ 0 ] * this->data[ 0 ]; for( int i = 1; i < Size; i++ ) aux += this->data[ i ] * this->data[ i ]; return std::sqrt( aux ); return TNL::sqrt( aux ); } Real aux = std::pow( TNL::abs( this->data[ 0 ] ), p ); Real aux = TNL::pow( TNL::abs( this->data[ 0 ] ), p ); for( int i = 1; i < Size; i++ ) aux += std::pow( TNL::abs( this->data[ i ] ), p ); return std::pow( aux, 1.0 / p ); aux += TNL::pow( TNL::abs( this->data[ i ] ), p ); return TNL::pow( aux, 1.0 / p ); } template< int Size, typename Real, typename Scalar > Loading @@ -226,23 +226,6 @@ StaticVector< Size, Real > operator * ( const Scalar& c, const StaticVector< Siz return u * c; } #ifdef HAVE_MIC template< int Size, typename Real > __cuda_callable__ inline StaticVector< Size, Real >& StaticVector< Size, Real >::operator = ( const StaticVector< Size, Real >& vct ) { StaticArray<Size,Real>::operator =(vct); } template< int Size, typename Real > template< typename Vct > __cuda_callable__ inline StaticVector< Size, Real >& StaticVector< Size, Real >::operator = ( const Vct& vct ) { StaticArray<Size,Real>::operator =(vct); } #endif #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION #ifndef HAVE_CUDA Loading Loading
src/TNL/Containers/StaticVector.h +23 −56 Original line number Diff line number Diff line Loading @@ -17,14 +17,14 @@ namespace TNL { namespace Containers { template< int Size, typename Real = double > class StaticVector : public Containers::StaticArray< Size, Real > class StaticVector : public StaticArray< Size, Real > { public: typedef Real RealType; typedef StaticVector< Size, Real > ThisType; enum { size = Size }; using Containers::StaticArray< Size, Real >::operator=; using StaticArray< Size, Real >::operator=; __cuda_callable__ StaticVector(); Loading Loading @@ -92,32 +92,23 @@ class StaticVector : public Containers::StaticArray< Size, Real > __cuda_callable__ operator StaticVector< Size, OtherReal >() const; __cuda_callable__ ThisType abs() const; #ifdef HAVE_MIC __cuda_callable__ inline StaticVector< Size, Real >& operator = ( const StaticVector< Size, Real >& vct ); template< typename Vct > __cuda_callable__ inline StaticVector< Size, Real >& operator = ( const Vct& Real ); #endif __cuda_callable__ Real lpNorm( const Real& p ) const; }; template< typename Real > class StaticVector< 1, Real > : public Containers::StaticArray< 1, Real > class StaticVector< 1, Real > : public StaticArray< 1, Real > { public: typedef Real RealType; typedef StaticVector< 1, Real > ThisType; enum { size = 1 }; using StaticArray< 1, Real >::operator=; __cuda_callable__ StaticVector(); Loading Loading @@ -187,27 +178,20 @@ class StaticVector< 1, Real > : public Containers::StaticArray< 1, Real > __cuda_callable__ ThisType abs() const; #ifdef HAVE_MIC __cuda_callable__ inline StaticVector< 1, Real >& operator = ( const StaticVector< 1, Real >& vct ); template< typename Vct > __cuda_callable__ inline StaticVector< 1, Real >& operator = ( const Vct& Real ); #endif __cuda_callable__ Real lpNorm( const Real& p ) const; }; template< typename Real > class StaticVector< 2, Real > : public Containers::StaticArray< 2, Real > class StaticVector< 2, Real > : public StaticArray< 2, Real > { public: typedef Real RealType; typedef StaticVector< 2, Real > ThisType; enum { size = 2 }; using StaticArray< 2, Real >::operator=; __cuda_callable__ StaticVector(); Loading Loading @@ -280,28 +264,20 @@ class StaticVector< 2, Real > : public Containers::StaticArray< 2, Real > __cuda_callable__ ThisType abs() const; #ifdef HAVE_MIC __cuda_callable__ inline StaticVector< 2, Real >& operator = ( const StaticVector< 2, Real >& vct ); template< typename Vct > __cuda_callable__ inline StaticVector< 2, Real >& operator = ( const Vct& Real ); #endif __cuda_callable__ Real lpNorm( const Real& p ) const; }; template< typename Real > class StaticVector< 3, Real > : public Containers::StaticArray< 3, Real > class StaticVector< 3, Real > : public StaticArray< 3, Real > { public: typedef Real RealType; typedef StaticVector< 3, Real > ThisType; enum { size = 3 }; using StaticArray< 3, Real >::operator=; __cuda_callable__ StaticVector(); Loading Loading @@ -374,15 +350,6 @@ class StaticVector< 3, Real > : public Containers::StaticArray< 3, Real > __cuda_callable__ ThisType abs() const; #ifdef HAVE_MIC __cuda_callable__ inline StaticVector< 3, Real >& operator = ( const StaticVector< 3, Real >& vct ); template< typename Vct > __cuda_callable__ inline StaticVector< 3, Real >& operator = ( const Vct& Real ); #endif __cuda_callable__ Real lpNorm( const Real& p ) const; }; Loading Loading @@ -417,21 +384,21 @@ StaticVector< 3, Real > VectorProduct( const StaticVector< 3, Real >& u, p[ 1 ] = u[ 2 ] * v[ 0 ] - u[ 0 ] * v[ 2 ]; p[ 2 ] = u[ 0 ] * v[ 1 ] - u[ 1 ] * v[ 0 ]; return p; }; } template< typename Real > Real tnlScalarProduct( const StaticVector< 2, Real >& u, const StaticVector< 2, Real >& v ) { return u[ 0 ] * v[ 0 ] + u[ 1 ] * v[ 1 ]; }; } template< typename Real > Real tnlScalarProduct( const StaticVector< 3, Real >& u, const StaticVector< 3, Real >& v ) { return u[ 0 ] * v[ 0 ] + u[ 1 ] * v[ 1 ] + u[ 2 ] * v[ 2 ]; }; } template< typename Real > Real tnlTriangleArea( const StaticVector< 2, Real >& a, Loading @@ -447,8 +414,8 @@ Real tnlTriangleArea( const StaticVector< 2, Real >& a, u2. z() = 0; const StaticVector< 3, Real > v = VectorProduct( u1, u2 ); return 0.5 * ::sqrt( tnlScalarProduct( v, v ) ); }; return 0.5 * TNL::sqrt( tnlScalarProduct( v, v ) ); } template< typename Real > Real tnlTriangleArea( const StaticVector< 3, Real >& a, Loading @@ -464,8 +431,8 @@ Real tnlTriangleArea( const StaticVector< 3, Real >& a, u2. z() = c. z() - a. z(); const StaticVector< 3, Real > v = VectorProduct( u1, u2 ); return 0.5 * ::sqrt( tnlScalarProduct( v, v ) ); }; return 0.5 * TNL::sqrt( tnlScalarProduct( v, v ) ); } } // namespace Containers } // namespace TNL
src/TNL/Containers/StaticVector1D_impl.h +3 −22 Original line number Diff line number Diff line Loading @@ -25,21 +25,21 @@ template< typename Real > template< typename _unused > __cuda_callable__ StaticVector< 1, Real >::StaticVector( const Real v[ 1 ] ) : Containers::StaticArray< 1, Real >( v ) : StaticArray< 1, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 1, Real >::StaticVector( const Real& v ) : Containers::StaticArray< 1, Real >( v ) : StaticArray< 1, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 1, Real >::StaticVector( const StaticVector< 1, Real >& v ) : Containers::StaticArray< 1, Real >( v ) : StaticArray< 1, Real >( v ) { } Loading Loading @@ -148,25 +148,6 @@ bool StaticVector< 1, Real >::operator >= ( const StaticVector& v ) const return ( this->data[ 0 ] >= v[ 0 ] ); } #ifdef HAVE_MIC template<typename Real > __cuda_callable__ inline StaticVector< 1, Real >& StaticVector< 1, Real >::operator = ( const StaticVector< 1, Real >& vct ) { StaticArray<1,Real>::operator =(vct); return *this; } template<typename Real > template< typename Vct > __cuda_callable__ inline StaticVector< 1, Real >& StaticVector< 1, Real >::operator = ( const Vct& vct ) { StaticArray<1,Real>::operator =(vct); return *this; } #endif template< typename Real > template< typename OtherReal > __cuda_callable__ Loading
src/TNL/Containers/StaticVector2D_impl.h +9 −26 Original line number Diff line number Diff line Loading @@ -25,28 +25,28 @@ template< typename Real > template< typename _unused > __cuda_callable__ StaticVector< 2, Real >::StaticVector( const Real v[ 2 ] ) : Containers::StaticArray< 2, Real >( v ) : StaticArray< 2, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 2, Real >::StaticVector( const Real& v ) : Containers::StaticArray< 2, Real >( v ) : StaticArray< 2, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 2, Real >::StaticVector( const Real& v1, const Real& v2 ) : Containers::StaticArray< 2, Real >( v1, v2 ) : StaticArray< 2, Real >( v1, v2 ) { } template< typename Real > __cuda_callable__ StaticVector< 2, Real >::StaticVector( const StaticVector< 2, Real >& v ) : Containers::StaticArray< 2, Real >( v ) : StaticArray< 2, Real >( v ) { } Loading Loading @@ -167,23 +167,6 @@ bool StaticVector< 2, Real >::operator >= ( const StaticVector& v ) const this->data[ 1 ] >= v[ 1 ] ); } #ifdef HAVE_MIC template<typename Real > __cuda_callable__ inline StaticVector< 2, Real >& StaticVector< 2, Real >::operator = ( const StaticVector< 2, Real >& vct ) { StaticArray<1,Real>::operator =(vct); } template<typename Real > template< typename Vct > __cuda_callable__ inline StaticVector< 2, Real >& StaticVector< 2, Real >::operator = ( const Vct& vct ) { StaticArray<2,Real>::operator =(vct); } #endif template< typename Real > template< typename OtherReal > __cuda_callable__ Loading @@ -201,8 +184,8 @@ __cuda_callable__ StaticVector< 2, Real > StaticVector< 2, Real >::abs() const { return StaticVector< 2, Real >( ::abs( this->data[ 0 ] ), ::abs( this->data[ 1 ] ) ); return StaticVector< 2, Real >( TNL::abs( this->data[ 0 ] ), TNL::abs( this->data[ 1 ] ) ); } template< typename Real > Loading @@ -213,10 +196,10 @@ StaticVector< 2, Real >::lpNorm( const Real& p ) const if( p == 1.0 ) return TNL::abs( this->data[ 0 ] ) + TNL::abs( this->data[ 1 ] ); if( p == 2.0 ) return std::sqrt( this->data[ 0 ] * this->data[ 0 ] + return TNL::sqrt( this->data[ 0 ] * this->data[ 0 ] + this->data[ 1 ] * this->data[ 1 ] ); return std::pow( std::pow( TNL::abs( this->data[ 0 ] ), p ) + std::pow( TNL::abs( this->data[ 1 ] ), p ), 1.0 / p ); return TNL::pow( TNL::pow( TNL::abs( this->data[ 0 ] ), p ) + TNL::pow( TNL::abs( this->data[ 1 ] ), p ), 1.0 / p ); } #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION Loading
src/TNL/Containers/StaticVector3D_impl.h +11 −28 Original line number Diff line number Diff line Loading @@ -25,28 +25,28 @@ template< typename Real > template< typename _unused > __cuda_callable__ StaticVector< 3, Real >::StaticVector( const Real v[ 3 ] ) : Containers::StaticArray< 3, Real >( v ) : StaticArray< 3, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 3, Real >::StaticVector( const Real& v ) : Containers::StaticArray< 3, Real >( v ) : StaticArray< 3, Real >( v ) { } template< typename Real > __cuda_callable__ StaticVector< 3, Real >::StaticVector( const Real& v1, const Real& v2, const Real& v3 ) : Containers::StaticArray< 3, Real >( v1, v2, v3 ) : StaticArray< 3, Real >( v1, v2, v3 ) { } template< typename Real > __cuda_callable__ StaticVector< 3, Real >::StaticVector( const StaticVector< 3, Real >& v ) : Containers::StaticArray< 3, Real >( v ) : StaticArray< 3, Real >( v ) { } Loading Loading @@ -179,23 +179,6 @@ bool StaticVector< 3, Real >::operator >= ( const StaticVector& v ) const this->data[ 2 ] >= v[ 2 ] ); } #ifdef HAVE_MIC template<typename Real > __cuda_callable__ inline StaticVector< 3, Real >& StaticVector< 3, Real >::operator = ( const StaticVector< 3, Real >& vct ) { StaticArray<1,Real>::operator =(vct); } template<typename Real > template< typename Vct > __cuda_callable__ inline StaticVector< 3, Real >& StaticVector< 3, Real >::operator = ( const Vct& vct ) { StaticArray<3,Real>::operator =(vct); } #endif template< typename Real > template< typename OtherReal > __cuda_callable__ Loading @@ -214,9 +197,9 @@ __cuda_callable__ StaticVector< 3, Real > StaticVector< 3, Real >::abs() const { return StaticVector< 3, Real >( ::abs( this->data[ 0 ] ), ::abs( this->data[ 1 ] ), ::abs( this->data[ 2 ] ) ); return StaticVector< 3, Real >( TNL::abs( this->data[ 0 ] ), TNL::abs( this->data[ 1 ] ), TNL::abs( this->data[ 2 ] ) ); } template< typename Real > Loading @@ -229,12 +212,12 @@ StaticVector< 3, Real >::lpNorm( const Real& p ) const TNL::abs( this->data[ 1 ] ) + TNL::abs( this->data[ 2 ] ); if( p == 2.0 ) return std::sqrt( this->data[ 0 ] * this->data[ 0 ] + return TNL::sqrt( this->data[ 0 ] * this->data[ 0 ] + this->data[ 1 ] * this->data[ 1 ] + this->data[ 2 ] * this->data[ 2 ] ); return std::pow( std::pow( TNL::abs( this->data[ 0 ] ), p ) + std::pow( TNL::abs( this->data[ 1 ] ), p ) + std::pow( TNL::abs( this->data[ 2 ] ), p ), 1.0 / p ); return TNL::pow( TNL::pow( TNL::abs( this->data[ 0 ] ), p ) + TNL::pow( TNL::abs( this->data[ 1 ] ), p ) + TNL::pow( TNL::abs( this->data[ 2 ] ), p ), 1.0 / p ); } Loading
src/TNL/Containers/StaticVector_impl.h +7 −24 Original line number Diff line number Diff line Loading @@ -25,21 +25,21 @@ template< int Size, typename Real > template< typename _unused > __cuda_callable__ StaticVector< Size, Real >::StaticVector( const Real v[ Size ] ) : Containers::StaticArray< Size, Real >( v ) : StaticArray< Size, Real >( v ) { } template< int Size, typename Real > __cuda_callable__ StaticVector< Size, Real >::StaticVector( const Real& v ) : Containers::StaticArray< Size, Real >( v ) : StaticArray< Size, Real >( v ) { } template< int Size, typename Real > __cuda_callable__ StaticVector< Size, Real >::StaticVector( const StaticVector< Size, Real >& v ) : Containers::StaticArray< Size, Real >( v ) : StaticArray< Size, Real >( v ) { } Loading Loading @@ -211,12 +211,12 @@ StaticVector< Size, Real >::lpNorm( const Real& p ) const Real aux = this->data[ 0 ] * this->data[ 0 ]; for( int i = 1; i < Size; i++ ) aux += this->data[ i ] * this->data[ i ]; return std::sqrt( aux ); return TNL::sqrt( aux ); } Real aux = std::pow( TNL::abs( this->data[ 0 ] ), p ); Real aux = TNL::pow( TNL::abs( this->data[ 0 ] ), p ); for( int i = 1; i < Size; i++ ) aux += std::pow( TNL::abs( this->data[ i ] ), p ); return std::pow( aux, 1.0 / p ); aux += TNL::pow( TNL::abs( this->data[ i ] ), p ); return TNL::pow( aux, 1.0 / p ); } template< int Size, typename Real, typename Scalar > Loading @@ -226,23 +226,6 @@ StaticVector< Size, Real > operator * ( const Scalar& c, const StaticVector< Siz return u * c; } #ifdef HAVE_MIC template< int Size, typename Real > __cuda_callable__ inline StaticVector< Size, Real >& StaticVector< Size, Real >::operator = ( const StaticVector< Size, Real >& vct ) { StaticArray<Size,Real>::operator =(vct); } template< int Size, typename Real > template< typename Vct > __cuda_callable__ inline StaticVector< Size, Real >& StaticVector< Size, Real >::operator = ( const Vct& vct ) { StaticArray<Size,Real>::operator =(vct); } #endif #ifdef UNDEF //TEMPLATE_EXPLICIT_INSTANTIATION #ifndef HAVE_CUDA Loading