Subroutine to calculate distance between prototypes
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(two_level_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 | ||||
logical, | public | :: | testop |
A logical variable |
subroutine calculate_distance_between_prototypes(kohonen_map) !======================================================================================== !! Subroutine to calculate distance between prototypes class(two_level_self_organizing_map) :: kohonen_map !! A `two_level_self_organizing_map` object integer :: nx,ny,ix,iy,iz,ix1,iy1,iz1,pos,pos1 type(kohonen_prototype) :: current_prototype,current_prototype1 logical :: testop !! A logical variable nx=kohonen_map%parameters(1)%number_nodes_nx; ny=kohonen_map%parameters(1)%number_nodes_ny; 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 ! do ix=1,size(kohonen_map%distance,1) write(kohonen_map%parameters(1)%idist,*) (kohonen_map%distance(ix,iy),iy=1,size(kohonen_map%distance,2)); enddo!ix ! end subroutine calculate_distance_between_prototypes