<commit_before>#ifndef  color_generic_operation_distance
#define color_generic_operation_distance

// ::color::operation::distance( left, right )
// ::color::constant::delta_gray_entity, hsl_special_entity, euclid_entity

#include "../../gray/gray.hpp"
#include "./delta.hpp"

#include "../constant.hpp"

 namespace color
  {
   namespace constant
    {
     namespace distance
      {

       enum reference_enum
        {
          euclid_entity
         ,CIE76_entity
         ,CIE94__base_entity
         ,CIE94_graphics_entity
         ,CIE94_textile_entity
         ,CIEDE2000_entity //!< NYI
         ,CMC1984_entity //!< NYI
         ,delta_gray_entity
         ,hsl_special_entity
         ,rgb_special_entity
        };

      }
    }

   namespace operation
    {
     namespace _internal
      {

       template< typename category_name, enum ::color::constant::distance::reference_enum reference_number = ::color::constant::distance::euclid_entity >
        struct distance
         {
          public:
            typedef category_name  category_type;
            typedef ::color::model<category_type>  model_type;
            typedef typename ::color::trait::container< category_type >              container_trait_type;
            typedef typename ::color::trait::scalar< category_type >::instance_type   scalar_type;
            typedef typename ::color::trait::index< category_type >::instance_type     index_type;

            typedef color::operation::_internal::distance< category_name, ::color::constant::distance::euclid_entity> this_type;

            static   scalar_type square( scalar_type const& s )
             {
              return s * s;
             }

            static scalar_type process( model_type const& left, model_type const& right )
             {
              scalar_type lenght = 0;
              for( index_type index = 0; index < container_trait_type::size(); index ++ )
               {
                if( left.get( index ) < right.get( index ) )
                 {
                  lenght += this_type::square( scalar_type( right.get( index ) - left.get( index ) ) );
                 }
                else
                 {
                  lenght +=  this_type::square( scalar_type( left.get( index ) - right.get( index ) ) );
                 }
               }

              return sqrt( lenght );
             }
         };

       template< typename category_name>
        struct distance< category_name, ::color::constant::distance::delta_gray_entity >
         {
          public:
            typedef category_name  category_type;
            typedef ::color::model<category_type>  model_type;
            typedef typename ::color::trait::scalar< category_type >::instance_type  scalar_type;
            typedef ::color::gray<scalar_type> gray_type;

            static scalar_type process( model_type const& left, model_type const& right )
             {
              model_type difference;
              return gray_type( ::color::operation::delta( difference, left, right ) ).template get<0>();
             }
         };

       template< typename category_name>
        struct distance< category_name, ::color::constant::distance::CIE76_entity >
         {
          public:
            typedef category_name  category_type;
            typedef ::color::model<category_type>  model_type;
            typedef typename ::color::trait::scalar< category_type >::instance_type  scalar_type;
            typedef ::color::lab<scalar_type>  lab_type;

            static scalar_type process( model_type const& left, model_type const& right )
             {
              lab_type lab_left(left);
              lab_type lab_right(right);

              return ::color::operation::distance< ::color::constant::distance::euclid_entity >( lab_left, lab_right );
             }
         };

       template< typename category_name >
        struct distance< category_name, ::color::constant::distance::CIE94__base_entity >
         {
          public:
            typedef category_name  category_type;
            typedef ::color::model<category_type>  model_type;
            typedef typename ::color::trait::scalar< category_type >::instance_type  scalar_type;
            typedef ::color::lab<scalar_type>  lab_type;

            static scalar_type process( model_type const& left, model_type const& right, scalar_type const& K_L, scalar_type const& K_1, scalar_type const& K_2 )
             {
              static const scalar_type K_C = 1;
              static const scalar_type K_H = 1;

              lab_type lab_left(left);
              lab_type lab_right(right);

              scalar_type delta_L =  lab_left[0] - lab_right[0];

              scalar_type C_1 =  sqrt(  lab_left[1]* lab_left[1] +  lab_left[2]* lab_left[2] );
              scalar_type C_2 =  sqrt( lab_right[1]*lab_right[1] + lab_right[2]*lab_right[2] );
              scalar_type delta_C =  C_1 - C_2;

              scalar_type delta_a =  lab_left[1] - lab_right[1];
              scalar_type delta_b =  lab_left[2] - lab_right[2];

              scalar_type delta_H = sqrt( delta_a*delta_a + delta_b*delta_b - delta_C*delta_C );
<commit_msg>* fix:[internal] Broken GCC build.<commit_after>#ifndef  color_generic_operation_distance
#define color_generic_operation_distance

// ::color::operation::distance( left, right )
// ::color::constant::delta_gray_entity, hsl_special_entity, euclid_entity

#include "../../gray/gray.hpp"
#include "./delta.hpp"

#include "../constant.hpp"

 namespace color
  {
   namespace constant
    {
     namespace distance
      {

       enum reference_enum
        {
          euclid_entity
         ,CIE76_entity
         ,CIE94__base_entity
         ,CIE94_graphics_entity
         ,CIE94_textile_entity
         ,CIEDE2000_entity //!< NYI
         ,CMC1984_entity //!< NYI
         ,delta_gray_entity
         ,hsl_special_entity
         ,rgb_special_entity
        };

      }
    }

   namespace operation
    {
     namespace _internal
      {

       template< typename category_name, enum ::color::constant::distance::reference_enum reference_number = ::color::constant::distance::euclid_entity >
        struct distance
         {
          public:
            typedef category_name  category_type;
            typedef ::color::model<category_type>  model_type;
            typedef typename ::color::trait::container< category_type >              container_trait_type;
            typedef typename ::color::trait::scalar< category_type >::instance_type   scalar_type;
            typedef typename ::color::trait::index< category_type >::instance_type     index_type;

            typedef color::operation::_internal::distance< category_name, ::color::constant::distance::euclid_entity> this_type;

            static   scalar_type square( scalar_type const& s )
             {
              return s * s;
             }

            static scalar_type process( model_type const& left, model_type const& right )
             {
              scalar_type lenght = 0;
              for( index_type index = 0; index < container_trait_type::size(); index ++ )
               {
                if( left.get( index ) < right.get( index ) )
                 {
                  lenght += this_type::square( scalar_type( right.get( index ) - left.get( index ) ) );
                 }
                else
                 {
                  lenght +=  this_type::square( scalar_type( left.get( index ) - right.get( index ) ) );
                 }
               }

              return sqrt( lenght );
             }
         };

       template< typename category_name>
        struct distance< category_name, ::color::constant::distance::delta_gray_entity >
         {
          public:
            typedef category_name  category_type;
            typedef ::color::model<category_type>  model_type;
            typedef typename ::color::trait::scalar< category_type >::instance_type  scalar_type;
            typedef ::color::gray<scalar_type> gray_type;

            static scalar_type process( model_type const& left, model_type const& right )
             {
              model_type difference;
              return gray_type( ::color::operation::delta( difference, left, right ) ).template get<0>();
             }
         };

       template< typename category_name>
        struct distance< category_name, ::color::constant::distance::CIE76_entity >
         {
          public:
            typedef category_name  category_type;
            typedef ::color::model<category_type>  model_type;
            typedef typename ::color::trait::scalar< category_type >::instance_type  scalar_type;
            typedef ::color::lab<scalar_type>  lab_type;

            static scalar_type process( model_type const& left, model_type const& right )
             {
              lab_type lab_left(left);
              lab_type lab_right(right);

              return::color::operation::_internal::distance<category_name,::color::constant::distance::euclid_entity>::process( lab_left, lab_right );
             }
         };

       template< typename category_name >
        struct distance< category_name, ::color::constant::distance::CIE94__base_entity >
         {
          public:
            typedef category_name  category_type;
            typedef ::color::model<category_type>  model_type;
            typedef typename ::color::trait::scalar< category_type >::instance_type  scalar_type;
            typedef ::color::lab<scalar_type>  lab_type;

            static scalar_type process( model_type const& left, model_type const& right, scalar_type const& K_L, scalar_type const& K_1, scalar_type const& K_2 )
             {
              static const scalar_type K_C = 1;
              static const scalar_type K_H = 1;

              lab_type lab_left(left);
              lab_type lab_right(right);

              scalar_type delta_L =  lab_left[0] - lab_right[0];

              scalar_type C_1 =  sqrt(  lab_left[1]* lab_left[1] +  lab_left[2]* lab_left[2] );
              scalar_type C_2 =  sqrt( lab_right[1]*lab_right[1] + lab_right[2]*lab_right[2] );
              scalar_type delta_C =  C_1 - C_2;

              scalar_type delta_a =  lab_left[1] - lab_right[1];
              scalar_type delta_b =  lab_left[2] - lab_right[2];

              scalar_type delta_H = sqrt( delta_a*delta_a + delta_b*delta_b - delta_C*delta_C );

{'fraction_non_alphanumeric': 0.09831029185867896, 'fraction_numerical': 0.008640552995391706, 'mean_word_length': 2.1254125412541254, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6600607', 'n_tokens_mistral': 2928, 'n_tokens_neox': 2820, 'n_words': 604}