6 #ifndef MYRAMATH_MULTIFRONTAL_RLDLT_KERNEL_H 7 #define MYRAMATH_MULTIFRONTAL_RLDLT_KERNEL_H 19 #include <myramath/io/detail/vector.h> 25 #include <myramath/dense/detail/nwork.h> 34 template<
class Number>
class MatrixRange;
35 template<
class Number>
class LowerMatrix;
52 { in >> P_swaps >> Q_swaps >> R >> n_plus >> n_minus; }
56 { out << P_swaps << Q_swaps << R << n_plus << n_minus; }
63 P_swaps = result.P_swaps;
64 Q_swaps = result.Q_swaps;
66 n_plus = result.n_plus;
67 n_minus = result.n_minus;
69 uint64_t n_work = L.size();
70 return n_work*(n_work+1)*(n_work+2)/6;
84 if (B.
I != N)
throw eprintf(
"RLDLTKernel::solveL('L'eft), size mismatch B.I != N [%d != %d]", B.
I, N);
86 if (op ==
'N' || op ==
'C')
89 uint64_t w = trsm_nwork(
'L',
'N',L,B);
95 else if (op ==
'T' || op ==
'H')
97 iswap_rows(Q_swaps,B);
99 uint64_t w = trsm_nwork(
'L',
'T',L,B);
100 iswap_rows(P_swaps,B);
103 else throw eprintf(
"RLDLTKernel::solveL('L'eft), didn't understand op = %c", op);
106 else if (side ==
'R')
109 if (B.
J != N)
throw eprintf(
"RLDLTKernel::solveL('R'ight), size mismatch B.J != N [%d != %d]", B.
J, N);
111 if (op ==
'N' || op ==
'C')
113 swap_columns(Q_swaps,B);
115 uint64_t w = trsm_nwork(
'R',
'N',L,B);
116 swap_columns(P_swaps,B);
120 else if (op ==
'T' || op ==
'H')
122 iswap_columns(P_swaps,B);
123 uint64_t w = trsm_nwork(
'R',
'T',L,B);
125 iswap_columns(Q_swaps,B);
128 else throw eprintf(
"RLDLTKernel::solveL('R'ight), didn't understand op = %c", op);
130 else throw eprintf(
"RLDLTKernel::solveL(), didn't understand side = %c", side);
137 B.
bottom(n_minus) *= -Precision(1);
138 else if (side ==
'R')
139 B.
right(n_minus) *= -Precision(1);
140 else throw eprintf(
"RLDLTKernel::solveI(), didn't understand side = %c", side);
145 {
return std::pair<int,int>(n_plus, n_minus); }
157 std::vector<int> P_swaps;
160 std::vector<int> Q_swaps;
173 {
public:
typedef Precision type; };
Factors A into L*L', presents solve methods.
Definition: Kernel.h:38
Reflects Number trait for a Container, containers of Numbers (Matrix's, Vector's, etc) should special...
Definition: Number.h:55
RLDLTKernel()
Default constructor, initializes to 0 size.
Definition: Kernel.h:43
Returns a std::runtime_error() whose message has been populated using printf()-style formatting...
int J
---------— Data members, all public ----------------—
Definition: MatrixRange.h:43
int size() const
Size inspector.
Definition: Kernel.h:148
int I
---------— Data members, all public ----------------—
Definition: MatrixRange.h:42
uint64_t factor()
Factors A = L*I*L'.
Definition: Kernel.h:59
uint64_t solveL(const MatrixRange< Precision > &B, char side, char op) const
Solves op(L)*X=B or X*op(L)=B, overwrites B with X.
Definition: Kernel.h:76
RLDLTKernel(LowerMatrixRange< Precision > &A, InputStream &in)
Constructs from an InputStream, after seating reference to L.
Definition: Kernel.h:51
ReaderWriter<T>, encapsulates a read()/write() pair for type T.
Range construct for a lower triangular matrix stored in rectangular packed format.
void solveI(const MatrixRange< Precision > &B, char side) const
Solves I*X=B or X*I=B, overwrites B with X.
Definition: Kernel.h:134
Routines for backsolving by a triangular Matrix or LowerMatrix.
Abstraction layer, serializable objects write themselves to these.
Definition: Streams.h:39
LDL' decompositions for real symmetric Matrix A (indefinite is fine).
RLDLTKernel(LowerMatrixRange< Precision > &A)
Seats reference to L, to be factor()'d later.
Definition: Kernel.h:47
Various utility functions/classes related to scalar Number types.
Routines related to swap sequences, often used during pivoting.
void write(OutputStream &out) const
Writes to an OutputStream.
Definition: Kernel.h:55
Represents a mutable MatrixRange.
Definition: conjugate.h:26
std::pair< int, int > inertia() const
Returns inertia I, (n_plus, n_minus). Useful for schur downdates.
Definition: Kernel.h:144
MatrixRange< Number > bottom(int i) const
Returns the i bottommost rows, this(I-i:I,:)
Definition: MatrixRange.cpp:186
MatrixRange< Number > right(int j) const
Returns the j rightmost columns, this(:,J-j:J)
Definition: MatrixRange.cpp:235
Bases classes for binary input/output streams.
Return type of sytrf_inplace() and hetrf_inplace(), holds pivoting metadata.
Definition: LDLSwaps.h:21