A matrix that uses Fortran storage order.
| 169 | |
| 170 | // A matrix that uses Fortran storage order. |
| 171 | class FortranMatrix : public Matrix { |
| 172 | public: |
| 173 | FortranMatrix(py::ssize_t rows, py::ssize_t cols) : Matrix(cols, rows) { |
| 174 | print_created(this, |
| 175 | std::to_string(rows) + "x" + std::to_string(cols) + " Fortran matrix"); |
| 176 | } |
| 177 | |
| 178 | float operator()(py::ssize_t i, py::ssize_t j) const { return Matrix::operator()(j, i); } |
| 179 | |
| 180 | float &operator()(py::ssize_t i, py::ssize_t j) { return Matrix::operator()(j, i); } |
| 181 | |
| 182 | using Matrix::data; |
| 183 | |
| 184 | py::ssize_t rows() const { return Matrix::cols(); } |
| 185 | py::ssize_t cols() const { return Matrix::rows(); } |
| 186 | }; |
| 187 | py::class_<FortranMatrix, Matrix>(m, "FortranMatrix", py::buffer_protocol()) |
| 188 | .def(py::init<py::ssize_t, py::ssize_t>()) |
| 189 |
nothing calls this directly
no test coverage detected