Git Product home page Git Product logo

Comments (4)

anntzer avatar anntzer commented on July 30, 2024

The issue comes from

    cdef np.ndarray _cast(self, np.ndarray arr):
        if not issubclass(arr.dtype.type, np.number):
            raise CholmodError("non-numeric dtype %s" % (arr.dtype,))
        if self._complex:
            # All numeric types can be upcast to complex:
            return np.asfortranarray(arr, dtype=_complex_py_dtype)
        else:
            # Refuse to downcast complex types to real:
            if issubclass(arr.dtype.type, np.complexfloating):
                raise CholmodError("inconsistent use of complex array")
            else:
                return np.asfortranarray(arr, dtype=_real_py_dtype)

Specifically, 1d arrays are cast to 2d a bit earlier using d[:, None], which creates an array of strides (itemsize, 0). With numpy<1.12, asfortranarray would then create a new array with strides (itemsize, len*itemsize). But with relaxed stride checking, this is no longer the case, i.e. the original array of strides (itemsize, 0) is returned.

This then causes issue further down at

    cdef object _init_view_dense(self, cholmod_dense *out, np.ndarray m):
        if m.ndim != 2:
            raise CholmodError("array has %s dimensions (expected 2)" % m.ndim)
        m = self._cast(m)
        out.nrow = m.shape[0]
        out.ncol = m.shape[1] # oops, this is zero.
        out.nzmax = m.size
        out.d = m.strides[1] // m.itemsize
        out.x = m.data
        out.dtype = CHOLMOD_DOUBLE
        out.xtype = self._xtype
        return m

from scikit-sparse.

njsmith avatar njsmith commented on July 30, 2024

surely the issue must be with cholmod getting cranky at out.d == 0, no? According to your analysis, m.shape[1] is not zero, only m.strides[1] is?

from scikit-sparse.

njsmith avatar njsmith commented on July 30, 2024

ah, I see your PR came to the same conclusion :-)

from scikit-sparse.

jor- avatar jor- commented on July 30, 2024

Version 0.4.1 is released. This should fix this bug. (See PR #28.)

from scikit-sparse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.