This is an example of how to use basic initialize function of the matrix module. More details about this example.
00001 00014 program matrix_init 00015 #include "fml_constants.h" 00016 use mod_matrix ! use matrix module 00017 implicit none 00018 00019 !********************************************* declaration 00020 integer, parameter :: m1_rows = 4, m1_cols = 4 !size of m1 00021 ! declaration of matrix m1 00022 type(matrix) :: m1; 00023 00024 !********************************************* body 00025 00026 ! init of a matrix m1 00027 call init(m1,m1_rows,m1_cols); !init:=m_init 00028 !initialize m1 by random values between 1.0 and 10.0 00029 call random(m1,low=p_notcast(1.0),high=p_notcast(10.0)) !random:=mc_random 00030 00031 print*, "********************************************* display initial data" 00032 print*; !newline 00033 print*,"* m1="; 00034 call print(m1); !print m1 (print:=m_print) 00035 call print(m1,"matrix-init.dat"); !print m1 into file (print:=m_print) 00036 print*, ">>>>>>>>>>>>>size info: rows=", m1%rows, ", cols=", m1%cols 00037 call destruct(m1) ! destruct the matrix m1 (don't forget to destruct the matrix) 00038 end program matrix_init