makeMat {cmpp} | R Documentation |
Create a matrix of given size filled with a constant value
Description
This function creates an n x m
matrix of type Eigen::MatrixXd
, where each
element is set to the specified constant value. This is useful for generating
matrices with uniform values for testing, initialization, or other purposes in
computational tasks where a matrix filled with a constant is needed.
Usage
makeMat(n, m, value)
Arguments
n |
An integer representing the number of rows in the matrix. |
m |
An integer representing the number of columns in the matrix. |
value |
A numeric value that will be used to fill the matrix. |
Details
The makeMat
function generates a matrix with the given dimensions n x m
where all elements are initialized to the same constant value. It is useful
in scenarios where a specific value needs to be assigned to all elements of the
matrix, for example in machine learning algorithms, matrix manipulations, or tests.
Value
A numeric matrix of dimensions n x m
filled with the specified value.
Examples
library(cmpp)
# Create a 3x3 matrix filled with 5
mat <- makeMat(3, 3, 5)
print(mat)