定点Cholesky算法的优点 [英] Fixed Point Cholesky Algorithm Advantages

查看:199
本文介绍了定点Cholesky算法的优点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一些代码,可以从浮点或固定点的硬件中获取数据。目前,我们将其作为浮点数。



低层API都处于固定点。所以我们必须把数据作为定点传回去。我们使用的算法是Cholesky。我想知道为什么我们必须使用Cholesky的浮点数,而不是仅仅把数据作为固定点。这样做有什么好处吗?

我会认为使用浮点数会导致更多的舍入误差。

解决方案

定点超过浮点的主要优点是


  1. 在硬件中实现起来要简单得多。

  2. 某些运算是精确的(即不产生舍入误差):即加法,减法和整数乘法,假设结果如果你所有的数字都是相同的大小,你可以在相同的宽度上获得一些额外的精度,不需要存储一个指数:例如在中,32位与24位。



    特别是,在整个计算的整个阶段,对于所有数字来说,第3点不太可能是这种情况,特别是对于线性代数运算如Cholesky因式分解。另一方面,浮点运算有许多其他的优点。


    1. 您可以将数字存储在范围更广的范围内的更广泛的数字上(例如,对于二进制,大约为10到-38到10到+38) )


    2. 使用较小数字时,不会失去准确性:这对于在Cholesky计算中使用的乘法/除法特别重要。


    3. 下溢和溢出不是一个问题:它们不太可能发生(由于1),而且在处理时要更优雅地处理发生,通过 Inf 和subnormals vs异常或错误的结果


    4. 浮点格式包含一个轻微的更小的定点格式:即binary32包含24位定点格式的所有数字,但具有以上所有优点。

      I am developing some code that can get its data from the HW in floating or fixed point. Currently we get that as floating point.

      The low layer APIs are all in fixed point. So we must pass data back as fixed point. The algorithm we are using is Cholesky. I am wondering why we must use floating point for Cholesky and not just get the data as fixed point. Are there any advantages in doing that?

      I would have thought that using floating point would have caused more rounding error.

      解决方案

      The main advantages of fixed point over floating point are

      1. It is much simpler to implement in hardware,

      2. Certain operations are exact (i.e. incur no rounding error): namely, addition, subtraction and multiplication by integers, assuming the result doesn't overflow.

      3. If all your numbers are of the same magnitude, you can get a few extra bits of precision in the same width by not needing to store an exponent: e.g. in 32-bits vs 24-bits in binary32 single precision.

      In particular, point 3 is unlikely to be the case for all the numbers throughout the entire stage of your computation, particularly for linear algebra operations such as Cholesky factorisations.

      On the other hand, floating point has many other advantages.

      1. You can store numbers across a wider variety of numbers across wider range of magnitudes (e.g. ~10-38 to 10+38 for binary32)

      2. You don't lose accuracy when working with smaller numbers: this is particularly important for multiplication/division, which are used throughout Cholesky computations.

      3. Underflow and overflow are less of a problem: they are both less likely to occur (due to 1), but also be handled more gracefully when the do occur, via Inf and subnormals vs exceptions or erroneous results.

      4. A floating point format encompasses a slightly smaller fixed point format: i.e. binary32 includes all numbers in a 24-bit fixed point format, but has all the above advantages.

      这篇关于定点Cholesky算法的优点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