Skip to content

Conversation

@ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Dec 1, 2025

Still WIP, spinoff from #811

Major changes:

  1. Systematic fallback to obj mode for complex inputs
  2. Systematic casting of discrete inputs to floats (with a warning on compile_verbose)
  3. Systematic upcasting of inputs in operations with more than one input (still WIP)
  4. Change view(inp).ctypes -> inp.ctypes
  5. Explicitly handle empty inputs, as lapack tends to raise

Re: Change view(inp).ctypes -> inp.ctypes

This may have be needed when working with complex inputs? But we are not supporting them in most implementations, so it makes code more complex and is a potential source of bugs when we fail to systematically upcast input (point 3. from above)

Say we have a float32 and a float64 inputs, and forget to upcast the first one. Calling view will raise for non f-contiguous inputs (which we always need for these routines):

import numpy as np x = np.asfortranarray(np.eye(3, dtype="float64")) x.view(dtype="float32") # ValueError: To change to a dtype of a different size, the last axis must be contiguous

Even if it didn't raise the meaning of the array would be nonsensical:

np.eye(3, dtype="float64").view(dtype="float32") # array([[0. , 1.875, 0. , 0. , 0. , 0. ], # [0. , 0. , 0. , 1.875, 0. , 0. ], # [0. , 0. , 0. , 0. , 0. , 1.875]], dtype=float32)

I think we need to call different routines for complex inputs anyway?

@ricardoV94
Copy link
Member Author

We should redo _check_scipy_linalg_matrix to take a dtype as well, so if an input dtype does not match the operation dtype it raises during numba typing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant