Files
eigen/doc/snippets/TopicAliasing_mult2.cpp
2026-05-04 00:36:12 +00:00

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;