Skip to content

unable to compute vector norms using custom numeric type #521

Closed
@ofloveandhate

Description

@ofloveandhate

For the custom numeric type (mpfr complex, mpfr reals) I've implement in my pull request for the example #370 , I am unable to easily compute norms of vectors or matrices.


np.array( np.zeros( (3)).astype(np.int64),dtype=dtype)
np.norm(A)

fails with error message

TypeError: Cannot cast array data from dtype(MpfrComplex) to dtype('float64') according to the rule 'unsafe'

This sounds un-solvable, since I cannot convert my multiprecision complex numbers to float64.


As an alternative to using np.norm, I switched to

np.sqrt(np.sum((A)**2)

This fails with error message

 TypeError: ufunc 'square' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

That is, EigenPy doesn't provide the square ufunc, but it should.

(I still need to push the changes in my custom numeric type example, and I've added pytest unit tests for the example which help probe failing functionality)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions