`core/geometry.js`:`complexLaplaceMatrix`

`projects/parameterization/spectral-conformal-parameterization.js`:`buildConformalEnergy``flatten`

`utils/solvers.js`:`solveInversePowerMethod``residual`

**Notes**

- I added a few tests for
`utils/solvers.js`. They’re available in the git repository. If you’re familiar with git, you can pull the changes. If you’d prefer not to mess around with git, you can also just download the files and put them in`tests/utils`.**Warning:**I fixed a problem with the residual test. In the notes, the residual is defined as a vector $Ax – \lambda x$. But your function`residual`should return a`float`. You should return $\frac{\|Ax – \lambda x\|_2}{\|x\|_2}$. Furthermore, you should compute $\lambda$ as $\frac{x^* A x}{x^* x}$ where $x^*$ is the conjugate transpose of $x$.

- The complex version of the cotan-Laplace matrix can be built in exactly the same manner as its real counterpart. The only difference now is that the cotan values of our matrix will be complex numbers with a zero imaginary component. This time, we will work with meshes with boundary, so your Laplace matrix will have to handle boundaries properly (you just have to make sure your
`cotan`function returns 0 for halfedges which are in the boundary). - The
`buildConformalEnergy`function builds a $|V| \times |V|$ complex matrix corresponding to the conformal energy $E_C(z) = E_D(z) – \mathcal A(Z)$ where $E_D$ is the Dirichlet energy (given by our complex cotan-Laplace matrix) and $\mathcal A$ is the total signed area of the region $z(M)$ in the complex plane (Please refer to Section 7.4 of the notes for more details). You may find it easiest to iterate over the halfedges of the mesh boundaries to construct the area matrix (Recall that the`Mesh`object has a`boundaries`variable which stores all the boundary loops. - The
`flatten`function returns a dictionary mapping each vertex to a vector (`linear-algebra/vector.js`) of planar coordinates by finding the eigenvector corresponding to the smallest eigenvalue of the conformal energy matrix. You can compute this eigenvector by using solveInversePowerMethod (described below). - Your
`solveInversePowerMethod`function should implement**Algorithm 1**in Section 7.5 of the course notes with one modification – after computing $Ay_i = y_{i-1}$, center $y_i$ around the origin by subtracting its mean. You don’t have to worry about the $B$ matrix or generalized eigenvalue problem.**Important:**Terminate your iterations when your residual is smaller that 10^-10. - The parameterization project directory also contains a basic implementation of the Boundary First Flattening (BFF) algorithm. Feel free to play around with it in the viewer and compare the results to your SCP implementation.

**Submission Instructions**

Please rename your `geometry.js`, `spectral-conformal-parameterization.js` and `solvers.js` files to `geometry.txt`, `spectral-conformal-parameterization.txt` and `solvers.txt` (respectively) and put them in a **single zip file** called solution.zip. These files **and** your solution to the written exercises should be submitted together in a **single email** to Geometry.Collective@gmail.com with the subject line **DDG20A4**.