DAY20
Wednesday, 27 June 2012
Today we may talk about:
-
how a matrix in linear algebra can be declared in C as a two-dimensional array.
-
how a matrix is initialized, modified, and used.
-
how a matrix is stored.
-
how the sizeof() function can tell you the sizes of things (chars, ints,
floats, doubles, and arrays of these things)
-
how to use the VLA (variable length array) idea to create a matrix
whose size is chosen by the user at run time.
-
how to use scanf() to read a value directly into a particular array location.
-
how a matrix can be used to store image information.
-
How to compute certain matrix norms.
-
How to implement matrix-vector multiplication in C.
-
How to implement matrix-matrix multiplication in C.
-
A formula for the inverse matrix.
-
How to implement the Jacobi iteration for solving certain linear equations.
-
How to implement the power method for finding the largest eigenvalue.
Programs and functions we might talk about:
-
feep.ascii.pbm, a tiny black and white
ASCII graphics file in Portable Bit Map (PBM) format.
-
feep.png, the image stored in the graphics file.
-
matrix_inverse.c, shows how the entries of
a matrix can be read directly by scanf(); computes the inverse of a 2x2 matrix
specified by the user.
-
matrix_matrix.c, matrix-matrix multiplication
example, computes C = A * B. A is a 4x3 matrix, B is a 3x2 matrix.
-
matrix_vector.c, matrix-vector multiplication
example, computes A*x = b.
-
matrix_vla.c, shows how the VLA idea can also
be used with matrices. We can let the user input the dimensions of the
matrix, and then declare it.
-
sizes.c, shows how the sizeof() function
can be used to ask for the size (in bytes) of a datatype, a variable,
or an array.
Last revised on 27 June 2012.