Assignments¶
The following problems are the assigment for the completion of the course (work in progess). The student must choose one, and produce a C/C++ code with a small report which describe the problem and the implementation. In alternative to the report DOXYGEN documentation is allowed.
Problem 1¶
Given two rectangular matrix \(\mathbf{A}\in\mathbb{R}^{n\times p}\) and \(\mathbf{B}\in\mathbb{R}^{p\times m}\) write a C or C++ code which compute the matrix \(\mathbf{C}=\mathbf{A}\mathbf{B}\in\mathbb{R}^{n\times m}\) using recursive splitting in such a way the splitted block fit in the computer cache.
Problem 2¶
Solve the problem 1 using thread
to parallelize recursion.
Problem 3¶
Given a matrix
\(\mathbf{A}\in\{0,1,\ldots,255\}^{n\times p}\)
of values in 0..255
store the matrix in a
packed way in a matrix of integer.
Using this packed representation write a C or C++
code which perform the following operation
where
Operation of sum and multiplication are
performed modulo 256
i.e 13*34 = 186
and 255+1 = 0
.
Problem 4¶
Write a class Poly
which implement algebra of
polinomial with values in \(\mathbb{R}\),
in particular sum, multiplication and division
with remainder must be in the class.
Use the class to write a program which
compute the the great common divisor of
two polinomial,
i.e. given \(p(x)\) and \(q(x)\) find
\(m(x)\) such that \(m(x) \| p(x)\)
and \(m(x) \| q(x)\) and if
\(s(x)\) divide \(p(x)\) and \(q(x)\)
then \(s(x)|m(x)\).
Problem 5¶
Solve the problem 4 with Galois field \(F_2=\mathbb{Z}/2\mathbb{Z}\)
Problem 6¶
Develop two class Vec2
and Mat2
which implement
algebra of real vector and real square matrix of
dimension 2. The operations for the vector class are
element by element addition subtraction multiplication
and division.
container:: paragraph
The operations for the matrix class are element by element addition subtraction and matrix-matrix multiplication.
container:: paragraph
Division is equivalent to left multiplication by inverse.
container:: paragraph
Write external operation which implement mixed operation of Matrix-Vector multiplication and vector-Matrix division which is the linear system solution, i.e. \(\mathbf{v}/\mathbf{A} \equiv \mathbf{A}^{-1} \mathbf{v}\).
Use this classes to solve some geometric problem in \(\mathbb{R}^2\), like
Find the tangent points between a circle and lines passing from a fixed points
Given two line in parametric form find the intersection point
Problem 7¶
Consider a lower triangular matrix \(\mathbf{L}\) an the partition
The linear system \(\mathbf{L}\mathbf{x}=\mathbf{b}\) can be solved as follows
Use recursively this pattern to write a C or C++ routine which solve a lower triangular linear system.
Problem 8¶
Write a class GF3
which implement algebra of the
Galois field \(F_3=\mathbb{Z}/3\mathbb{Z}\)