@@ -110,6 +110,37 @@ public int NonZerosCount
110110 get { return ( L . NonZerosCount + U . NonZerosCount - n ) ; }
111111 }
112112
113+ /// <summary>
114+ /// Numerically re-factorizes a matrix that has the <b>same sparsity pattern</b>
115+ /// as the one passed to <c>Create</c>, reusing the cached symbolic ordering.
116+ /// </summary>
117+ /// <param name="A">Column-compressed matrix, same size as the one used in <c>Create</c>.</param>
118+ /// <param name="tol">Partial pivoting tolerance (from 0.0 to 1.0).</param>
119+ /// <remarks>
120+ /// Intended for Newton iterations and time-stepping loops where the matrix
121+ /// values change but its pattern does not: the fill-reducing column ordering
122+ /// and symbolic analysis are skipped, keeping only the (dominant) numeric work.
123+ /// The column ordering is a permutation, so a different pattern still factorizes
124+ /// correctly, but the fill may then be sub-optimal.
125+ /// </remarks>
126+ public void Refactorize ( CompressedColumnStorage < Complex > A , double tol = 1.0 )
127+ {
128+ Check . NotNull ( A , "A" ) ;
129+ Check . SquareMatrix ( A , "A" ) ;
130+ Check . NotNaN ( tol , "tol" ) ;
131+
132+ if ( A . ColumnCount != n )
133+ {
134+ throw new ArgumentException ( "Matrix dimensions don't match the factorization." , "A" ) ;
135+ }
136+
137+ // Ensure tol is in range.
138+ tol = Math . Min ( Math . Max ( tol , 0.0 ) , 1.0 ) ;
139+
140+ // Reuse the cached symbolic ordering (S); recompute L, U and the pivoting.
141+ Factorize ( A , tol , null ) ;
142+ }
143+
113144 /// <summary>
114145 /// Solves a system of linear equations, <c>Ax = b</c>.
115146 /// </summary>
0 commit comments