74 std::cout <<
"A = \n" << A << std::endl;
78 std::cout <<
"Aᵀ = \n" << AT << std::endl;
80 std::cout <<
"AᵀA = \n" << AT * A << std::endl;
90 Matrix B = A + I * (-R) - 3 * I + E * O * C / 3.14;
91 std::cout <<
"B = \n" << B << std::endl;
94 std::cout <<
"A(1, 2) = " << A(1, 2) << std::endl;
98 std::cout <<
"Dimensions of C: " << C.
rows() <<
"×" << C.
cols() <<
"\n"
99 <<
"Number of elements of C: " << C.
num_elems() <<
"\n"
106 std::iota(std::begin(D), std::end(D), 0.);
107 std::cout <<
"D = \n" << D << std::endl;
109 double D_sum = std::accumulate(std::begin(D), std::end(D), 0.);
110 std::cout <<
"Sum of elements of D = " << D_sum << std::endl;
116 std::cout <<
"v = \n" << v << std::endl;
123 std::cout <<
"a = " << a
125 <<
"a×b = " << a.
cross(b)
126 <<
"a·b = " << std::setw(15) << a.
dot(b) <<
"\n"
130 std::cout <<
"v(2) = " << v(2) <<
"\n" << std::endl;
135 std::cout <<
"vvᵀ = \n" << V << std::endl;
138 std::cout <<
"vᵀv = " << d <<
"\n" << std::endl;
static Matrix constant(size_t rows, size_t cols, double value)
Create a matrix filled with a constant value.
static Matrix identity(size_t rows, size_t cols)
Create an identity matrix.
static Matrix random(size_t rows, size_t cols, double min=0, double max=1, std::default_random_engine::result_type seed=std::default_random_engine::default_seed)
Create a matrix with uniformly distributed random values.
static Matrix zeros(size_t rows, size_t cols)
Create a matrix filled with zeros.
size_t num_elems() const
Get the number of elements in the matrix:
static Matrix ones(size_t rows, size_t cols)
Create a matrix filled with ones.
size_t rows() const
Get the number of rows of the matrix.
size_t cols() const
Get the number of columns of the matrix.
A row vector (1×n matrix).
static RowVector cross(const RowVector &a, const RowVector &b)
Compute the cross product of two 3-vectors.
static double dot(const RowVector &a, const RowVector &b)
Compute the dot product of two vectors.
A column vector (n×1 matrix).
Matrix transpose(const Matrix &in)
Matrix transpose for rectangular or square matrices and row or column vectors.