Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

number of elements exceeds INT_MAX #169

Closed
lizhijie-sitx opened this issue Jun 10, 2020 · 2 comments
Closed

number of elements exceeds INT_MAX #169

lizhijie-sitx opened this issue Jun 10, 2020 · 2 comments

Comments

@lizhijie-sitx
Copy link

lizhijie-sitx commented Jun 10, 2020

Hi,

When I use cvxopt.solvers.sdp to deal with big matrix input. It raise a exception:

OverflowError: number of elements exceeds INT_MAX

I find the code in dense.c

/*
  Creates an unpopulated "empty" matrix. In API
 */
matrix * Matrix_New(int nrows, int ncols, int id)
{
  matrix *a;
  if ((nrows < 0) || (ncols < 0) || (id < INT) || (id > COMPLEX)) {
    PyErr_BadInternalCall();
    return NULL;
  }
  else if (ncols > 0 && nrows > (INT_MAX/ncols)) {
    PyErr_SetString(PyExc_OverflowError, "number of elements exceeds INT_MAX");
    return NULL;
  }
  else if (!(a = (matrix *)matrix_tp.tp_alloc(&matrix_tp, 0))) {
    PyErr_NoMemory();
    return NULL;
  }

  a->id = id; a->nrows = nrows; a->ncols = ncols;
  if ((a->buffer = calloc(nrows*ncols,E_SIZE[id])))
    return a;
  else if (nrows*ncols == 0) 
    return a;
  else {
#if PY_MAJOR_VERSION >= 3
    Py_TYPE(a)->tp_free((PyObject*)a);
#else
    a->ob_type->tp_free((PyObject*)a);
#endif
    return (matrix *)PyErr_NoMemory();
  }
}

I don't know why set the INT_MAX limit here. Is it easy to support matrix elements exceeds INT_MAX?

@lizhijie-sitx
Copy link
Author

I find the previous issue #126
I'm using the latest code. Is there any plan to support large scale matrix ?

@martinandersen
Copy link
Contributor

As mentioned in #126:

Accommodating the ILP64 version of BLAS/LAPACK will require significant changes. This is something that we would like to do eventually, but it will probably not happen any time soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants