Skip to content

Commit bc53766

Browse files
committed
small fixes
1 parent 59aa11c commit bc53766

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

example/linalg/example_solve_cg.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
program example_solve_cg
2-
use stdlib_kinds, only: dp
2+
use stdlib_kinds, only: int8, dp
33
use stdlib_linalg_iterative_solvers, only: solve_cg
44

55
real(dp) :: matrix(2,2)
@@ -8,7 +8,7 @@ program example_solve_cg
88
matrix = reshape( [4, 1,&
99
1, 3] , [2,2])
1010

11-
x = dble( [2,1] ) !> initial guess
11+
x = dble( [2,1] ) !> initial guess
1212
rhs = dble( [1,2] ) !> rhs vector
1313

1414
call solve_cg(matrix, rhs, x, restart=.false.)

example/linalg/example_solve_custom.f90

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module custom_solver
2-
use stdlib_kinds, only: dp
3-
use stdlib_sparse, only: CSR_dp_type
2+
use stdlib_kinds, only: int8, dp
3+
use stdlib_sparse, only: CSR_dp_type, spmv, diag
44
use stdlib_linalg_iterative_solvers, only: linop_dp_type, &
55
solver_workspace_dp_type, &
66
solve_pcg_kernel, &
@@ -106,13 +106,14 @@ end module custom_solver
106106

107107
program example_solve_custom
108108
use custom_solver
109+
use stdlib_sparse, only: CSR_dp_type, COO_dp_type, dense2coo, coo2csr
109110
implicit none
110111

111112
type(CSR_dp_type) :: laplacian_csr
112113
type(COO_dp_type) :: COO
113114
real(dp) :: laplacian(5,5)
114-
real(dp) :: x(5), load(5)
115-
logical(1) :: dirichlet(5)
115+
real(dp) :: x(5), rhs(5)
116+
logical(int8) :: dirichlet(5)
116117

117118
laplacian = reshape( [1, -1, 0, 0, 0,&
118119
-1, 2, -1, 0, 0,&
@@ -123,12 +124,12 @@ program example_solve_custom
123124
call coo2csr(COO,laplacian_csr)
124125

125126
x = 0._dp
126-
load = dble( [0,0,5,0,0] )
127+
rhs = dble( [0,0,5,0,0] )
127128

128129
dirichlet = .false._1
129130
dirichlet([1,5]) = .true._1
130131

131-
call solve_pcg_custom(laplacian_csr, load, x, tol=1.d-6, di=dirichlet)
132+
call solve_pcg_custom(laplacian_csr, rhs, x, tol=1.d-6, di=dirichlet)
132133
print *, x !> solution: [0.0, 2.5, 5.0, 2.5, 0.0]
133134

134135
end program example_solve_custom

example/linalg/example_solve_pcg.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
program example_solve_pcg
2-
use stdlib_kinds, only: dp
2+
use stdlib_kinds, only: int8, dp
33
use stdlib_sparse
44
use stdlib_linalg_iterative_solvers, only: solve_pcg
55

@@ -18,7 +18,7 @@ program example_solve_pcg
1818
call coo2csr(COO,laplacian_csr)
1919

2020
x = 0._dp
21-
rhs = real( [0,0,5,0,0], kind=1._dp )
21+
rhs = real( [0,0,5,0,0], kind=dp )
2222

2323
dirichlet = .false._int8
2424
dirichlet([1,5]) = .true._int8

0 commit comments

Comments
 (0)