Ben Chuanlong Du's Blog

And let it direct your passion with reason.

String in Different Programming Languages

A string is essentially a sequence of characters. This is how string is implemented in many programming languages (string in Java is different). For this reason, you can operate string like an array in some programming languages. This post is a shallow summary on strings in different programming languages. For …

Inverse of a Special Class of Matrices with High Dimensions

One day, my officemate Tieming asked me about a problem that she met in her research. Suppose \(\boldsymbol{B}\) is a symmetric matrix of huge dimension and \(\boldsymbol{D}\) is a diagonal matrix with nonnegative diagonal elements. The inverse of \(\boldsymbol{B}\) is already known, how can we calculate the …

Define Operator in R

One thing I do not like R is that operations on String in R are not as convenient as in other programming langauges such as Java, Python and Ruby. In these 3 programming languages, you can simply use + to concatenate strings while in R you have to use the function …

Abuse of Vector in R

R is a language that is friendly to vector operation, so vector is an important data structure in R. A single data (of basic types, e.g., numeric or character) is essentially a vector of length 1. A matrix or an array in R is essentially a vector. R make …