How to reduce the λ-matrix to Smith Standard Form

Control`PCS`SmithForm[A, λ] // MatrixForm // TeXForm

$\left( \begin{array}{ccc} 1 & 0 & 0 \\ 0 & \lambda & 0 \\ 0 & 0 & \lambda (\lambda +1) \\ \end{array} \right)$


The Wolfram Function Repository has a (recently added) function for this.

amat = {{1 - lam, 2 lam - 1, lam}, {lam, lam^2, -lam}, {1 + lam^2, 
    lam^3 + lam - 1, -lam^2}};

ResourceFunction["PolynomialSmithDecomposition"][amat]

(* Out[3320]= {{{0, -1 - lam - lam^2, 1 + lam}, {0, 
   1 + lam^2, -lam}, {1, -lam^2 - lam^3, -1 + lam + lam^2}}, {{1, 0, 
   0}, {0, lam, 0}, {0, 0, lam + lam^2}}, {{1, 1, 1 - lam}, {0, 1, 
   1}, {0, 0, 1}}} *)

It returns three matrices in the form {left multiplier, SNF, right multiplier}

--- edit ---

Since it came up in other responses, I'll say a bit about the relationship between this WFR function and the Control`PCS`​ functions. They predate the WFR function (obviously). There is a PolynomialSmithDecomposition as well as SmithForm. I believe the latter simply returns the middle matrix from the former (so no computation is saved).

The WFR function is a rewritten variant, and I believe in some cases it will be more efficient. I've not had a chance yet to pass this on to the developer handling the control functionality. Also there remains a question of which version is better to use in the case of polynomials with approximate coefficients. That will require some experimentation. Also it could be the case that the new one is sometimes slower, ergo, more experimentation needed. So this remains a work in progress.

--- end edit ---