Commit d4d2f203 by Christoph Ruegge

### Fix previous commit

parent e06f3ce1
 %% Cell type:markdown id: tags: # Exercises: linear algebra %% Cell type:code id: tags:  haskell  %% Cell type:markdown id: tags: ## problem 1 Implement the following vector norms: - 1-norm - p-norm - infinitiy-norm For simplicity use Signatures like haskell norm1 :: Vec Double -> Double  %% Cell type:code id: tags:  haskell  %% Cell type:markdown id: tags: ## problem 2 - Generate a $15 \times 15$ Hilbert matrix $H = (h_{ij})_{i,j=1}^{15}$ with $h_{ij} = \frac{1}{i+j-1}$. - Compute the determinant of $H$. - Generate the vector $r = (1, 1, \ldots, 1)^T$ and the product $y = H r$ - Solve the equation using - $LU$ decomposition - singular value decomposition - <\> %% Cell type:code id: tags:  haskell  %% Cell type:markdown id: tags: ## problem 3 Which of the vectors $$v_1=\left(\begin{array}{c} 1\\2\\3\\4\\5 \end{array}\right),\quad v_2=\left(\begin{array}{c}-1\\27\\26\\1\\-27 \end{array}\right),\quad v_3=\left(\begin{array}{c} 160\\-48\\112\\-160\\48 \end{array}\right),\quad v_4=\left(\begin{array}{c} 120\\234\\-23\\-43\\29 \end{array}\right)$$ are orthogonal? %% Cell type:code id: tags:  haskell  %% Cell type:markdown id: tags: ## problem 4 The module Data.Array.Repa.FFTW provides functions for Fast Fourier Transforms (FFT) for Repa arrays of up to three dimensions. Use the 1-d version to implement a simple low-pass filter that works as follows: - First, an FFT is applied to the input signal. - The coefficients corresponding to frequencies over some pre-determined cutoff are set to 0, the other ones are left untouched. - Then an inverse FFT is performed. The map from index k of the resulting array to the corresponding frequency for an FFT of length n is haskell frq n k | 2*k < n = k | otherwise = k - n  Use the low-pass filter to denoise a signal created by adding uniformly distributed noise between $-0.03$ and $0.03$ to the function $x \mapsto exp(-x^2)$ for $x$ sampled on 200 points between $-2$ and $2$ and plot the results. Note: - The function, its noisy version and the filtered version should be real, but the FFT functions require and return Complex Double arrays. - The FFT functions work with arrays in representation F (foreign). To convert from and to D or U, copyS can be used. - A simple way to generate a list of n random numbers without using IO is haskell take n . randomRs (-0.03, 0.03) $mkStdGen 0  %% Cell type:code id: tags:  haskell  %% Cell type:markdown id: tags: ## problem 5 Implement a parallel Jacobi solver for linear systems using Repa arrays. Since Repa's mmultP (from Data.Array.Repa.Algorithms.Matrix) only works on DIM2 arrays, the right hand side should be a matrix as well, i.e. you should effectively solve $$A X = Y$$ for$X$, where$A$,$X$and$Y$are matrices. "Conventional" linear systems can then be solved by taking$X$and$Y\$ as matrices with only a single column. In order to actually use the parallelisation, this exercise should not be done in the notebook interface. You should also test your program on the 1d Poisson example from lecture 21 and examine its behaviour in ThreadScope. HMatrix matrices can be converted to Repa DIM2 arrays using matrixToRepa from Data.Packed.Repa. In order to actually use the parallelisation, this exercise should not be done in the notebook interface. You should also test your program on the 1d Poisson example from lecture 22 and examine its behaviour in ThreadScope. %% Cell type:code id: tags:  haskell  ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!