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

Function inverse

src/backend/cpu/inverse.cpp:51–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50template<typename T>
51Array<T> inverse(const Array<T> &in) {
52 int M = in.dims()[0];
53 int N = in.dims()[1];
54
55 if (M != N) {
56 Array<T> I = identity<T>(in.dims());
57 return solve(in, I);
58 }
59
60 Array<T> A = copyArray<T>(in);
61 Array<int> pivot = lu_inplace<T>(A, false);
62
63 auto func = [=](Param<T> A, Param<int> pivot, int M) {
64 getri_func<T>()(AF_LAPACK_COL_MAJOR, M, A.get(), A.strides(1),
65 pivot.get());
66 };
67 getQueue().enqueue(func, A, pivot, M);
68
69 return A;
70}
71
72#define INSTANTIATE(T) template Array<T> inverse<T>(const Array<T> &in);
73

Callers

nothing calls this directly

Calls 6

solveFunction · 0.70
getQueueFunction · 0.50
dimsMethod · 0.45
getMethod · 0.45
stridesMethod · 0.45
enqueueMethod · 0.45

Tested by

no test coverage detected