GithubHelp home page GithubHelp logo

quantco / tabmat Goto Github PK

View Code? Open in Web Editor NEW
103.0 14.0 3.0 12.1 MB

Efficient matrix representations for working with tabular data

Home Page: https://tabmat.readthedocs.io/

License: BSD 3-Clause "New" or "Revised" License

Shell 0.14% Python 83.17% C++ 7.66% Cython 9.03%
categorical-data matrix-vector-products dense sparse sandwich-products matrix

tabmat's Introduction

Efficient matrix representations for working with tabular data

CI Docs Conda-forge PypiVersion PythonVersion

Installation

Simply install via conda-forge!

conda install -c conda-forge tabmat

Getting Started

The easiest way to start with tabmat is to use the convenience constructor tabmat.from_pandas.

import tabmat as tm
import numpy as np

dense_array = np.random.normal(size=(100, 1))

Use case

TL;DR: We provide matrix classes for efficiently building statistical algorithms with data that is partially dense, partially sparse and partially categorical.

Data used in economics, actuarial science, and many other fields is often tabular, containing rows and columns. Further common properties are also common:

  • It often is very sparse.
  • It often contains a mix of dense and sparse columns.
  • It often contains categorical data, processed into many columns of indicator values created by "one-hot encoding."

High-performance statistical applications often require fast computation of certain operations, such as

  • Computing sandwich products of the data, transpose(X) @ diag(d) @ X. A sandwich product shows up in the solution to weighted least squares, as well as in the Hessian of the likelihood in generalized linear models such as Poisson regression.
  • Matrix-vector products, possibly on only a subset of the rows or columns. For example, when limiting computation to an "active set" in a L1-penalized coordinate descent implementation, we may only need to compute a matrix-vector product on a small subset of the columns.
  • Computing all operations on standardized predictors which have mean zero and standard deviation one. This helps with numerical stability and optimizer efficiency in a wide range of machine learning algorithms.

This library and its design

We designed this library with the above use cases in mind. We built this library first for estimating generalized linear models, but expect it will be useful in a variety of econometric and statistical use cases. This library was borne out of our need for speed, and its unified API is motivated by the desire to work with a unified matrix API internal to our statistical algorithms.

Design principles:

  • Speed and memory efficiency are paramount.
  • You don't need to sacrifice functionality by using this library: DenseMatrix and SparseMatrix subclass np.ndarray and scipy.sparse.csc_matrix respectively, and inherit behavior from those classes wherever it is not improved on.
  • As much as possible, syntax follows NumPy syntax, and dimension-reducing operations (like sum) return NumPy arrays, following NumPy dimensions about the dimensions of results. The aim is to make these classes as close as possible to being drop-in replacements for numpy.ndarray. This is not always possible, however, due to the differing APIs of numpy.ndarray and scipy.sparse.
  • Other operations, such as toarray, mimic Scipy sparse syntax.
  • All matrix classes support matrix-vector products, sandwich products, and getcol.

Individual subclasses may support significantly more operations.

Matrix types

  • DenseMatrix represents dense matrices, subclassing numpy nparray. It additionally supports methods getcol, toarray, sandwich, standardize, and unstandardize.
  • SparseMatrix represents column-major sparse data, subclassing scipy.sparse.csc_matrix. It additionally supports methods sandwich and standardize.
  • CategoricalMatrix represents one-hot encoded categorical matrices. Because all the non-zeros in these matrices are ones and because each row has only one non-zero, the data can be represented and multiplied much more efficiently than a generic sparse matrix.
  • SplitMatrix represents matrices with both dense, sparse and categorical parts, allowing for a significant speedup in matrix multiplications.
  • StandardizedMatrix efficiently and sparsely represents a matrix that has had its column normalized to have mean zero and variance one. Even if the underlying matrix is sparse, such a normalized matrix will be dense. However, by storing the scaling and shifting factors separately, StandardizedMatrix retains the original matrix sparsity.

Wide data set

Benchmarks

See here for detailed benchmarking.

API documentation

See here for detailed API documentation.

tabmat's People

Contributors

adityagoel4512 avatar benbarrettqc avatar christianroerigqc avatar dependabot[bot] avatar esantorella avatar jjerphan avatar jonashaag avatar jtilly avatar lbittarello avatar marcantoineschmidtqc avatar margueritebastaqc avatar martinstancsicsqc avatar matthiasschmidtblaicherqc avatar michaelyingh avatar pavelzw avatar quant-ranger[bot] avatar readthedocs-assistant avatar sultanorazbayev avatar tbenthompson avatar xhochy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tabmat's Issues

Poor performance on narrow sparse matrices.

I've been investigating problems where our MKL-based sparse matrices are massively underperforming scipy.sparse. For example:

  operation           storage memory        time
0    matvec  scipy.sparse csc      0  0.00211215
1    matvec  quantcore.matrix      0   0.0266283

This is a matrix with 3e6 rows and 3 columns

It seems like having a small number of columns makes MKL perform quite poorly. I'm not sure why that's the case. But, it may be worth having a check and just falling back to scipy.sparse in narrow cases like this. This kind of narrow case may actually be the dominant use case for sparse matrices because they will be a small component of a SplitMatrix.

Support initializing matrices with Patsy?

I think we've discussed this, but I don't remember the conclusion and can't find an issue now.

We recommend from_pandas as the way "most users" should construct tabmat objects. from_pandas then guesses which columns should be treated as categorical. I think it would be really nice to have Patsy-like formulas as an alternative, since

  1. R users (including many economists) like using formulas, and
  2. It's easy to infer from a Patsy formula which columns are categorical, which are sparse (generally interactions with categoricals), and which are dense (everything else), so this could remove some of the guesswork from tabmat and improve performance.

I'm not sure how feasible this would be, since Patsy is a sizable library that allows for fairly sophisticated formulas and it would be quite an endeavor to replicate all of the functionality. A few ways of doing this would be

  1. Don't change any code, but document how Patsy can already be used to construct a dataframe that can then be passed to tabmat / glum. Warn that this involves creating a large dense matrix as an intermediate. See Twitter discussion: https://twitter.com/esantorella22/status/1447980727820296198
  2. Have tabmat call patsy.dmatrix with "return_type = 'dataframe'", then call tabmat.from_pandas on the resulting pd.DataFrame. That would not be any more efficient than (1), but would just save the user a little typing and the need to install patsy. On the down side, it adds a dependency and may force creation of a very large dense matrix.
  3. Support very simple patsy-like formulas without having patsy as a dependency or reproducing its full functionality. That would allow the user to designate which columns should be treated as categorical in a more natural way. See Twitter discussion: https://twitter.com/esantorella22/status/1447981081358184461
  4. Make it so that any Patsy formula can be used to create a tabmat object -- I'm not sure how. Might be hard.

Long-term ideas

  • Try using taco to generate optimized, compiled matrix code, e.g. for sandwich and categorical operations that we are currently doing in C++

Buffer dtype mismatch, expected 'long' but got 'long long'

I get the aforementioned error on a bunch of tests on Windows. The stack trace is short: e.g.,

tests\test_split_matrix.py:141: in test_split_col_subsets
    subset_cols_indices, subset_cols, n_cols = mat._split_col_subsets(cols)
..\..\..\Python\lib\site-packages\quantcore\matrix\split_matrix.py:206: in _split_col_subsets
    return split_col_subsets(self, cols)
src\quantcore\matrix\ext\split.pyx:138: in quantcore.matrix.ext.split.split_col_subsets
    this_idx_view = self.indices[j]
E   ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'

The lord Jan of Tilly reports similar errors all over the web: e.g., on scikit-learn.

Complete list of failures:

