Gell-Mann Amnesia in Generative AI era

Modified version of the Gell-Mann Amnesia effect in the era of generative AI:

Briefly stated, the Gell-Mann Amnesia effect is as follows. You open the news feed to an article on some subject you know well. In Murray’s case, physics. In mine, show business. You read the article and see the content is obviously written by a generative AI model. Often, the article is so wrong it actually presents the story backward—reversing cause and effect. I call these the “wet streets cause rain” stories. Internet’s full of them.

In any case, you read with exasperation or amusement the multiple errors in a story, and then scroll down the feed to national or international affairs, and read as if the rest of the news feed was somehow more accurate about Palestine than the baloney you just read. You scroll down the feed, and forget what you know.


Build CloudCompare on Ubuntu 22.04

To compile and install CloudCompare on a Ubuntu 22.04 box:

# Install dependencies
sudo apt-get install -y build-essential cmake libqt5svg5-dev libqt5opengl5-dev \
    qt5-default qttools5-dev qttools5-dev-tools libqt5websockets5-dev \
    libeigen3-dev libdlib-dev libjsoncpp-dev liblaszip-dev 

# Download Git repository including submodules
git clone --recursive https://github.com/cloudcompare/CloudCompare.git

cd CloudCompare
mkdir build && cd build

# Configure
cmake \
    -DEIGEN_ROOT_DIR=/usr/include/eigen3 \
    -DJSON_ROOT_DIR=/usr/include/jsoncpp \
    -DDLIB_ROOT=/usr/include \
    -DCCCORELIB_SCALAR_DOUBLE=OFF \
    -DCCCORELIB_USE_TBB=ON \
    -DPLUGIN_EXAMPLE_GL=ON \
    -DPLUGIN_EXAMPLE_IO=ON \
    -DPLUGIN_EXAMPLE_STANDARD=ON \
    -DPLUGIN_GL_QEDL=ON \
    -DPLUGIN_GL_QSSAO=ON \
    -DPLUGIN_IO_QADDITIONAL=ON \
    -DPLUGIN_IO_QCORE=ON \
    -DPLUGIN_IO_QE57=ON \
    -DPLUGIN_IO_QPHOTOSCAN=ON \
    -DPLUGIN_IO_QLAS=ON \
    -DPLUGIN_IO_QPDAL=OFF \
    -DPLUGIN_IO_QRDB=ON \
    -DPLUGIN_IO_QRDB_FETCH_DEPENDENCY=ON \
    -DPLUGIN_IO_QRDB_INSTALL_DEPENDENCY=ON \
    -DPLUGIN_STANDARD_QANIMATION=ON \
    -DQANIMATION_WITH_FFMPEG_SUPPORT=OFF \
    -DPLUGIN_STANDARD_QBROOM=ON \
    -DPLUGIN_STANDARD_QCANUPO=ON \
    -DPLUGIN_STANDARD_QCOMPASS=ON \
    -DPLUGIN_STANDARD_QCSF=ON \
    -DPLUGIN_STANDARD_QFACETS=ON \
    -DPLUGIN_STANDARD_QHOUGH_NORMALS=ON \
    -DPLUGIN_STANDARD_QHPR=ON \
    -DPLUGIN_STANDARD_QM3C2=ON \
    -DPLUGIN_STANDARD_QPCV=ON \
    -DPLUGIN_STANDARD_QPOISSON_RECON=ON \
    -DPLUGIN_STANDARD_QSRA=ON \
    -DPLUGIN_STANDARD_QRANSAC_SD=ON \
    -DPLUGIN_STANDARD_QPCL=OFF \
    -DPLUGIN_STANDARD_QCLOUDLAYERS=ON \
    -DBUILD_TESTING=OFF \
    ..

# Build
cmake --build . -j$(nproc)

# Install
sudo make install

The instructions were prepared based on the following references:


Install Warpinator on Linux Mint 19.3

Warpinator is a file sharing tool created by the Linux Mint team. It was first released along with Linux Mint 20, but there is no official build for Linux Mint 19.3. Fortunately, the instructions on its GitHub repo allow us to build the app from source. At the time of writing, the newest tag is v1.4.5, but due to the older versions of the packaging tools available on Linux Mint 19.3, I had to use an older tag, which is v1.2.9.

The following are the instructions to build and install the v1.2.9 Warpinator on Linux Mint 19.3.

# Add the PPA so that python3-grpc-tools is available
sudo add-apt-repository ppa:clementlefebvre/grpc
sudo apt-get update

# Install build dependencies listed below, note minimum versions:
sudo apt-get install python3-grpc-tools python3-grpcio

# Clone the repo:
git clone https://github.com/linuxmint/warpinator.git

