Subroutine to calculate the distance between the prototypes
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(self_organizing_map) | :: | kohonen_map |
A |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | nx | ||||
integer, | public | :: | ny | ||||
integer, | public | :: | ix | ||||
integer, | public | :: | iy | ||||
integer, | public | :: | iz | ||||
integer, | public | :: | ix1 | ||||
integer, | public | :: | iy1 | ||||
integer, | public | :: | iz1 | ||||
integer, | public | :: | pos | ||||
integer, | public | :: | pos1 | ||||
type(kohonen_prototype), | public | :: | current_prototype | ||||
type(kohonen_prototype), | public | :: | current_prototype1 |
subroutine calculate_distance_between_prototypes(kohonen_map) !======================================================================================== !! Subroutine to calculate the distance between the prototypes class(self_organizing_map) :: kohonen_map !! A `self_organizing_map` object integer :: nx,ny,ix,iy,iz,ix1,iy1,iz1,pos,pos1 ! type(kohonen_prototype) :: current_prototype,current_prototype1 !! nx=kohonen_map%parameters%number_nodes_nx; ny=kohonen_map%parameters%number_nodes_ny; !$OMP parallel do do iz=1,size(kohonen_map%grid,3) do iy=1,size(kohonen_map%grid,2); do ix=1,size(kohonen_map%grid,1); current_prototype=kohonen_map%grid(ix,iy,iz); pos=position2index(ix,iy,iz,nx,ny); do iz1=1,size(kohonen_map%grid,3); do iy1=1,size(kohonen_map%grid,2); do ix1=1,size(kohonen_map%grid,1); pos1=position2index(ix1,iy1,iz1,nx,ny) current_prototype1=kohonen_map%grid(ix1,iy1,iz1); kohonen_map%distance(pos,pos1)=current_prototype1%distance(current_prototype,& kohonen_map%distance_function); enddo!ix1 enddo!iy1 enddo!iz1 enddo!ix enddo!iy enddo!iz !$OMP end parallel do ! if(kohonen_map%parameters%train_option < 3) then do ix=1,size(kohonen_map%distance,1) write(kohonen_map%parameters%idist,*) (kohonen_map%distance(ix,iy),iy=1,size(kohonen_map%distance,2)); enddo!ix endif ! end subroutine calculate_distance_between_prototypes