6 #ifndef MYRAMATH_MULTIFRONTAL_LU_KERNEL_H 7 #define MYRAMATH_MULTIFRONTAL_LU_KERNEL_H 24 #include <myramath/dense/detail/nwork.h> 35 template<
class Number>
class MYRAMATH_EXPORT
LUKernel 58 swaps = getrf_inplace(LU);
59 uint64_t k_work = this->size();
60 return k_work*(k_work+1)*(2*k_work+1)/6;
72 if (B.
I != N)
throw eprintf(
"LUKernel::solveL('L'eft), size mismatch B.I != N [%d != %d]", B.
I, N);
76 uint64_t w = trsm_nwork(
'L',
'L',
'N',LU,B,
'U');
81 uint64_t w = trsm_nwork(
'L',
'L',
'T',LU,B,
'U');
87 uint64_t w = trsm_nwork(
'L',
'L',
'H',LU,B,
'U');
94 uint64_t w = trsm_nwork(
'L',
'L',
'C',LU,B,
'U');
97 else throw eprintf(
"LUKernel::solveL('L'eft), didn't understand op = %c", op);
102 if (B.
J != N)
throw eprintf(
"LUKernel::solveL('R'ight), size mismatch B.J != N [%d != %d]", B.
J, N);
105 uint64_t w = trsm_nwork(
'R',
'L',
'N',LU,B,
'U');
106 swap_columns(swaps,B);
111 iswap_columns(swaps,B);
112 uint64_t w = trsm_nwork(
'R',
'L',
'T',LU,B,
'U');
117 iswap_columns(swaps,B);
118 uint64_t w = trsm_nwork(
'R',
'L',
'H',LU,B,
'U');
123 uint64_t w = trsm_nwork(
'R',
'L',
'C',LU,B,
'U');
124 swap_columns(swaps,B);
127 else throw eprintf(
"LUKernel::solveL('R'ight), didn't understand op = %c", op);
129 else throw eprintf(
"LUKernel::solveL(), didn't understand side = %c", side);
137 int N = this->size();
141 if (B.
I != N)
throw eprintf(
"LUKernel::solveU('L'eft), size mismatch B.I != N [%d != %d]", B.
I, N);
142 return trsm_nwork(side,
'U',op,LU,B,
'N');
144 else if (side ==
'R')
147 if (B.
J != N)
throw eprintf(
"LUKernel::solveU('R'ight), size mismatch B.J != N [%d != %d]", B.
J, N);
148 return trsm_nwork(side,
'U',op,LU,B,
'N');
150 else throw eprintf(
"LUKernel::solveU(), didn't understand side = %c", side);
155 {
return LU.size().first; }
163 std::vector<int> swaps;
168 {
public:
typedef Number type; };
Reflects Number trait for a Container, containers of Numbers (Matrix's, Vector's, etc) should special...
Definition: Number.h:55
int size() const
Size inspector.
Definition: Kernel.h:154
Returns a std::runtime_error() whose message has been populated using printf()-style formatting...
Interface class for representing subranges of dense Matrix's.
int J
---------— Data members, all public ----------------—
Definition: MatrixRange.h:43
LUKernel(MatrixRange< Number > &A, InputStream &in)
Constructs from an InputStream, after seating reference to LU.
Definition: Kernel.h:48
int I
---------— Data members, all public ----------------—
Definition: MatrixRange.h:42
LUKernel(MatrixRange< Number > &A)
Seats reference to LU, to be factor()'d later.
Definition: Kernel.h:44
ReaderWriter<T>, encapsulates a read()/write() pair for type T.
Factors A into L*U, presents solve methods.
Definition: Kernel.h:35
LUKernel()
Default constructor, initializes to 0 size.
Definition: Kernel.h:40
Routines for backsolving by a triangular Matrix or LowerMatrix.
Abstraction layer, serializable objects write themselves to these.
Definition: Streams.h:39
Various utility functions/classes related to scalar Number types.
Routines related to swap sequences, often used during pivoting.
Represents a mutable MatrixRange.
Definition: conjugate.h:26
uint64_t solveL(const MatrixRange< Number > &B, char side, char op) const
Solves op(L)*X=B or X*op(L)=B, overwrites B with X.
Definition: Kernel.h:66
void write(OutputStream &out) const
Writes to an OutputStream.
Definition: Kernel.h:52
uint64_t solveU(const MatrixRange< Number > &B, char side, char op) const
Solves op(U)*X=B or X*op(U)=B, overwrites B with X.
Definition: Kernel.h:135
Bases classes for binary input/output streams.
uint64_t factor()
Factors A = P'*L*U.
Definition: Kernel.h:56
General purpose A = P'*L*U decomposition for square Matrix's.