generate K matrix of size (n-2) x n (non-cyclic case), where n is size of map
rw2(mesh, cyclic = FALSE, ...)
mesh for build the model
whether the mesh is circular, i.e. the first one is connected to the last if it is circular, we will treat the 1st location and the last location as neigbour, with distance of average distance.
additional arguments
a list
r2 <- rw2(1:7); r2$K
#> 7 x 7 sparse Matrix of class "dgCMatrix"
#>
#> [1,] 1 . . . . . .
#> [2,] . 1 . . . . .
#> [3,] 1 -2 1 . . . .
#> [4,] . 1 -2 1 . . .
#> [5,] . . 1 -2 1 . .
#> [6,] . . . 1 -2 1 .
#> [7,] . . . . 1 -2 1