| 157 | return _complex_types_map.get(t, default) |
| 158 | |
| 159 | def _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 | |
| 184 | def _to_native_byte_order(*arrays): |