Generic S x S matrix representing pair-wise interaction properties between species.
More...
#include <forest_growth.hpp>
|
| | InteractionMatrix ()=default |
| | InteractionMatrix (size_t num_species, float default_val=0.0f) |
| | Constructs an InteractionMatrix of size num_species x num_species.
|
| void | fill (float value) |
| | Fills the entire matrix with a constant value.
|
| float | get (size_t s1, size_t s2) const |
| | Gets the value at entry (s1, s2).
|
| void | set (size_t s1, size_t s2, float value) |
| | Sets the value at entry (s1, s2).
|
| void | set_symmetric (size_t s1, size_t s2, float value) |
| | Sets symmetric values at (s1, s2) and (s2, s1).
|
|
| static InteractionMatrix | diagonal (const std::vector< float > &diag, float off_diag_val=0.0f) |
| | Creates a matrix with specified diagonal values and constant off-diagonal values.
|
| static InteractionMatrix | from_radii (const std::vector< float > &radii, float multiplier=2.0f) |
| | Creates an interaction matrix computed from individual species radii.
|
| static InteractionMatrix | from_species (const std::vector< Species > &species, float multiplier=2.0f) |
| | Creates an interaction matrix computed from Species definitions.
|
| static InteractionMatrix | random (size_t num_species, uint32_t seed, float random_offset=0.1f, bool symmetric=true) |
| | Creates a matrix initialized with random values perturbed around 1.0.
|
| static InteractionMatrix | uniform (size_t num_species, float val) |
| | Creates a matrix initialized to a uniform value.
|
|
| size_t | size = 0 |
| | Number of species (matrix dimension).
|
| std::vector< float > | values = {} |
| | Row-major matrix elements.
|
Generic S x S matrix representing pair-wise interaction properties between species.
◆ InteractionMatrix() [1/2]
| hmap::InteractionMatrix::InteractionMatrix |
( |
| ) |
|
|
default |
◆ InteractionMatrix() [2/2]
| hmap::InteractionMatrix::InteractionMatrix |
( |
size_t | num_species, |
|
|
float | default_val = 0.0f ) |
|
explicit |
Constructs an InteractionMatrix of size num_species x num_species.
- Parameters
-
| num_species | Number of species. |
| default_val | Initial value for all elements. |
◆ fill()
| void hmap::InteractionMatrix::fill |
( |
float | value | ) |
|
Fills the entire matrix with a constant value.
- Parameters
-
◆ get()
| float hmap::InteractionMatrix::get |
( |
size_t | s1, |
|
|
size_t | s2 ) const |
Gets the value at entry (s1, s2).
- Parameters
-
| s1 | Row species index. |
| s2 | Column species index. |
- Returns
- float Matrix value.
◆ set()
| void hmap::InteractionMatrix::set |
( |
size_t | s1, |
|
|
size_t | s2, |
|
|
float | value ) |
Sets the value at entry (s1, s2).
- Parameters
-
| s1 | Row species index. |
| s2 | Column species index. |
| value | Matrix value. |
◆ set_symmetric()
| void hmap::InteractionMatrix::set_symmetric |
( |
size_t | s1, |
|
|
size_t | s2, |
|
|
float | value ) |
Sets symmetric values at (s1, s2) and (s2, s1).
- Parameters
-
| s1 | First species index. |
| s2 | Second species index. |
| value | Matrix value. |
◆ diagonal()
| InteractionMatrix hmap::InteractionMatrix::diagonal |
( |
const std::vector< float > & | diag, |
|
|
float | off_diag_val = 0.0f ) |
|
static |
Creates a matrix with specified diagonal values and constant off-diagonal values.
- Parameters
-
| diag | Vector of diagonal elements. |
| off_diag_val | Off-diagonal value. |
- Returns
- InteractionMatrix Resulting matrix.
◆ from_radii()
| InteractionMatrix hmap::InteractionMatrix::from_radii |
( |
const std::vector< float > & | radii, |
|
|
float | multiplier = 2.0f ) |
|
static |
Creates an interaction matrix computed from individual species radii.
Each entry (s1, s2) is set to multiplier * (radii[s1] + radii[s2]).
- Parameters
-
| radii | Vector of species radii. |
| multiplier | Scaling factor applied to the sum of radii (defaults to 2.0f). |
- Returns
- InteractionMatrix Resulting matrix.
◆ from_species()
| InteractionMatrix hmap::InteractionMatrix::from_species |
( |
const std::vector< Species > & | species, |
|
|
float | multiplier = 2.0f ) |
|
static |
Creates an interaction matrix computed from Species definitions.
Each entry (s1, s2) is set to multiplier * (species[s1].radius + species[s2].radius).
- Parameters
-
| species | Vector of Species definitions. |
| multiplier | Scaling factor applied to the sum of radii (defaults to 2.0f). |
- Returns
- InteractionMatrix Resulting matrix.
◆ random()
| InteractionMatrix hmap::InteractionMatrix::random |
( |
size_t | num_species, |
|
|
uint32_t | seed, |
|
|
float | random_offset = 0.1f, |
|
|
bool | symmetric = true ) |
|
static |
Creates a matrix initialized with random values perturbed around 1.0.
Each entry is sampled uniformly in [1.0 - random_offset, 1.0 + random_offset].
- Parameters
-
| num_species | Number of species. |
| seed | Random seed. |
| random_offset | Maximum random variation relative to 1.0. |
| symmetric | Whether to enforce symmetric values (A_ij = A_ji). |
- Returns
- InteractionMatrix Resulting matrix.
◆ uniform()
Creates a matrix initialized to a uniform value.
- Parameters
-
| num_species | Number of species. |
| val | Uniform value. |
- Returns
- InteractionMatrix Resulting matrix.
◆ size
| size_t hmap::InteractionMatrix::size = 0 |
Number of species (matrix dimension).
◆ values
| std::vector<float> hmap::InteractionMatrix::values = {} |
Row-major matrix elements.
The documentation for this struct was generated from the following files: