Skip to content

Linting smoothfit.m #3

Open
lim185 opened this issue Feb 7, 2023 · 2 comments
Open

Linting smoothfit.m #3

lim185 opened this issue Feb 7, 2023 · 2 comments
Assignees
Labels
cleanup Negligible effect on performance but clarifying changes

Comments

@lim185
Copy link
Contributor

lim185 commented Feb 7, 2023

The variable x is not called anywhere else, might be a vestigial code (should remove)
https://github.itap.purdue.edu/Nolte-Group/alpha-prime-system/blob/841dd47dbbf2029f57cba587c1b7fb3b283dfbda/onekey4-core/smoothfit.m#L27

By design, dr (and also A) doesn't actually do anything and should be removed. They are defined on:
https://github.itap.purdue.edu/Nolte-Group/alpha-prime-system/blob/841dd47dbbf2029f57cba587c1b7fb3b283dfbda/onekey4-core/smoothfit.m#L22-L24

To be more detailed, here's a concrete example using an Nx1 input $ y $. First, the tridiagonal matrix $C$ is
$$
C = \begin{bmatrix}
A & 0 & 0 & 0 \
-2B & A + 4B & 0 & 0 \
0 & -2B & A + 4B & 0 \
0 & 0 & -2B & A
\end{bmatrix}
$$
and the 2nd substituted matrix $ D_2 $ is
$$
C = \begin{bmatrix}
A & A y_1 & 0 & 0 \
-2B & A y_2 & 0 & 0 \
0 & A y_3 & A + 4B & 0 \
0 & A y_4 & -2B & A
\end{bmatrix}
$$
But notice that $ \det(C) $ and $ \det(D_i) $ have the same power of $ A $ because every element is a multiple of $ A $. That means All instances of $ A $ cancels out everywhere and it's not actually doing anything. Either we need to change the definition of $ A $ so that it doesn't cancel everywhere, or get rid of it.

@lim185 lim185 self-assigned this Feb 7, 2023
@lim185 lim185 added the cleanup Negligible effect on performance but clarifying changes label Feb 7, 2023
@lim185 lim185 added this to the code streamlining milestone Feb 7, 2023
@lim185
Copy link
Contributor Author

lim185 commented Feb 7, 2023

Also I now know the matrix part is using Cramer's rule to fit a 'stiff' spline onto the curve and reduce curvature on the spline. The details should be tracked down and properly documented.

@lim185
Copy link
Contributor Author

lim185 commented Apr 18, 2023

unused variable x is removed; issue regarding uselessness of A is ignored for current version (4.5), will fix in a more comprehensive update when we have time for it

Sign in to join this conversation on GitHub.
Labels
cleanup Negligible effect on performance but clarifying changes
Projects
None yet
Development

No branches or pull requests

1 participant