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

Function qr

src/backend/opencl/cpu/cpu_qr.cpp:59–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58template<typename T>
59void qr(Array<T> &q, Array<T> &r, Array<T> &t, const Array<T> &in) {
60 dim4 iDims = in.dims();
61 int M = iDims[0];
62 int N = iDims[1];
63
64 const dim4 NullShape(0, 0, 0, 0);
65
66 dim4 endPadding(M - iDims[0], max(M, N) - iDims[1], 0, 0);
67 q = (endPadding == NullShape
68 ? copyArray(in)
69 : padArrayBorders(in, NullShape, endPadding, AF_PAD_ZERO));
70 q.resetDims(iDims);
71 t = qr_inplace(q);
72
73 // SPLIT into q and r
74 dim4 rdims(M, N);
75 r = createEmptyArray<T>(rdims);
76
77 mapped_ptr<T> qPtr = q.getMappedPtr();
78 mapped_ptr<T> rPtr = r.getMappedPtr();
79 mapped_ptr<T> tPtr = t.getMappedPtr();
80
81 triangle<T, true, false>(rPtr.get(), qPtr.get(), rdims, r.strides(),
82 q.strides());
83
84 gqr_func<T>()(AF_LAPACK_COL_MAJOR, M, M, min(M, N), qPtr.get(),
85 q.strides()[1], tPtr.get());
86
87 q.resetDims(dim4(M, M));
88}
89
90template<typename T>
91Array<T> qr_inplace(Array<T> &in) {

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected