Skip to contents

The habitat membership matrix, N, holds information about the patch location of each habitat. It is part of the egg-laying and emergence interface, making it possible to compute egg laying from patches to habitats; and emergence from habitats to patches.

Usage

create_habitat_matrix(nPatches, membership)

Arguments

nPatches

the number of patches, np

membership

a vector describing the patch index for each habitat

Value

the habitat membership matrix, denoted N where |N|=np×nq

Details

Information about the patch location of each habitat is passed as the membership vector, an ordered list of patch locations. If the ith habitat is in the jth patch, then Nj,i=1. Otherwise, Nj,i=0.

Since N is a matrix, it is readily used for computation. Let:

  • nq= nHabitats, the number of habitats;

  • np= nPatches, the number of patches.

If w is any vector describing a quantity in habitats (i.e., |w|=nq), then W=Nw is a vector that has summed w by patch, and |W|=np.

See also

create_habitat matrix is called by make_xds_template() and setup_EGG_LAYING()

see view_habitat_matrix()

Examples

create_habitat_matrix(3, c(1,1,2,2,2))
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    1    1    0    0    0
#> [2,]    0    0    1    1    1
#> [3,]    0    0    0    0    0