# Enter the folder, specify version:
cd warpinator
git checkout 1.2.9

# Try to build. If this fails, it's probably due to missing dependencies.
sudo apt-get install debhelper dh-python gnome-pkg-tools meson gobject-intr
ospection

echo 10 > debian/compat

dpkg-buildpackage --no-sign -d

cd ..

If everything works, you should now see warpinator_1.2.9_all.deb. Before installing it, you will need to get the dependency python3-ifaddr. Download the file from http://archive.ubuntu.com/ubuntu/pool/universe/p/python-ifaddr/python3-ifaddr_0.1.6-1_all.deb. Install both the .deb files manually.

After installation, for some unknown reason, the executable at /usr/bin/warpinator (which is a Python script) could not import the module ‘warpinator’. The module is located at /usr/lib/x86_64-linux-gnu/warpinator/. I had to manually add the path to the Python script. To do so:

sudoedit /usr/bin/warpinator

# Find the line which says:
#   sys.path.insert(0, os.path.join("/usr", "libexec/warpinator/"))
# Add the following line after that line:
#   sys.path.insert(0, os.path.join("/usr", "lib/x86_64-linux-gnu/warpinator/"))

Hopefully you should be able to run Warpinator (can be found at Applications > Accessories > Warpinator). Using Warpinator, you can easily transfer files from an old Linux Mint system to a new one!


Install Linux Mint 21.1 (Dual Boot)

This is a log of the steps to install Linux Mint 21.1 “Vera”, which I put on my new laptop. The laptop comes with pre-installed Windows 11, and I’m installing Linux Mint alongside it.

Preparation

On Windows 11
  • Resize the disk partitions to reserve disk space for Linux Mint installation.
    • Typically, I reserve >100 GB.
On some Linux system
On BIOS
  • Disable Secure Boot.

Installation

  • Boot from the LiveUSB.
  • Install Linux Mint
    • For the installation type, I’d recommended to select the option “Something else” and create the partitions manually. Typically, I go with 3 partitions: one Ext4 partition for / (i.e. root), one Ext4 partition for /home, and one swap area. The root partition should be at least 15 GB.

Post-installation

On new Linux Mint
  • Read the release note.
  • Switch to mirrors in the Update Manager.
  • Run sudo apt dist-upgrade.
  • Search and install hardware drivers.
  • If using a SSD disk drive, reduce swappiness.
  • To reduce system load, change the window manager from “Marco + Compositing” to “Marco + Compton”.
On BIOS
  • Re-enable Secure Boot.

C++ rounding style

According to Cppreference - float_round_style, there are 4 available rounding styles used in C++ floating-point arithmetics.

Name Definition
std::round_indeterminate Rounding style cannot be determined.
std::round_toward_zero Rounding toward zero.
std::round_to_nearest Rounding toward nearest representable value, i.e. round half to even. It is also known as convergent rounding.
std::round_toward_infinity Rounding toward positive infinity.
std::round_toward_neg_infinity Rounding toward negative infinity.

I’m not sure why there is no std::round_away_from_zero i.e. rounding toward ±infinity, which is what std::round does. IEEE_754 defines all 5 rounding rules.

According to Cppreference - FE_round, floating-point to integer implicit conversion and casts always round toward zero. Meanwhile, integer to floating-point casts usually round to nearest. Results of floating-point arithmetic operators in expressions executed at compile time always round to nearest. The rounding style of the library functions std::nearbyint, std::rint, std::lrint can be set, but the rounding style of std::round, std::lround, std::llround, std::ceil, std::floor, std::trunc cannot be set.

Sometimes one may see std::floor(x + 0.5) being used as a rounding function, which does rounding toward positive infinity. Meanwhile, std::ceil(x - 0.5) does rounding toward negative infinity. Also, for std::fmod(x, y) which returns x - n * y, where n is rounded toward zero. Meanwhile, for std::remainder(x, y), where n is rounded to nearest, ties to even.

By the way, NumPy does rounding to the nearest even value.

For Xilinx FPGAs, HLS ap_fixed datatype provides:

Name Definition
AP_RND Rounding toward positive infinity.
AP_RND_ZERO Rounding toward zero.
AP_RND_MIN_INF Rounding toward negative infinity.
AP_RND_INF Rounding toward ±infinity.
AP_RND_CONV Convergent rounding.
AP_TRN Truncation to negative infinity (default).
AP_TRN_ZERO Truncation to zero.

According to the UG902 manual, quantization and overflow modes that do more than the default behavior of standard hardware arithmetic (wrap and truncate) result in operators with more associated hardware. It costs logic (LUTs) to implement the more advanced modes, such as round to minus infinity or saturate symmetrically.