Commit 8d92d795 authored by Christoph Ruegge's avatar Christoph Ruegge
Browse files

exercise 28

parent 5a64e0b4
%% Cell type:markdown id: tags:
# Exercise: Minimal Surfaces
Implement the gradient descent function
```haskell
gradientDescent :: Double -> Mesh -> [Mesh]
gradientDescent stepsize mesh = [...]
```
and the $H^1$ version
```haskell
gradientDescentH1 :: Double -> Mesh -> [Mesh]
gradientDescentH1 stepsize mesh = [...]
```
The minsurf code constructs the Laplace operator as an `AssocMatrix` without taking care of the boundary, and provides a function `boundary :: Mesh -> S.Set Int` that returns the indices of the boundary vertices of the mesh.
The gradient descent functions should construct the Laplace operator with appropriate boundary conditions as `GMatrix`. For the $H^1$ version, the equation should be solved using `cg :: GMatrix -> Matrix Double -> [CGState]`, where the `Matrix Double` parameter is the matrix of vertices.
**Note**: Due to restriction in the way HMatrix handles sparse matrices -- the impossibility to specify the size of the matrix explicitly -- it may turn out to be difficult to use `mkSparse`. For the exercise, it is ok to convert the `AssocMatrix` to a `GMatrix` using `mkDense . toDense`.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment