1
- namespace AiDotNet . DecompositionMethods . MatrixDecomposition ;
1
+ using AiDotNet . Enums . AlgorithmTypes ;
2
+
3
+ namespace AiDotNet . DecompositionMethods . MatrixDecomposition ;
2
4
3
5
public class LuDecomposition < T > : IMatrixDecomposition < T >
4
6
{
@@ -9,7 +11,7 @@ public class LuDecomposition<T> : IMatrixDecomposition<T>
9
11
10
12
private readonly INumericOperations < T > NumOps ;
11
13
12
- public LuDecomposition ( Matrix < T > matrix , LuAlgorithm luAlgorithm = LuAlgorithm . PartialPivoting )
14
+ public LuDecomposition ( Matrix < T > matrix , LuAlgorithmType luAlgorithm = LuAlgorithmType . PartialPivoting )
13
15
{
14
16
A = matrix ;
15
17
NumOps = MathHelper . GetNumericOperations < T > ( ) ;
@@ -24,15 +26,15 @@ public Vector<T> Solve(Vector<T> b)
24
26
return BackSubstitution ( U , y ) ;
25
27
}
26
28
27
- private ( Matrix < T > L , Matrix < T > U , Vector < int > P ) Decompose ( Matrix < T > matrix , LuAlgorithm algorithm )
29
+ private ( Matrix < T > L , Matrix < T > U , Vector < int > P ) Decompose ( Matrix < T > matrix , LuAlgorithmType algorithm )
28
30
{
29
31
return algorithm switch
30
32
{
31
- LuAlgorithm . Doolittle => ComputeLuDoolittle ( matrix ) ,
32
- LuAlgorithm . Crout => ComputeLuCrout ( matrix ) ,
33
- LuAlgorithm . PartialPivoting => ComputeLuPartialPivoting ( matrix ) ,
34
- LuAlgorithm . CompletePivoting => ComputeLuCompletePivoting ( matrix ) ,
35
- LuAlgorithm . Cholesky => ComputeCholesky ( matrix ) ,
33
+ LuAlgorithmType . Doolittle => ComputeLuDoolittle ( matrix ) ,
34
+ LuAlgorithmType . Crout => ComputeLuCrout ( matrix ) ,
35
+ LuAlgorithmType . PartialPivoting => ComputeLuPartialPivoting ( matrix ) ,
36
+ LuAlgorithmType . CompletePivoting => ComputeLuCompletePivoting ( matrix ) ,
37
+ LuAlgorithmType . Cholesky => ComputeCholesky ( matrix ) ,
36
38
_ => throw new ArgumentException ( "Unsupported LU decomposition algorithm." ) ,
37
39
} ;
38
40
}
0 commit comments