destroy_som Subroutine

public subroutine destroy_som(kohonen_map)

Destructor for self_organizing_map

Type Bound

self_organizing_map

Arguments

Type IntentOptional Attributes Name
class(self_organizing_map) :: kohonen_map

A self_organizing_map object


Calls

proc~~destroy_som~~CallsGraph proc~destroy_som self_organizing_map%destroy_som none~destroy~9 kohonen_prototype%destroy proc~destroy_som->none~destroy~9

Called by

proc~~destroy_som~~CalledByGraph proc~destroy_som self_organizing_map%destroy_som proc~external_predict_map self_organizing_map%external_predict_map proc~external_predict_map->proc~destroy_som proc~external_train_map self_organizing_map%external_train_map proc~external_train_map->proc~destroy_som proc~train_som train_som proc~train_som->proc~destroy_som

Variables

Type Visibility Attributes Name Initial
integer, public :: ix
integer, public :: iy
integer, public :: iz

Source Code

    subroutine destroy_som(kohonen_map)
!========================================================================================
!!   Destructor for self_organizing_map 
        class(self_organizing_map) :: kohonen_map
!! A `self_organizing_map` object
   
        integer :: ix,iy,iz
!
!       write(*,*) 'SOM: Releasing memory...'
        if(allocated(kohonen_map%grid)) then
            do iz=1,size(kohonen_map%grid,3)
                do iy=1,size(kohonen_map%grid,2)
                    do ix=1,size(kohonen_map%grid,1);
                        call kohonen_map%grid(ix,iy,iz)%destroy();
                    enddo
                enddo
            enddo
            deallocate(kohonen_map%grid);
         endif
!
         if(allocated(kohonen_map%number_patterns)) then
             deallocate(kohonen_map%number_patterns);
         endif
!
         if(allocated(kohonen_map%cells_index)) then
             deallocate(kohonen_map%cells_index);
         endif
!
         if(allocated(kohonen_map%u_matrix)) then
             deallocate(kohonen_map%u_matrix);
         endif
!
         if(allocated(kohonen_map%distance_function)) then
             deallocate(kohonen_map%distance_function);
         endif
!
         if(allocated(kohonen_map%distance)) then
             deallocate(kohonen_map%distance);
         endif
!
         if(allocated(kohonen_map%cells_distances)) then
             deallocate(kohonen_map%cells_distances);
         endif
!
         if(allocated(kohonen_map%coordinates)) then
             deallocate(kohonen_map%coordinates);
         endif
!
         if(allocated(kohonen_map%distortion)) then
             deallocate(kohonen_map%distortion)
         endif
   !
         if(allocated(kohonen_map%grid_pattern_index)) then
             deallocate(kohonen_map%grid_pattern_index);
         endif
   !
         if(allocated(kohonen_map%list_node_grid)) then
             deallocate(kohonen_map%list_node_grid);
         endif
         call kohonen_map%rnumber_grator%destroy();
!
!        write(*,*) 'SOM: Releasing memory...OK!'
!
    end subroutine destroy_som