SUBROUTINE example
    
USE SPARSE
USE MKL_SPBLAS
USE ISO_C_BINDING

IMPLICIT NONE

integer stat
TYPE(SPARSE_MATRIX_T) H_matA      ! Handle of the CSR format
TYPE(CSR) matA

matA%nzc = 13
matA%nrow = 5

ALLOCATE(matA%PB(matA%nrow))
ALLOCATE(matA%PE(matA%nrow))
ALLOCATE(matA%COL(matA%nzc))
ALLOCATE(matA%VAL(matA%nzc))

matA%Val = (/ 1.0,-1.0,-3.0,-2.0,5.0,4.0,6.0,4.0,-4.0,2.0,7.0,8.0,-5.0/)
matA%COL = (/ 1,2,4,1,2,3,4,5,1,3,4,2,5/)
matA%PB = (/ 1,4,6,9,12/)
matA%PE = (/ 4,6,9,12,14/)

!   generation of a CSR handle
stat = mkl_sparse_d_create_csr(H_matA,SPARSE_INDEX_BASE_ONE  & ! handle, indexing
,matA%nrow,matA%nrow        &   ! max. dimension
,matA%PB,matA%PE            &   ! pointer B, pointer E 
,matA%COL                     &   ! col index
,matA%VAL) 

stat = MKL_SPARSE_DESTROY(H_matA)
deallocate(matA%PB,matA%PE,matA%COL,matA%VAL)

write(*,*) stat
read(*,*)


END
    
    
    