Better L4 and array storage design
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// file="MatrixCompute.Factorize"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -41,7 +41,8 @@ namespace StgSharp.Mathematics.Numeric
|
||||
Matrix<float> matrix,
|
||||
Span<int> pivot,
|
||||
Matrix<float> lower,
|
||||
Matrix<float> upper)
|
||||
Matrix<float> upper
|
||||
)
|
||||
{
|
||||
if (matrix.ColumnLength != matrix.RowLength) {
|
||||
throw new InvalidOperationException("Matrix must be square.");
|
||||
@@ -53,10 +54,14 @@ namespace StgSharp.Mathematics.Numeric
|
||||
if (pivot.Length < n) {
|
||||
throw new ArgumentException("Pivot span length is insufficient.", nameof(pivot));
|
||||
}
|
||||
if (lower.RowLength != n || lower.ColumnLength != n || lower.Layout != MatrixLayout.UpperTriangle) {
|
||||
if (lower.RowLength != n ||
|
||||
lower.ColumnLength != n ||
|
||||
lower.Layout != MatrixLayout.UpperTriangle) {
|
||||
throw new ArgumentException("Lower matrix must be lower-triangular with same dimensions as input.", nameof(lower));
|
||||
}
|
||||
if (upper.RowLength != n || upper.ColumnLength != n || upper.Layout != MatrixLayout.UpperTriangle) {
|
||||
if (upper.RowLength != n ||
|
||||
upper.ColumnLength != n ||
|
||||
upper.Layout != MatrixLayout.UpperTriangle) {
|
||||
throw new ArgumentException("Upper matrix must be upper-triangular with same dimensions as input.", nameof(upper));
|
||||
}
|
||||
|
||||
@@ -73,9 +78,10 @@ namespace StgSharp.Mathematics.Numeric
|
||||
for (int kBlock = 0; kBlock < n; kBlock += 4)
|
||||
{
|
||||
MathematicsModule.GlobalContext
|
||||
.mat[(int)MatrixElementType.F32].pivot(matrix.Buffer, (ulong)(kBlock >> 2),
|
||||
(ulong)(matrix.KernelRowLength - (kBlock >> 2)),
|
||||
(ulong)pivots);
|
||||
.mat_sk[(int)MatrixElementType.F32].pivot(matrix.Buffer,
|
||||
(ulong)(kBlock >> 2),
|
||||
(ulong)(matrix.KernelRowLength - (kBlock >> 2)),
|
||||
(ulong)pivots);
|
||||
int colsInBlock = Math.Min(4, n - kBlock);
|
||||
for (int offset = 0; offset < colsInBlock; offset++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user