libeigen/eigen!2509 Closes #2868 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
14 lines
312 B
C++
14 lines
312 B
C++
// SPDX-FileCopyrightText: The Eigen Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
MatrixXf matA(2, 2), matB(2, 2);
|
|
matA << 2, 0, 0, 2;
|
|
|
|
// Simple but not quite as efficient
|
|
matB = matA * matA;
|
|
cout << matB << endl << endl;
|
|
|
|
// More complicated but also more efficient
|
|
matB.noalias() = matA * matA;
|
|
cout << matB;
|