-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cpp)
vector<<
false positive as template begin (#3438)
- Loading branch information
1 parent
c0138d9
commit 7355c13
Showing
4 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<span class="hljs-comment">//4. 对角矩阵</span> | ||
<span class="hljs-comment">//4.1 构造对角矩阵</span> | ||
<span class="hljs-function">Eigen::VectorXd <span class="hljs-title">vector</span><span class="hljs-params">(<span class="hljs-number">5</span>)</span></span>; <span class="hljs-comment">//构建5维向量</span> | ||
vector<<<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>; <span class="hljs-comment">//向量赋值</span> | ||
<span class="hljs-function">Eigen::MatrixXd <span class="hljs-title">C</span><span class="hljs-params">(vector.asDiagonal())</span></span>; <span class="hljs-comment">//使用向量生成对角阵</span> | ||
std::cout << <span class="hljs-string">"\nC= \n"</span> << C << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//4. 对角矩阵 | ||
//4.1 构造对角矩阵 | ||
Eigen::VectorXd vector(5); //构建5维向量 | ||
vector<<1,2,3,4,5; //向量赋值 | ||
Eigen::MatrixXd C(vector.asDiagonal()); //使用向量生成对角阵 | ||
std::cout << "\nC= \n" << C << std::endl; |