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

Function lu_inplace

src/backend/cuda/lu.cpp:114–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112
113template<typename T>
114Array<int> lu_inplace(Array<T> &in, const bool convert_pivot) {
115 dim4 iDims = in.dims();
116 int M = iDims[0];
117 int N = iDims[1];
118
119 Array<int> pivot = createEmptyArray<int>(af::dim4(std::min(M, N), 1, 1, 1));
120
121 int lwork = 0;
122
123 CUSOLVER_CHECK(getrf_buf_func<T>()(solverDnHandle(), M, N, in.get(),
124 in.strides()[1], &lwork));
125
126 auto workspace = memAlloc<T>(lwork);
127 auto info = memAlloc<int>(1);
128
129 CUSOLVER_CHECK(getrf_func<T>()(solverDnHandle(), M, N, in.get(),
130 in.strides()[1], workspace.get(),
131 pivot.get(), info.get()));
132
133 if (convert_pivot) { convertPivot(pivot, M); }
134
135 return pivot;
136}
137
138bool isLAPACKAvailable() { return true; }
139

Callers 1

luFunction · 0.70

Calls 7

solverDnHandleFunction · 0.85
minFunction · 0.70
convertPivotFunction · 0.70
dim4Class · 0.50
dimsMethod · 0.45
getMethod · 0.45
stridesMethod · 0.45

Tested by

no test coverage detected