Neuron Net
Macros | Functions
Kernels of matrix normalization process

Describes the process of matrix normalization. More...

Macros

#define def_k_Normilize   15
 Index of the kernel for matrix normalization (Normalize) More...
 
#define def_k_norm_buffer   0
 In/Out Matrix. More...
 
#define def_k_norm_dimension   1
 Dimension of matrix. More...
 
#define def_k_NormilizeWeights   16
 Index of the kernel for weights matrix normalization (NormalizeWeights) More...
 

Functions

__kernel void Normalize (__global double *buffer, int dimension)
 Describes the process of matrix normalization. More...
 
__kernel void NormalizeWeights (__global double *buffer, int dimension)
 Describes the process of weights matrix normalization. More...
 

Detailed Description

Describes the process of matrix normalization.

Detailed description on the link.

Macro Definition Documentation

◆ def_k_norm_buffer

#define def_k_norm_buffer   0

In/Out Matrix.

Definition at line 282 of file NeuroNet.mqh.

◆ def_k_norm_dimension

#define def_k_norm_dimension   1

Dimension of matrix.

Definition at line 283 of file NeuroNet.mqh.

◆ def_k_Normilize

#define def_k_Normilize   15

Index of the kernel for matrix normalization (Normalize)

Definition at line 281 of file NeuroNet.mqh.

◆ def_k_NormilizeWeights

#define def_k_NormilizeWeights   16

Index of the kernel for weights matrix normalization (NormalizeWeights)

Definition at line 285 of file NeuroNet.mqh.

Function Documentation

◆ Normalize()

__kernel void Normalize ( __global double *  buffer,
int  dimension 
)

Describes the process of matrix normalization.

Detailed description on the link.

Parameters
[in,out]bufferIn/Out Matrix
[in]dimensionDimension of matrix

Definition at line 642 of file NeuroNet.cl.

644  {
645  int n=get_global_id(0);
646  int shift=n*dimension;
647  double mean=0;
648  for(int i=0;i<dimension;i++)
649  mean+=buffer[shift+i];
650  mean/=dimension;
651  double variance=0;
652  for(int i=0;i<dimension;i++)
653  variance+=pow(buffer[shift+i]-mean,2);
654  variance=sqrt(variance/dimension);
655  for(int i=0;i<dimension;i++)
656  buffer[shift+i]=(buffer[shift+i]-mean)/(variance==0 ? 1 : variance);
657  }

◆ NormalizeWeights()

__kernel void NormalizeWeights ( __global double *  buffer,
int  dimension 
)

Describes the process of weights matrix normalization.

Detailed description on the link.

Parameters
[in,out]bufferIn/Out Matrix
[in]dimensionDimension of matrix

Definition at line 665 of file NeuroNet.cl.

667  {
668  int n=get_global_id(0);
669  int shift=n*dimension;
670  double sum=0;
671  for(int i=0;i<dimension;i++)
672  sum=pow(buffer[shift+i],2);
673  sum=sqrt(sum);
674  for(int i=0;i<dimension;i++)
675  buffer[shift+i]/=sum;
676  }