Choral
csr_fromGraph.f90
Go to the documentation of this file.
1 
13 
14 
16 
17  use real_type
18  use basic_tools
19  use csr_mod, only: csr, valid, clear
20  use graph_mod, only: graph, valid
21 
22  implicit none
23  private
24 
25  public :: csr
26 
28  interface csr
29  module procedure csr_create_fromgraph
30  end interface csr
31 
32 contains
33 
46  function csr_create_fromgraph(g) result(m)
47  type(csr) :: m
48  type(graph) , intent(in) :: g
49 
50 
51  if (valid(g)<0) call quit(&
52  & 'csr_fromGraph: csr_create_fromGraph')
53 
54  call clear(m)
55  m%nl = g%nl
56  m%nnz = g%nnz
57  m%width = g%width
58 
59  call allocmem(m%row, m%nl+1)
60  m%row = g%row
61 
62  call allocmem(m%col, m%nnz)
63  m%col = g%col
64 
65  call allocmem(m%a, m%nnz)
66  m%a = 0._rp
67 
68  if (.NOT.valid(m)) call quit( &
69  & 'csr_fromGraph: csr_create_fromGraph')
70 
71  end function csr_create_fromgraph
72 
73 end module csr_fromgraph
74 
is the csr matrix well defined ?
Definition: csr_mod.F90:101
DERIVED TYPE graph: sparse matrices of boolean in CSR format
Definition: graph_mod.F90:33
BASIC TOOLS
Definition: basic_tools.F90:8
subroutine, public quit(message)
Stop program execution, display an error messahe.
destructor
Definition: real_type.F90:127
REAL NUMBERS PRECISION IN CHORAL: selects simple/double/quad
Definition: real_type.F90:33
allocate memory for real(RP) arrays
Definition: real_type.F90:158
USE graph TO DEFINE csr MATRICES
DERIVED TYPE csr for sparse matrices
Definition: csr_mod.F90:13
The type graph stores sparse matrices of boolean in CSR format.
Definition: graph_mod.F90:78
type(csr) function csr_create_fromgraph(g)
Constructor for the type csr.