A Tutorial on Rotation


Rotation is critical to many applications, e.g., navigation. For 2D rotation, it is trivial. However, for 3D case, it is much more complicated and confusing. This tutorial tries to show some important concept in 3D rotation.


A Tutorial on Least Mean Square (LMS) Algorithm

I was once assigned a problem: there is a black box that maintains a float value; it has several interfaces to access that value

  1. estimate(): return the estimated current value with noise,
  2. update(v): add delta \(v\) to the current value.

And the goal is to set the black box to the target value. The straightforward solution is to use LMS algorithm (here for some mathematical explanation) to approach the target value. The procedure may look like


A Tutorial on C++ Copy and Swap Idiom

Someone once shows me the following code

struct Widget {
    Widget() = default;
    Widget(const Widget& w) = default;
    Widget(Widget&& w) = default;
    Widget& operator=(Widget obj) {
        // swap obj and this
        return *this;

    // member variables
    int id;


Munkres Algorithm For Assignment Problem: A Tutorial


Munkres algorithm (or Hungarian algorithm) is very efficient to solve the assignment problem. However, I can't find a good tutorial from the internet (most of them are vague high-level description; some show the implementation without explanation), so I try to do it by myself. Here are some applications,


SMACOF: A Tutorial


For parameter estimation, if the cost function is quadratic, it is easy to find the solution by setting its derivative to zero. For example, suppose we want to estimate \(y_i\) from input \(\boldsymbol{x}_i\), where \(\boldsymbol{x}_i\) is a row vector. Suppose that from our understanding to the problem, we believe linear least square is a good estimator. That is,

$$ \hat{y}_i = \boldsymbol{x}_i^T \boldsymbol{w}, \label{eq-ls} $$

where row vector \(\boldsymbol{w}\) is the coefficients we want to estimate,


A tutorial on time series with neural network

If you torture the data long enough, it will confess.
Ronald H. Coase, Essays on Economics and Economists


bsmedit -- C/C++/SystemC simulation controller


bsmedit is a C++/SystemC Visualizer. Long time ago, when I first used the Systemc library to simulate some communication algorithms, I was quickly bored with the following debugging procedure:

  1. update the source code;
  2. re-compile the program;
  3. check the results.

And occasionally, I would need to add some debugging code. For example, printing some value (e.g., printf) to the terminal or dumping the data to a file, so that I can use other tools (e.g., Matlab) to visualize and analyze it.

bsmedit aims to simplify this procedure. With bsmedit, we can

  • control the simulation
  • monitor the signals in real-time
  • plot/dump the signals
  • ......


bsmdoc -- another technical html doc generator


bsmdoc is a tool to generate technical static html docs:

  • Light-weighted;
  • Highly extendable;
  • Single file doc: generate everything in a single file.

bsmdoc splits the whole doc into blocks (e.g., equation block, paragraph block, heading block, ...). In the following sections, we will show each block in detail, as well as the way to extend the existing blocks.


Acoustic Echo Cancellation Overview


In acoustic transmission system, there are two important components: the speaker and the microphone. If the speaker and the microphone are totally separated, there will be no echo from the speaker to the microphone. Then, there is no need for acoustic echo cancellation.

However, in practice, the speaker and the microphone is almost always not totally separated. For example, when you are calling your friend A, you are the near end user and your friend A is the far end user. The speech from your friend A will come out from the speaker of your phone, which may also be collected by the microphone of your phone and sent back to your friend A.


Basics of Digital Signal Processing in Communications System

basics of digital signal processing


In this section, we will review some basic principles in digital signal processing, which will be widely used in the following sections.




Scrambler is also called randomizer. It is usually the first block in many communication systems, which 'randomizes' the source data (e.g., the binary sequence). Why do we want to randomize the data? One example is that the randomized data can help the receiver to achieve the symbol synchronization.


Sampling Rate Conversion


As suggested by the name, sampling rate conversion (SRC) is to change the sampling rate without distorting the signal. There are several purpose to do that. For example, the ADC at the receiver may always working in a certain sampling frequency, while the digital processing block may work in a different frequency. Thus, an SRC block is needed to fill the gap between the ADC and the following digital blocks.




Synchronization is critical to communications system. It helps the system to establish a shared sense of time and frequency between transmitter and receiver. In this section, we will introduce some basic ideas. As we mentioned in all the other sections, we will not plan to list all the algorithms (how could that even be possible?), instead, we will show some basic ideas and wish you will know how to start when you need to deal with a real problem. The code used in this section can be found here.


Small tools