From 4dddc3939364a3bbd9ab0f825f1eeeb03aec2c41 Mon Sep 17 00:00:00 2001 From: conrad Date: Tue, 6 Apr 2021 01:35:54 +1000 Subject: [PATCH] simplification --- examples/example1.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/examples/example1.cpp b/examples/example1.cpp index d0e64d1a..137510cc 100644 --- a/examples/example1.cpp +++ b/examples/example1.cpp @@ -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