Skip to content

BUG: np.linspace is not supported #171

@SwayamInSync

Description

@SwayamInSync
In [4]: np.linspace(QuadPrecision(1),QuadPrecision(10), 10, dtype='object')
---------------------------------------------------------------------------
DTypePromotionError                       Traceback (most recent call last)
Cell In[4], line 1
----> 1 np.linspace(QuadPrecision(1),QuadPrecision(10), 10, dtype='object')

File ~/miniconda3/envs/quaddtype/lib/python3.12/site-packages/numpy/_core/function_base.py:131, in linspace(start, stop, num, endpoint, retstep, dtype, axis, device)
    129 conv = _array_converter(start, stop)
    130 start, stop = conv.as_arrays()
--> 131 dt = conv.result_type(ensure_inexact=True)
    133 if dtype is None:
    134     dtype = dt

DTypePromotionError: The DType <class 'numpy.dtypes._PyFloatDType'> could not be promoted by <class 'numpy_quaddtype.QuadPrecDType'>. This means that no common DType exists for the given inputs. For example they cannot be stored in a single array unless the dtype is `object`. The full list of DTypes is: (<class 'numpy_quaddtype.QuadPrecDType'>, <class 'numpy_quaddtype.QuadPrecDType'>, <class 'numpy.dtypes._PyFloatDType'>)

There are 2 issues here

  • quaddtype missing support for Python abstract dtype as common dtype
  • fill function not implemented (needed by np.arange)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions