MCPcopy Create free account
hub / github.com/numpy/numpy / _commonType

Function _commonType

numpy/linalg/linalg.py:159–181  ·  view source on GitHub ↗
(*arrays)

Source from the content-addressed store, hash-verified

157 return _complex_types_map.get(t, default)
158
159def _commonType(*arrays):
160 # in lite version, use higher precision (always double or cdouble)
161 result_type = single
162 is_complex = False
163 for a in arrays:
164 type_ = a.dtype.type
165 if issubclass(type_, inexact):
166 if isComplexType(type_):
167 is_complex = True
168 rt = _realType(type_, default=None)
169 if rt is double:
170 result_type = double
171 elif rt is None:
172 # unsupported inexact scalar
173 raise TypeError("array type %s is unsupported in linalg" %
174 (a.dtype.name,))
175 else:
176 result_type = double
177 if is_complex:
178 result_type = _complex_types_map[result_type]
179 return cdouble, result_type
180 else:
181 return double, result_type
182
183
184def _to_native_byte_order(*arrays):

Callers 15

solveFunction · 0.85
invFunction · 0.85
choleskyFunction · 0.85
qrFunction · 0.85
eigvalsFunction · 0.85
eigvalshFunction · 0.85
_convertarrayFunction · 0.85
eigFunction · 0.85
eighFunction · 0.85
svdFunction · 0.85
condFunction · 0.85
slogdetFunction · 0.85

Calls 2

isComplexTypeFunction · 0.85
_realTypeFunction · 0.85

Tested by

no test coverage detected