"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.\n",

"\n",

"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.\n",

"\n",

"**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`."

],

"metadata": {}

}

],

"nbformat": 4,

"nbformat_minor": 0,

"metadata": {

"language_info": {

"name": "haskell",

"file_extension": ".hs",

"version": "7.10.2",

"codemirror_mode": "ihaskell"

},

"kernelspec": {

"language": "haskell",

"name": "haskell",

"display_name": "Haskell"

}

}

}

\ No newline at end of file

%% Cell type:markdown id: tags:

# Exercise: Minimal Surfaces

Implement the gradient descent function

```haskell

gradientDescent::Double->Mesh->[Mesh]

gradientDescentstepsizemesh=[...]

```

and the $H^1$ version

```haskell

gradientDescentH1::Double->Mesh->[Mesh]

gradientDescentH1stepsizemesh=[...]

```

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`.