ComputerScientist
174 subscribers
14 photos
3 files
206 links
▜ The Inventor

Stuff that inspire you to create.

See also: ▙ @LitMind
Download Telegram
data := a finite, non-empty sequence of bits
Flynn's taxonomy
- is a classification of computer architectures, proposed by Michael J. Flynn in 1966. The classification system has stuck, and has been used as a tool in design of modern processors and their functionalities.

Classifications are based upon the number of concurrent instruction (or control) streams and data streams available in the architecture.
SISD: one operation at a time, e.g. very old PCs
SIMD: can be achieved by pipelining, multiple functional units, or vertor processors
MISD: uncommon, e.g. Space Shuttle flight control computer
MIMD: e.g. most of the TOP500 supercomputers

The names are each short for a variation of "single/multiple instruction streams single/multiple data streams".
Data layout
- is how multidimensional arrays are stored in a linear storage such as RAM. It is critical for:
• correctly passing arrays between programs written in different programming languages
• performance when traversing an array because modern CPUs, due to caching, process sequential data more efficiently than non-sequential data
• contiguous access makes it possible to use SIMD instructions that operate on vectors of data

Row-major versus column-major order
The difference between the orders lies in which elements of an array are contiguous in memory. In a row-major order, the consecutive elements of a row reside next to each other, whereas the same holds true for consecutive elements of a column in a column-major order. While the terms allude to the rows and columns of a two-dimensional array, the orders can be generalized to arrays of any dimension.

Transposition
As exchanging the indices of an array is the essence of array transposition, an array stored as row-major but read as column-major (or vice versa) will appear transposed. As actually performing this rearrangement in memory is typically an expensive operation, some systems provide options to specify individual matrices as being stored transposed.

Languages support
• Row-major: #C/C++/Objective-C (for C-style arrays), PL/I, #Pascal, Speakeasy, SAS, and Rasdaman
• Column-major: #Fortran, #MATLAB, GNU Octave, S-Plus, #R, #Julia, and Scilab.
• Neither (for less dense arrays):
• Iliffe vectors: #Java, #Scala, #Swift. #Ruby, #Perl, #PHP, #JavaScript, Visual Basic .NET
• Lists of lists: #Python, Wolfram Language of Wolfram Mathematica
• Tables of tables: #Lua
Row-major versus column-major order
Iliffe vector
-, a.k.a. a display, is a data structure used to implement multi-dimensional arrays. It stores elements in the same row contiguously (like row-major order); but not the rows themselves, their pointers. They are often used to avoid the need for expensive multiplication operations when performing address calculation on an array element. They can also be used to implement jagged arrays and other kinds of irregularly shaped arrays.

Jagged array
- is an array of arrays of which the member arrays can be of different sizes. Visualization of its rows produce jagged edges, hence the "jagged". They are commonly implemented as Iliffe vectors.
#language #R
R
- is a programming language and software environment for statistical computing and graphics. The language is widely used among statisticians and data miners for developing statistical software and data analysis. Polls, data mining surveys and studies of scholarly literature databases, show substantial increases in popularity in recent years.

Paradigms: #object_oriented, #imperative
First appeared: 1993
Influenced by: #Lisp, S, Scheme
Influenced: #Julia
#TIOBE rank: 18 (as of 2018)

Source code for the R software environment is written primarily in #C, #Fortran and R itself. The project was conceived in 1992, with an initial version released in 1995 and a stable beta version in 2000.

Syntax
• Assignment
The generally preferred assignment operator is an arrow made from two characters <-, although = can usually be used instead.

• Vectors
> x <- 1:6  # Create vector.
> y <- x^2 # Create vector by formula.
> print(y) # Print the vector’s contents.
[1] 1 4 9 16 25 36

• Functions
f <- function(x, y) {
z <- 3 * x + 4 * y
return(z)
}

Semantics
The scalar data type was never a data structure of R; instead, a scalar is represented as a vector with length one. Data structures include vectors, matrices, arrays, data frames (similar to tables in a relational database) and lists.

Features:
• supports matrix arithmetic
• supports regression analysis, time-series analysis, spatial analysis
• has generic functions (which act differently depending on the classes of arguments passed to them i.e. dispatch the function/method specific to that class of object; e.g. print)
• arrays are stored in column-major order


RStudio
The most commonly used graphical integrated development environment for R is RStudio. It is written in Java, C++ (the Qt framework for its GUI) and JavaScript. Work on RStudio started around December 2010, and the first public beta version was officially announced in February 2011. Version 1.0 was released on 1 November 2016.

www.rstudio.com
Don't comment your code; code your comment.

#Nile
#Nile
Object orientation
Types have qualifications
Every Object has one parent and any number of children
Types are Objects (?), and "inherit" (mixin style) qualifications from their parent
#Python
Iterables versus iterators
An iterable is something with an __iter__ method;
An iterator is the result of calling iter() on an iterable.
All iterators can only be iterated over once, not just those produced by generator functions.

Generators
When you call a function that contains a yield statement, you get a generator object, but no code runs. Then each time you extract an object from the generator, Python executes code in the function until it comes to a yield statement, then pauses and delivers the object. When you extract another object, your code will continue from where it left off i.e. it resumes just after the yield and continues until it reaches another yield (often the same one, but one iteration later). This continues until the function runs off the end, at which point the generator is deemed exhausted.
reify (v.)
make something abstract more concrete
#Python
The filter function takes an iterable and an predicate, i.e. a function that returns a boolean, and removes items that don't match that predicate i.e. return False.
#mathematics
Prime number theorem
pi(n) is the number of prime numbers smaller than or equal to n.

pi(n) ~ n/log(n)
#Nile

have GC but also allow manual memory management
#characters
Cool brackets
❨ ❩ ❪ ❫ ❬ ❭ ❮ ❯ ❰ ❱ ❲ ❳ ❴ ❵
“Spend an hour automating something that takes five minutes.”
The abstract versus the implementation
Do ends justify the means? "ends" ≡ the abstract, "means" ≡ the implementation

Factors to consider when implemeting an idea:
correctness
• time complexity
• memory complexity
• one-to-one correspondece
#data_structure
Bloom map
A Bloom filter is a space-efficient probabilistic data structure, that is used to test whether an element is a member of a set.
• False positive matches are possible, but false negatives are not – in other words, a query returns either "possibly in set" or "definitely not in set"
• Elements can be added to the set, but not removed
• The more elements that are added to the set, the larger the probability of false positives.
• Despite having a fixed size, adding an element never fails
• Union (lossless i.e. equal to one made from scratch) and intersection (lossy) of two with the same size and set of hash functions can be implemented with bitwise OR and AND operations respectively.
#data_structure
Graph
Methods used to represent a finite graph:

Adjacency list: a set of records; where each record stores the neighbors of a vertex. This allows the storage of additional data on the vertices. Additional data can be stored if edges are also stored as records, in which case each vertex stores its incident edges and each edge stores its incident vertices.

Adjacency matrix: a square matrix; where the rows and columns respectively represent source and destination vertices. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.
• If the graph is simple, the adjacency matrix is a (0,1)-matrix with zeros on its diagonal.
• If the graph is undirected, the adjacency matrix is symmetric
Data on edges and vertices must be stored externally. Only the cost for one edge can be stored between each pair of vertices.

Incidence matrix: A two-dimensional Boolean matrix, in which the rows and columns respectively represent the vertices and the edges. The entries indicate whether the vertex at a row is incident, i.e. related, to the edge at a column.