simplification
This commit is contained in:
@@ -14,18 +14,14 @@ main(int argc, char** argv)
|
||||
{
|
||||
cout << "Armadillo version: " << arma_version::as_string() << endl;
|
||||
|
||||
// directly specify the matrix size (by default, elements are not initialised)
|
||||
mat A(2,3);
|
||||
|
||||
// explicit element initialisation during construction via one of:
|
||||
// fill::zeros, fill::ones, fill::eye, fill::randu, fill::randn
|
||||
A = mat(2,3,fill::zeros);
|
||||
// construct a matrix according to given size and form of element initialisation
|
||||
mat A(2,3,fill::zeros);
|
||||
|
||||
// .n_rows and .n_cols are read only
|
||||
cout << "A.n_rows: " << A.n_rows << endl;
|
||||
cout << "A.n_cols: " << A.n_cols << endl;
|
||||
|
||||
A(1,2) = 456.0; // directly access an element (indexing starts at 0)
|
||||
A(1,2) = 456.0; // access an element (indexing starts at 0)
|
||||
A.print("A:");
|
||||
|
||||
A = 5.0; // scalars are treated as a 1x1 matrix
|
||||
|
||||
Reference in New Issue
Block a user