Friday, April 26, 2024

Tuesday, September 26, 2023

Saturday, July 15, 2023

SIMD - transpose

 Intel SIMD (AVX) transpose intrinsics


Intel® Intrinsics Guide

- _shuffle_* (mask)

- permute (mask)

- _unpacklo_, _unpackhi_

- _MM_TRANSPOSE4_PS & c++ - Fastest way to transpose 4x4 byte matrix - Stack Overflow


Example

https://godbolt.org/z/xzfPqnrdo

Friday, February 3, 2023

What is the difference between rint() and round() in C or C++?

 From the ChatGPT

In C++, rint is a function from the cmath library that returns the nearest integer value to a given floating-point number, using rounding towards the nearest even number in case of tie.

On the other hand, round is a function that also rounds a floating-point number to the nearest integer value, but it is part of the cmath library only starting from C++11. In earlier versions of C++, round is not available.

So, if you are using C++11 or later, you can use round instead of rint for rounding to the nearest integer value.


Please refer to banker's round

Sample Code: https://onlinegdb.com/q36smlQMz