C++ Eigen 数学库中矢量幅度的成员函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5613041/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Member function in Eigen math library for vector magnitude
提问by Alex
I have been trying to find a method that computes the magnitude of a vector in Eigen and I was not able to. Can somebody provide me with the function name of just if it doesn't exist?
我一直试图找到一种方法来计算 Eigen 中向量的大小,但我无法做到。有人可以为我提供函数名称,如果它不存在吗?
I can create a global method that does the job but I prefer not to.
我可以创建一个全局方法来完成这项工作,但我不想这样做。
回答by timday
You want .norm(). Note that there's also .squaredNorm(), .normalized()and .normalize().
你想要.norm()。请注意,还有.squaredNorm()、.normalized()和.normalize()。
回答by Benoit Jacob
The method you're looking for is .norm()
.
您正在寻找的方法是.norm()
。