[英]Rounding values in a numpy array resulting from matrix calculation
I have some calculation involving two matrices both represented in numpy
arrays. 我有一些涉及两个矩阵的计算,两个矩阵都表示为
numpy
数组。
After the calculation, i obtain a vector of floats
represented in another numpy
array. 在计算之后,我获得了另一个
numpy
数组中表示的floats
向量。
I want to round up/down the values in this resultant vector, eg if the calculation gives: 我想向上/向下舍入此结果向量中的值,例如,如果计算给出:
array([1.33333, 2.56, 9.99999, 16.0])
then it should be rounded to: 那么它应该舍入到:
array([1, 3, 10, 16])
What is the fastest way to do this? 最快的方法是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.