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

Function af_svd_inplace

src/api/c/svd.cpp:100–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100af_err af_svd_inplace(af_array *u, af_array *s, af_array *vt, af_array in) {
101 try {
102 const ArrayInfo &info = getInfo(in);
103 dim4 dims = info.dims();
104
105 ARG_ASSERT(3, (dims.ndims() >= 0 && dims.ndims() <= 2));
106 af_dtype type = info.getType();
107
108 if (dims.ndims() == 0) {
109 AF_CHECK(af_create_handle(u, 0, nullptr, type));
110 AF_CHECK(af_create_handle(s, 0, nullptr, type));
111 AF_CHECK(af_create_handle(vt, 0, nullptr, type));
112 return AF_SUCCESS;
113 }
114
115 DIM_ASSERT(3, dims[0] >= dims[1]);
116
117 switch (type) {
118 case f64: svdInPlace<double>(s, u, vt, in); break;
119 case f32: svdInPlace<float>(s, u, vt, in); break;
120 case c64: svdInPlace<cdouble>(s, u, vt, in); break;
121 case c32: svdInPlace<cfloat>(s, u, vt, in); break;
122 default: TYPE_ERROR(1, type);
123 }
124 }
125 CATCHALL;
126 return AF_SUCCESS;
127}

Callers 1

svdInPlaceFunction · 0.50

Calls 4

af_create_handleFunction · 0.70
dimsMethod · 0.45
ndimsMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected