首页 \ 问答 \ 如何将行向量转换为Eigen中的列向量?(How to convert row vector to column vector in Eigen?)

如何将行向量转换为Eigen中的列向量?(How to convert row vector to column vector in Eigen?)

文件说:

...在Eigen中,向量只是矩阵的一个特例,有1行或1列。 他们有1列的情况是最常见的; 这种向量被称为列向量,通常简称为向量。 在另一个有1行的情况下,它们被称为行向量。

然而,这个方案产生了不直观的结果:

#include <eigen3/Eigen/Dense>
#include <iostream>

typedef Eigen::Matrix<double, 1, Eigen::Dynamic> RowVector;

int main(int argc, char** argv)
{
    RowVector row(10);
    std::cout << "Rows: "    << row.rows() << std::endl;
    std::cout << "Columns: " << row.cols() << std::endl;
    row.transposeInPlace();
    std::cout << "Rows: "    << row.rows() << std::endl;
    std::cout << "Columns: " << row.cols() << std::endl;
}

输出:

Rows: 1
Columns: 10
Rows: 1
Columns: 10

这是一个错误,还是我错误地使用库?


The documentation says:

... in Eigen, vectors are just a special case of matrices, with either 1 row or 1 column. The case where they have 1 column is the most common; such vectors are called column-vectors, often abbreviated as just vectors. In the other case where they have 1 row, they are called row-vectors.

However this program outputs unintuitive results:

#include <eigen3/Eigen/Dense>
#include <iostream>

typedef Eigen::Matrix<double, 1, Eigen::Dynamic> RowVector;

int main(int argc, char** argv)
{
    RowVector row(10);
    std::cout << "Rows: "    << row.rows() << std::endl;
    std::cout << "Columns: " << row.cols() << std::endl;
    row.transposeInPlace();
    std::cout << "Rows: "    << row.rows() << std::endl;
    std::cout << "Columns: " << row.cols() << std::endl;
}

Output:

Rows: 1
Columns: 10
Rows: 1
Columns: 10

Is this a bug, or am I using the library incorrectly?


原文:https://stackoverflow.com/questions/14954983
更新时间:2022-03-08 18:03

最满意答案

如果您使用RadioButton而不是普通Button,则可以将其.Appearance属性设置为“Button”,然后从其他位置修改其.Checked属性。

例如。

this.radioButton1.Appearance = Appearance.Button;

然后打电话给:

this.radioButton1.Checked = true;

要么

this.radioButton1.Checked = false;

它看起来就像一个普通的按钮。


If you use a RadioButton instead of a normal Button, you can set its .Appearance property to "Button" and then modify its .Checked property from somewhere else.

eg.

this.radioButton1.Appearance = Appearance.Button;

and then call:

this.radioButton1.Checked = true;

or

this.radioButton1.Checked = false;

It will look just like a regular button.

相关问答

更多
  • 如果您使用RadioButton而不是普通Button,则可以将其.Appearance属性设置为“Button”,然后从其他位置修改其.Checked属性。 例如。 this.radioButton1.Appearance = Appearance.Button; 然后打电话给: this.radioButton1.Checked = true; 要么 this.radioButton1.Checked = false; 它看起来就像一个普通的按钮。 If you use a RadioButton ...
  • 有一个更好的办法。 View.performClick(); http://developer.android.com/reference/android/view/View.html#performClick() 这应该回答你所有的问题。 每个视图继承此功能,包括Button,Spinner等。 there is a better way. View.performClick(); http://developer.android.com/reference/android/view/View.htm ...
  • 建议方法: $(btn).trigger('click') 不起作用,但这个确实有效: $('#btn_test').trigger('click'); Suggested method: $(btn).trigger('click') does not work again, but this one does work: $('#btn_test').trigger('click');
  • 最简单的方法是使用setTimeout(延迟后会发生一次)或setInterval(每隔一段时间发生一次)。 setTimeout( function() { $( '#button a' ).trigger( 'click' ) }, 3000 ); setInterval( function() { $( '#button a' ).trigger( 'click' ) }, 3000 ); 一旦实现了这一点,您可能需要考虑其他一些细节问题,例如当用户的鼠标移到下一个按钮或幻灯片放映时停止自动进程(因为 ...
  • 删除 Facebook分享按钮。 试图触发点击是不行的; 它甚至可能会触发他们已经采取的措施来防止点击 ,并因此阻止您的应用被FB阻止。 当用户点击你自己的按钮时,实现对共享对话框的调用: HTML: JavaScript的: function share() { FB.ui({ method: 'share', href: 'http ...
  • 网站的所有者解决了问题。 我从来没有找到办法做到这一点,但问题已经解决。 The owner of the website fixed the issue on their end. I was never able to find a way to do this, but the issue has been resolved.
  • 嗯......我不知道你是否解决了这个问题,只是作为典型貂皮方法的替代品。 由于Phantomjs是一个基于javascript的浏览器引擎,你尝试过使用javascript吗? 你可以尝试这样的事情: public function getElementHref($element) { /* @var FeatureContext $this */ $function = "(function(){ //Javascript method to get the href. ...