Provides a generic interface to a vector/matrix or a rescomp_coefs_vector/rescomp_coefs_matrix object. Called on a numeric vector/matrix (as appropriate to the function used), this will just return the vector/matrix. Called on a rescomp_coefs_vector/rescomp_coefs_matrix, this allows time-dependence via parameters. get_coefs() works on vector- or matrix-type objects, while the others work only on their specific types.

get_coefs(coefs_obj, params)

get_coefs_vector(coefs_obj, params)

get_coefs_matrix(coefs_obj, params)

Arguments

coefs_obj

A numeric vector/matrix or an object of class rescomp_coefs_vector/rescomp_coefs_matrix.

params

A list of time-dependent parameters.

Value

A vector/matrix of coefficients.

Details

This function is normally only for internal use, but is exported to aid users in debugging their created rescomp_coefs objects.

Examples

get_coefs(c(0.2, 0.3, 0.4), list())
#> [1] 0.2 0.3 0.4
get_coefs(matrix(c(0.2, 0.3, 0.4, 0.2), nrow = 2), list())
#>      [,1] [,2]
#> [1,]  0.2  0.4
#> [2,]  0.3  0.2
get_coefs_vector(c(0.2, 0.3, 0.4), list())
#> [1] 0.2 0.3 0.4
try(get_coefs_matrix(c(0.2, 0.3, 0.4), list()))
#> Error in get_coefs_matrix(c(0.2, 0.3, 0.4), list()) : 
#>   `coefs_obj` must be a <matrix> or <rescomp_coefs_matrix>.

coefs <- rescomp_coefs_matrix_custom(
  function(params) {
    matrix(c(0.2, 0.3, 0.4, params$fourth_coeff), nrow = 2, ncol = 2)
  },
  nrow = 2, ncol = 2
)
get_coefs(coefs, list(fourth_coeff = 0.5))
#>      [,1] [,2]
#> [1,]  0.2  0.4
#> [2,]  0.3  0.5