MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / qr

Function qr

src/backend/cpu/qr.cpp:67–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65
66template<typename T>
67void qr(Array<T> &q, Array<T> &r, Array<T> &t, const Array<T> &in) {
68 dim4 iDims = in.dims();
69 int M = iDims[0];
70 int N = iDims[1];
71
72 const dim4 NullShape(0, 0, 0, 0);
73
74 dim4 endPadding(M - iDims[0], max(M, N) - iDims[1], 0, 0);
75 q = (endPadding == NullShape
76 ? copyArray(in)
77 : padArrayBorders(in, NullShape, endPadding, AF_PAD_ZERO));
78 q.resetDims(iDims);
79 t = qr_inplace(q);
80
81 // SPLIT into q and r
82 dim4 rdims(M, N);
83 r = createEmptyArray<T>(rdims);
84
85 triangle<T>(r, q, true, false);
86
87 auto func = [=](Param<T> q, Param<T> t, int M, int N) {
88 gqr_func<T>()(AF_LAPACK_COL_MAJOR, M, M, min(M, N), q.get(),
89 q.strides(1), t.get());
90 };
91 q.resetDims(dim4(M, M));
92 getQueue().enqueue(func, q, t, M, N);
93}
94
95template<typename T>
96Array<T> qr_inplace(Array<T> &in) {

Callers

nothing calls this directly

Calls 12

maxFunction · 0.70
copyArrayFunction · 0.70
padArrayBordersFunction · 0.70
qr_inplaceFunction · 0.70
minFunction · 0.70
dim4Class · 0.70
getQueueFunction · 0.50
dimsMethod · 0.45
resetDimsMethod · 0.45
getMethod · 0.45
stridesMethod · 0.45
enqueueMethod · 0.45

Tested by

no test coverage detected