Closed Shiyu-Sandy-Du closed 7 months ago
it's a tiny matrix, right? So you can just add ident = 0.0_rp
right after allocation, which will assign everything to 0 from the beginning (or use rzero
from math.f90
, but I think it is kind of overkill). Then you can skip the do-loop and ifs you add here.
it's a tiny matrix, right? So you can just add
ident = 0.0_rp
right after allocation, which will assign everything to 0 from the beginning (or userzero
frommath.f90
, but I think it is kind of overkill). Then you can skip the do-loop and ifs you add here.
Sure it's a better way. Code is changed now.
The output had a bit bug and fixed now.
Assign zero entries in the identity matrix explicitly.