Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Source Code
subroutine build_csr_from_coo(self)implicit none class(type_node_adjacency),intent(inout)::selfinteger(int32)::iif(self%nnz==0)then if(self%num_nodes>0)then call allocate_array(self%ptr,self%num_nodes+1)self%ptr=1end if call allocate_array(self%ind,0)return end if! COOデータはcreate_unique_cooによって行でソート済みcall allocate_array(self%ptr,self%num_nodes+1)call allocate_array(self%ind,self%nnz)self%ind=self%col! col配列をindにコピーself%ptr=0! 1. 各行の非ゼロ要素数を数える (次数を計算)do i=1,self%nnzself%ptr(self%row(i)+1)=self%ptr(self%row(i)+1)+1end do! 2. 次数の累積和からptr配列を構築do i=1,self%num_nodesself%ptr(i+1)=self%ptr(i)+self%ptr(i+1)end do! Fortranは1-based indexなので、全体に1を加算self%ptr=self%ptr+1! 3. 各行の列インデックスをソートするdo i=1,self%num_nodesif(self%ptr(i+1)>self%ptr(i))then call sort(self%ind(self%ptr(i):self%ptr(i+1)-1))end if end do end subroutine build_csr_from_coo