FAILED tests/test_benchmark_cli.py::test_run_all_benchmarks[False-True-False-sparse,dense_cat] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_benchmark_cli.py::test_run_all_benchmarks[False-True-True-sparse,dense_cat] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_benchmark_cli.py::test_run_all_benchmarks[True-True-False-sparse,dense_cat] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_benchmark_cli.py::test_run_all_benchmarks[True-True-True-sparse,dense_cat] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[None-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[None-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[cols1-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[cols1-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[cols1-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[cols2-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[cols2-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[cols2-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[cols3-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[cols3-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec_out_parameter[cols3-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[None-cols1-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[None-cols1-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[None-cols1-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[None-cols2-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[None-cols2-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[None-cols2-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[None-cols3-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[None-cols3-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[None-cols3-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows1-cols1-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows1-cols1-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows1-cols1-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows1-cols2-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows1-cols2-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows1-cols2-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows1-cols3-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows1-cols3-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows1-cols3-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows2-cols1-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows2-cols1-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows2-cols1-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows2-cols2-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows2-cols2-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows2-cols2-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows2-cols3-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows2-cols3-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows2-cols3-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows3-cols1-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows3-cols1-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows3-cols1-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows3-cols2-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows3-cols2-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows3-cols2-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows3-cols3-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows3-cols3-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec_out_parameter[rows3-cols3-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-None-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-None-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-None-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-None-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-None-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-None-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols1-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols1-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols1-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols1-asarray-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols1-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols1-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols1-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols1-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols1-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols2-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols2-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols2-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols2-asarray-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols2-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols2-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols2-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols2-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols2-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols3-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols3-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols3-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols3-asarray-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols3-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols3-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols3-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols3-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape0-cols3-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-None-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-None-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-None-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-None-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-None-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-None-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols1-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols1-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols1-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols1-asarray-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols1-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols1-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols1-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols1-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols1-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols2-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols2-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols2-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols2-asarray-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols2-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols2-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols2-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols2-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols2-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols3-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols3-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols3-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols3-asarray-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols3-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols3-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols3-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols3-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape1-cols3-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-None-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-None-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-None-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-None-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-None-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-None-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols1-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols1-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols1-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols1-asarray-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols1-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols1-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols1-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols1-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols1-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols2-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols2-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols2-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols2-asarray-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols2-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols2-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols2-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols2-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols2-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols3-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols3-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols3-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols3-asarray-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols3-asarray-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols3-asarray-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols3-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols3-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_matvec[other_shape2-cols3-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-None-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-None-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-None-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-None-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-None-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-None-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-None-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-None-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-None-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows1-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows1-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows1-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows1-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows1-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows1-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows1-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows1-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows1-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows2-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows2-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows2-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows2-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows2-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows2-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows2-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows2-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows2-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows3-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows3-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows3-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows3-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows3-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows3-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows3-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows3-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols1-rows3-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-None-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-None-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-None-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-None-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-None-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-None-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-None-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-None-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-None-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows1-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows1-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows1-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows1-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows1-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows1-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows1-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows1-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows1-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows2-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows2-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows2-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows2-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows2-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows2-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows2-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows2-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows2-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows3-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows3-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows3-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows3-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows3-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows3-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows3-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows3-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols2-rows3-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-None-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-None-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-None-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-None-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-None-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-None-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-None-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-None-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-None-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows1-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows1-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows1-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows1-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows1-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows1-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows1-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows1-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows1-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows2-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows2-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows2-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows2-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows2-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows2-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows2-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows2-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows2-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows3-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows3-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows3-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows3-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows3-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows3-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows3-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows3-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_transpose_matvec[cols3-rows3-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-None-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-None-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-None-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-None-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-None-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-None-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows1-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows1-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows1-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows1-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows1-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows1-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows2-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows2-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows2-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows2-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows2-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows2-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows3-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows3-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows3-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows3-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows3-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[None-rows3-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-None-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-None-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-None-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-None-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-None-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-None-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-None-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-None-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-None-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows1-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows1-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows1-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows1-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows1-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows1-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows1-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows1-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows1-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows2-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows2-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows2-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows2-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows2-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows2-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows2-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows2-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows2-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows3-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows3-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows3-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows3-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows3-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows3-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows3-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows3-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols1-rows3-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-None-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-None-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-None-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-None-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-None-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-None-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-None-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-None-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-None-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows1-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows1-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows1-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows1-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows1-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows1-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows1-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows1-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows1-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows2-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows2-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows2-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows2-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows2-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows2-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows2-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows2-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows2-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows3-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows3-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows3-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows3-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows3-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows3-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows3-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows3-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols2-rows3-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-None-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-None-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-None-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-None-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-None-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-None-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-None-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-None-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-None-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows1-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows1-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows1-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows1-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows1-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows1-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows1-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows1-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows1-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows2-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows2-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows2-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows2-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows2-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows2-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows2-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows2-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows2-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows3-<lambda>-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows3-<lambda>-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows3-<lambda>-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows3-array-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows3-array-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows3-array-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows3-DenseMatrix-mat6] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows3-DenseMatrix-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_self_sandwich[cols3-rows3-DenseMatrix-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols1-None] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols1-rows1] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols1-rows2] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols1-rows3] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols2-None] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols2-rows1] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols2-rows2] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols2-rows3] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols3-None] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols3-rows1] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols3-rows2] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_split_sandwich[cols3-rows3] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_astype[float64-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_astype[float64-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_astype[float32-mat13] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_matrices.py::test_astype[float32-mat20] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_sandwich[cols1-mat0] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_sandwich[cols1-mat1] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_sandwich[cols1-mat2] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_sandwich[cols2-mat0] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_sandwich[cols2-mat1] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_sandwich[cols2-mat2] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_sandwich[cols3-mat0] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_sandwich[cols3-mat1] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_sandwich[cols3-mat2] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_split_col_subsets[cols1-mat0] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_split_col_subsets[cols1-mat1] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_split_col_subsets[cols1-mat2] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_split_col_subsets[cols2-mat0] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_split_col_subsets[cols2-mat1] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_split_col_subsets[cols2-mat2] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_split_col_subsets[cols3-mat0] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_split_col_subsets[cols3-mat1] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'
FAILED tests/test_split_matrix.py::test_split_col_subsets[cols3-mat2] - ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'

Support sparse output for sandwich products

There are situations where we can expect ahead of time that the output of a sandwich product will be sparse:

  • If the data is dominated by one very high-dimensional categorical. For example, say there are D dense columns, and M categorical columns. The fraction of nonzeros in the resulting sandwich product will be at most (D^2 + 2 DM + M) / (D + M)^2. If M >> D this matrix will be quite sparse. This could happen in an e-commerce pricing context, if features are a categorical product ID that is very high-dimensional and a small number of scalars.
  • Perhaps we have computed x.sandwich(d1) and now we want to know x.sandwich(d2). The latter will have the same sparsity pattern as the former.
  • We can analytically upper-bound the number of nonzero elements in a sandwich product of categoricals using the number of rows. If the data is made up mainly of categoricals and is very wide relative to its length, its sandwich product will be fairly sparse. This would be true in, for example, the German employer-employee data set used in the AKM papers. Since a typical worker will usually not have worked for a randomly-chosen firm, the sandwich product would be very sparse.

should we add pandas-style metadata to matrices?

Currently, we view the matrices more as numpy arrays than pandas dataframe. Ideally, we want to be in the middle and view this as columnar data. Most importantly, storing the column names would be very helpful for many different workflows.

A non-exhaustive list of implementation ideas:

  1. add this to the current implementation of Dense|Sparse|Split|Categorical-Matrix.
  2. create a new class that will hold the matrix as an attribute and expose some pandas-style helper functions.

Bug in SplitMatrix matvec

#116 introduced a bug that I don't fully understand yet: matvec() on a split matrix doesn't work correctly.

This is fine (n_rows=5):

from tabmat import from_pandas

import numpy as np
import pandas as pd

n_rows = 5
n_cols = 2

np.random.seed(1234)

categories = [f"cat_{val}" for val in range(5)]
X = pd.DataFrame(np.random.choice(categories, size=(n_rows, n_cols))).astype(
        "category"
    )
X.columns = [str(col) for col in X.columns]

from_pandas(X).matvec(np.array(7 * [1]))
# array([2., 2., 2., 2., 2.])

This isn't (n_rows=7):

from tabmat import from_pandas

import numpy as np
import pandas as pd

n_rows = 10
n_cols = 2

np.random.seed(1234)

categories = [f"cat_{val}" for val in range(5)]
X = pd.DataFrame(np.random.choice(categories, size=(n_rows, n_cols))).astype(
        "category"
    )
X.columns = [str(col) for col in X.columns]

from_pandas(X).matvec(np.array(9 * [1]))
# array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])

This causes unpleasant issues in glum:

from glum import GeneralizedLinearRegressor

import numpy as np
import pandas as pd

n_rows = 10
n_cols = 2

categories = [f"cat_{val}" for val in range(5)]

np.random.seed(1234) # change the seed to 12345 and it will work
X = pd.DataFrame(np.random.choice(categories, size=(n_rows, n_cols))).astype(
        "category"
    )
X.columns = [str(col) for col in X.columns]

y = np.random.random(size=n_rows)

pd.concat([
	pd.Series(GeneralizedLinearRegressor(alpha=10).fit(X, y).coef_),
	pd.Series(GeneralizedLinearRegressor(alpha=10).fit(pd.get_dummies(X), y).coef_)
], axis=1)

# Out[1]: 
#           0         1
# 0 -0.000985 -0.003941
# 1 -0.000929 -0.003715
# 2  0.001280  0.005120
# 3  0.000653  0.002611
# 4 -0.000019 -0.000075
# 5  0.000189  0.000754
# 6 -0.000549 -0.002195
# 7  0.000547  0.002189
# 8 -0.000187 -0.000748

When I revert #116, the issue disappears.

from_pandas modifies user's input

Related to conversions to sparse. Perhaps related to L111.

MRE

import numpy as np
import pandas as pd
from quantcore.matrix import from_pandas

df = pd.DataFrame({"x": [0, 0, 1], "y": pd.arrays.Categorical(["i", "ii", "iii"])})
from_pandas(df, sparse_threshold=0.5, cat_threshold=1)
df.dtypes

yields

x    Sparse[int64, 0]
y            category
dtype: object

Fix OS X + Python 3.7 CI error

See here: https://github.com/Quantco/quantcore.matrix/pull/59/checks?check_run_id=1962582053

___________________________ test_fast_sandwich_dense ___________________________
[gw0] darwin -- Python 3.7.10 /Users/runner/miniconda3/envs/quantcore.matrix/bin/python
tests/test_fast_sandwich.py:41: in test_fast_sandwich_dense
    np.arange(A.shape[1]), size=np.random.randint(A.shape[1]), replace=False
mtrand.pyx:747: in numpy.random.mtrand.RandomState.randint
    ???
_bounded_integers.pyx:1254: in numpy.random._bounded_integers._rand_int64
    ???
E   ValueError: low >= high

Better indices validation for split matrix

Currently, we accept whatever inputs for indices when creating a SplitMatrix. It's possible to pass strings, numbers, or any type of object. Duplicates are also allowed. However, many methods assume that the indices are "well-behaved" and act as a true 0-based index.

Do we want to check that we have a unique, 0 to mat.shape[1] - 1 index?

Matrix optimizations

  • Add to the benchmark suite: problems with mild and severe row restrictions, problems with mild and severe column restrictions.
  • Add exceptions everywhere for when cols is None or rows is None.
  • Add output array as an optional argument to dot/transpose_dot/sandwich. This will be useful for avoiding unnecessary allocations. It will solve #25 and will enable some improvements in speed, particularly for SplitMatrix.dot which is allocating a new output array for each submatrix. After the optimization, SplitMatrix will only need one output array instead of len(matrices). Relatedly (complete now): flatironinstitute/sparse_dot#9
  • Cythonize row and column limiting for categorical sandwiches (currently just have rows)
  • Think about reducing duplication across different implementations that differ based on whether rows or cols are restricted: #5 -- is there some inspiration that would come from thinking about the restrictions as sparse matrices?

Use a namespaced version of `jemalloc`

We are currently observing issues when using quantcore.matrix in conjunction with onnx and onnxruntime on MacOS. The call to python -c 'import onnx; import quantcore.matrix.ext.dense; import onnxruntime' fails with a bus error or segfault whereas the call DYLD_INSERT_LIBRARIES=$CONDA_PREFIX/lib/libjemalloc.dylib python -c 'import onnx; import quantcore.matrix.ext.dense; import onnxruntime' passes just fine. This indicates that using an unnamespaced jemalloc may be problematic here as the following traceback indicates:

collecting ... Process 6259 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x4efffffff7)
    frame #0: 0x000000013c0f3704 libjemalloc.2.dylib`je_free_default + 240
libjemalloc.2.dylib`je_free_default:
->  0x13c0f3704 <+240>: str    x20, [x8, w9, sxtw #3]
    0x13c0f3708 <+244>: ldr    w8, [x19, #0x200]
    0x13c0f370c <+248>: sub    w9, w8, #0x1              ; =0x1
    0x13c0f3710 <+252>: str    w9, [x19, #0x200]
Target 0: (python) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x4efffffff7)
  * frame #0: 0x000000013c0f3704 libjemalloc.2.dylib`je_free_default + 240
    frame #1: 0x0000000142745010 onnxruntime_pybind11_state.so`std::__1::__hash_table<std::__1::__hash_value_type<std::__1::type_index, std::__1::vector<bool (*)(_object*, void*&), std::__1::allocator<bool (*)(_object*, void*&)> > >, std::__1::__unordered_map_hasher<std::__1::type_index, std::__1::__hash_value_type<std::__1::type_index, std::__1::vector<bool (*)(_object*, void*&), std::__1::allocator<bool (*)(_object*, void*&)> > >, pybind11::detail::type_hash, pybind11::detail::type_equal_to, true>, std::__1::__unordered_map_equal<std::__1::type_index, std::__1::__hash_value_type<std::__1::type_index, std::__1::vector<bool (*)(_object*, void*&), std::__1::allocator<bool (*)(_object*, void*&)> > >, pybind11::detail::type_equal_to, pybind11::detail::type_hash, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::type_index, std::__1::vector<bool (*)(_object*, void*&), std::__1::allocator<bool (*)(_object*, void*&)> > > > >::__rehash(unsigned long) + 76
    frame #2: 0x0000000142744dd0 onnxruntime_pybind11_state.so`std::__1::pair<std::__1::__hash_iterator<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::type_index, std::__1::vector<bool (*)(_object*, void*&), std::__1::allocator<bool (*)(_object*, void*&)> > >, void*>*>, bool> std::__1::__hash_table<std::__1::__hash_value_type<std::__1::type_index, std::__1::vector<bool (*)(_object*, void*&), std::__1::allocator<bool (*)(_object*, void*&)> > >, std::__1::__unordered_map_hasher<std::__1::type_index, std::__1::__hash_value_type<std::__1::type_index, std::__1::vector<bool (*)(_object*, void*&), std::__1::allocator<bool (*)(_object*, void*&)> > >, pybind11::detail::type_hash, pybind11::detail::type_equal_to, true>, std::__1::__unordered_map_equal<std::__1::type_index, std::__1::__hash_value_type<std::__1::type_index, std::__1::vector<bool (*)(_object*, void*&), std::__1::allocator<bool (*)(_object*, void*&)> > >, pybind11::detail::type_equal_to, pybind11::detail::type_hash, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::type_index, std::__1::vector<bool (*)(_object*, void*&), std::__1::allocator<bool (*)(_object*, void*&)> > > > >::__emplace_unique_key_args<std::__1::type_index, std::__1::piecewise_construct_t const&, std::__1::tuple<std::__1::type_index const&>, std::__1::tuple<> >(std::__1::type_index const&, std::__1::piecewise_construct_t const&, std::__1::tuple<std::__1::type_index const&>&&, std::__1::tuple<>&&) + 480
    frame #3: 0x00000001427427dc onnxruntime_pybind11_state.so`pybind11::detail::generic_type::initialize(pybind11::detail::type_record const&) + 396
    frame #4: 0x0000000142751688 onnxruntime_pybind11_state.so`pybind11::class_<onnxruntime::ExecutionOrder>::class_<>(pybind11::handle, char const*) + 140
    frame #5: 0x00000001427513f8 onnxruntime_pybind11_state.so`pybind11::enum_<onnxruntime::ExecutionOrder>::enum_<>(pybind11::handle const&, char const*) + 52
    frame #6: 0x000000014272b5c8 onnxruntime_pybind11_state.so`onnxruntime::python::addObjectMethods(pybind11::module_&, onnxruntime::Environment&) + 296
    frame #7: 0x0000000142734e68 onnxruntime_pybind11_state.so`PyInit_onnxruntime_pybind11_state + 340
    frame #8: 0x000000010019f994 python`_imp_create_dynamic + 2412
    frame #9: 0x00000001000b40f8 python`cfunction_vectorcall_FASTCALL + 208
    frame #10: 0x000000010016bfd8 python`_PyEval_EvalFrameDefault + 30088

My suggestion would be to add an output to the jemalloc-feedstock as described in conda-forge/jemalloc-feedstock#23 that comes with a prefixed version of the library.

Categorical matrix optimizations

Replaces Quantco/glum#246
PR: Quantco/glum#253

  • Add functionality for F-ordered categorical x dense sandwiches
  • Keep speeding up hotspots (currently _check_csc and categorical own-sandwich)
  • Extend our data setup (in problems.py) to allow for matrices with mixed dense, sparse, and categorical parts. Currently, it just allows for etiher dense/sparse or dense/categorical.
  • Experiment with making small categoricals part of the sparse or dense blocks. Currently, sandwich operations including small categoricals are relatively slow.
  • Continue to speed up slow spots, like categorical sandwiched with dense
  • Cythonize row and column limiting for categorical sandwiches (currently just have rows)
  • Cook up an example where we expect a large performance gain from categorical
  • Allow for indices to have various int dtypes
  • Add a test for _vec_plus_matvec

categorical and dense matrix multiplication not commutative

Came across the following behaviour:

import quantcore.matrix as mx
import numpy as np
categorical_data = np.tile(['a', 'b', 'c', 'd'], 25)
cat_mat = mx.CategoricalMatrix(categorical_data)
num_mat = mx.DenseMatrix(np.arange(100, dtype=float))
mx.SparseMatrix(cat_mat * num_mat) # runs
try:
    mx.SparseMatrix(num_mat * cat_mat)
except TypeError as e:
    print(e) # gives error

I don't know if this is a feature or a bug, so I wanted to draw attention to it.

DenseMatrix.sandwich fails when data is not writeable

In [1]: import quantcore.matrix as mx                                                                         

In [2]: import numpy as np                                                                                    

In [3]: mat = mx.DenseMatrix(np.ones((3, 2)))                                                                 

In [4]: mat.setflags(write=False)                                                                             

In [5]: mat.sandwich(np.ones(len(mat)))                                                                       
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-8a1362cb7738> in <module>
----> 1 mat.sandwich(np.ones(len(mat)))

~/Documents/quantco/quantcore.matrix/src/quantcore/matrix/dense_matrix.py in sandwich(self, d, rows, cols)
     44         if cols is None:
     45             cols = np.arange(self.shape[1], dtype=np.int32)
---> 46         return dense_sandwich(self, d, rows, cols)
     47 
     48     def cross_sandwich(

src/quantcore/matrix/ext/dense.pyx in quantcore.matrix.ext.dense.dense_sandwich()

~/Documents/quantco/quantcore.matrix/src/quantcore/matrix/ext/dense.cpython-38-darwin.so in View.MemoryView.memoryview_cwrapper()

~/Documents/quantco/quantcore.matrix/src/quantcore/matrix/ext/dense.cpython-38-darwin.so in View.MemoryView.memoryview.__cinit__()

ValueError: buffer source array is read-only

A qc.matrix design proposal

A qc.matrix design proposal:

I've been uncomfortable with the qc.matrix direction lately. This morning, I've thinking API and some of the recent feature addition/API consistency changes. I think the API surface area for qc.matrix is way too large. I don't want to create a huge library at the moment. If we do want to do that, I think we're several months away from being able to release the library.

I'd like to propose that we adopt a design goal for qc.matrix: the project is built as a backend for matrix operations in an algorithmic setting and should not be used for constructing or manipulating your data matrix -- similar in spirit to a LightGBM Dataset object. In light of that, I'd like to propose that the public API consist of two subsets:

  1. A "user"-facing API
    1. from_pandas as the main entrypoint. This is probably the most common way for users to touch qc.matrix. Most users will never use anything else.
    2. also add from_sparse and from_dense entrypoints based on the csc_to_split function.
  2. A algorithm developer facing API:
    1. The matvec, transpose_matvec, sandwich and standardize methods of SplitMatrix and StandardizedMatrix. These are the features used by quantcore.glm.
    2. DenseMatrix, SparseMatrix, CategoricalMatrix should not be used directly.
    3. Instead, they will be wrapped in a SplitMatrix by the from_pandas, from_sparse, and from_dense entrypoints and then standardized into a StandardizedMatrix by standardize. This minimizes the API and means that the three base matrix types can be entirely private to the package. It also means that StandardizedMatrix needs to only handle a SplitMatrix as its underlying unstandardized component.

Overall the goal here is to minimize the API surface area to a total of three free functions, two classes and four methods on those classes. Behavior would be consistent and clear. I want to provide a small number of operations that are each very powerful. Deep systems with a small surface area are useful, easy to understand and easy to maintain.

If the above proposal has everyone's support, then a lot of our current issues are actually no longer needed:

  • #101: I'd vote that we explicitly not support getitem.
  • #105 -- see above! "should we define __matmul__ for all the classes? Should we define the more basic __mul__ and __rmul__?" --> I would say "no and no". If we have only SplitMatrix as outward-facing API, then these methods will not exist and will naturally throw errors. That's great.
  • #104 -- No, we should not support those methods.

I think this will be a fairly quick modification/refactoring and will make the release process much less stressful.

Enable dropping one column from a CategoricalMatrix?

Currently, CategoricalMatrix does not provide an easy way to drop a column. We are required to include a category for every row in the dataset, but in an unregularized setting, it is nice to sometimes drop one column.

Something sort of like this is already implemented by the cols parameter to the matrix vector and sandwich functions.

Remove unused packages from environment.yml

We're not using pyarrow and possibly others. We are using sklearn and Pandas, but they are large dependencies we use minimally, so we might want to remove those dependencies.

Better names

DenseGLMDataMatrix -> DenseMatrix
MKLSparseMatrix -> SparseMatrix
StandardizedMat -> SplitScaledMatrix

Sparse sandwich fails when indices or indptr are double precision

To replicate:

In [1]: import numpy as np                                                         

In [2]: from scipy import sparse as sps                                            

In [3]: import quantcore.matrix as mx                                              

In [4]: mat = mx.SparseMatrix(sps.diags(np.ones(4)).tocsc())                       

In [5]: mat.indices = mat.indices.astype(np.int64)                                 

In [6]: mat.sandwich(np.ones(4))                                                   
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-6-1faf5e410bbf> in <module>
----> 1 mat.sandwich(np.ones(4))

~/Documents/quantco/quantcore.matrix/src/quantcore/matrix/sparse_matrix.py in sandwich(self, d, rows, cols)
     45 
     46         rows, cols = setup_restrictions(self.shape, rows, cols)
---> 47         return sparse_sandwich(self, self.x_csr, d, rows, cols)
     48 
     49     def cross_sandwich(

src/quantcore/matrix/ext/sparse.pyx in quantcore.matrix.ext.sparse.sparse_sandwich()

ValueError: Buffer dtype mismatch, expected 'int' but got 'long'

In [7]: mat = mx.SparseMatrix(sps.diags(np.ones(4)).tocsc())                       

In [8]: mat.indptr = mat.indptr.astype(np.int64)                                   

In [9]: mat.sandwich(np.ones(4))                                                   
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-1faf5e410bbf> in <module>
----> 1 mat.sandwich(np.ones(4))

~/Documents/quantco/quantcore.matrix/src/quantcore/matrix/sparse_matrix.py in sandwich(self, d, rows, cols)
     45 
     46         rows, cols = setup_restrictions(self.shape, rows, cols)
---> 47         return sparse_sandwich(self, self.x_csr, d, rows, cols)
     48 
     49     def cross_sandwich(

src/quantcore/matrix/ext/sparse.pyx in quantcore.matrix.ext.sparse.sparse_sandwich()

ValueError: Buffer dtype mismatch, expected 'int' but got 'long'

Should we return MatrixBase more often?

There are operations currently that return non-MatrixBase results. Is there a good reason to do this if the result does not become a scalar?

For instance, CategoricalMatrix * DenseMatrix -> scipy.sparse.csr_matrix instead of a SparseMatrix. Another one is indexing on SparseMatrix, which return a np.matrix type.

Rename "dot" to "matvec"

Out "dot" function supports matrix-vector multiplication for every subclass, but only supports matrix-matrix multiplication for some. It might be a good idea to call it "matvec", in line with other libraries:

DenseMatrix currently inherits its dot method from numpy, so we would need to add a method for that class.

Improve efficiency of `__getitem__`

Currently, our approach for some of the __getitem__ methods is inefficient. For example, column subsetting for CategoricalMatrix converts the full matrix to a csc_matrix.

Here's a list to update with potential improvements:

  • DenseMatrix: nothing to do. Already optimized with np.ndarray
  • SparseMatrix: nothing to do. Already optimized with sps.csc_matrix
  • CategoricalMatrix:
    • row: nothing to do, trivial
    • column: create a SparseMatrix with only the subset of columns/rows selected
  • SplitMatrix:
    • Test thoroughly all the potential ways to index
  • StandardizedMatrix
    • Not sure if columns subset with only one row works
  • Write docstrings for expected behavior
  • Write tests covering all expected behavior

`_split_col_subsets` ignores columns when non-monotonic

Maybe this is not the right function for what I am looking for. I expected this function to be perfect for the __getitem__ column subsetting but it's not working if the columns are not monotonic. PR #91 depends on fixing this issue.

Minimal working example:

import quantcore.matrix as mx
import numpy as np

a = mx.DenseMatrix(np.arange(16, dtype=float).reshape(4, 4))
sm = mx.SplitMatrix(matrices=[a])

sm._split_col_subsets([0, 2, 3])
# Correct - Out[6]: ([array([0, 1, 2], dtype=int32)], [array([0, 2, 3], dtype=int32)], 3)

ms._split_col_subsets([0, 3, 2])
# Incorrect - Out[9]: ([array([0, 1], dtype=int32)], [array([0, 3], dtype=int32)], 3)
# Expected: ([array([0, 1, 2], dtype=int32)], [array([0, 3, 2], dtype=int32)], 3)

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.