Any two-dimensional array of numbers may be interpreted as a matrix. Whether or not this is the only point of view that matters to a particular application, it does lead to certain types of analysis. The related mathematical and computational tools are universally applicable and find diverse uses.
Tables are used to represent variation of a quantity with respect to two variables. These variables may be encoded as the rows and columns of a matrix.
Graphs are a useful way to represent the link structure of social networks, airline routes, power grids, sports teams, and web pages, to name a few examples. The natural interpretation is that the edge (vi,vj) denotes a link from node i to node j, in which case we say that node i is adjacent to node j. One usually visualizes small graphs by drawing points for nodes and arrows or lines for the edges.
Here are some elementary results about adjacency matrices.
The representation of a graph by its adjacency matrix opens up the possibility of many kinds of analysis of the graph. One might ask whether the nodes admit a natural partition into clusters, for example. Or one might ask to rank the nodes in order of importance to the network as determined by some objective criteria—an application made famous by Google’s PageRank algorithm, and one which is mathematically stated as an eigenvalue problem.
Computers typically represent images as rectangular arrays of pixels, each of which is colored according to numerical values for red (R), green (G), and blue (B) components of white light. Most often, these are given as integers in the range from zero (no color) to 255 (full color). Thus, an image that is m-by-n pixels can be stored as an m-by-n-by-3 array of integer values. In Julia, we can work with an m×n matrix of 3-vectors representing entire colors.
Representation of an image as a matrix allows us to describe some common image operations in terms of linear algebra. For example, in Singular value decomposition we will use the singular value decomposition to compress the information, and in section-krylov-matrixfree we will see how to apply and remove blurring effects.
⌨ Refer to Demo 7.1.5 on loading and displaying test images.
(a) Display the “lighthouse” test image upside-down.
(b) Display it mirror-reversed from left to right.
(c) Display the image so that it is cropped to isolate the black beacon section at the top of the lighthouse.
⌨ For this problem you need to download and import data via:
datafile = download("https://tobydriscoll.net/fnc-julia/_static/resources/actors.jld2")
@load datafile A
Based on data provided by the Self-Organized Networks Database at the University of Notre Dame, it contains information about the appearances of 392,400 actors in 127,823 movies, as given by the Internet Movie Database. The matrix A has Aij=1 if actor j appeared in movie i and zero elements elsewhere.
(a) What is the maximum number of actors appearing in any one movie?
(b) How many actors appeared in exactly three movies?
(c) Define C=ATA. How many nonzero entries does C have? What is the interpretation of Cij?