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

Function af_det

src/api/c/det.cpp:72–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72af_err af_det(double *real_val, double *imag_val, const af_array in) {
73 try {
74 const ArrayInfo &i_info = getInfo(in);
75
76 if (i_info.ndims() > 2) {
77 AF_ERROR("solve can not be used in batch mode", AF_ERR_BATCH);
78 }
79
80 af_dtype type = i_info.getType();
81
82 if (i_info.dims()[0]) {
83 DIM_ASSERT(1, i_info.dims()[0] ==
84 i_info.dims()[1]); // Only square matrices
85 }
86 ARG_ASSERT(1, i_info.isFloating()); // Only floating and complex types
87
88 *real_val = 0;
89 *imag_val = 0;
90
91 cfloat cfval;
92 cdouble cdval;
93
94 switch (type) {
95 case f32: *real_val = det<float>(in); break;
96 case f64: *real_val = det<double>(in); break;
97 case c32:
98 cfval = det<cfloat>(in);
99 *real_val = real(cfval);
100 *imag_val = imag(cfval);
101 break;
102 case c64:
103 cdval = det<cdouble>(in);
104 *real_val = real(cdval);
105 *imag_val = imag(cdval);
106 break;
107 default: TYPE_ERROR(1, type);
108 }
109 }
110 CATCHALL;
111
112 return AF_SUCCESS;
113}

Callers

nothing calls this directly

Calls 6

isFloatingMethod · 0.80
realFunction · 0.50
imagFunction · 0.50
ndimsMethod · 0.45
getTypeMethod · 0.45
dimsMethod · 0.45

Tested by

no test coverage detected