Skip to content

Commit

Permalink
Renamed nb::tensor to nb::ndarray to reflect Nanobind API changes (fixes
Browse files Browse the repository at this point in the history
 #27 & closes #28)
  • Loading branch information
bathal1 committed Aug 22, 2023
1 parent 9089f2d commit acb3342
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.18...3.22)

project(cholespy LANGUAGES CXX C VERSION "0.1.6")
project(cholespy LANGUAGES CXX C VERSION "1.0.0")

# Nanobind setup from https://github.com/wjakob/nanobind_example/blob/master/CMakeLists.txt
if (NOT SKBUILD)
Expand Down
Binary file added dist/cholespy-0.1.6-cp310-cp310-linux_x86_64.whl
Binary file not shown.
Binary file added dist/cholespy-0.2.0-cp310-cp310-linux_x86_64.whl
Binary file not shown.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = [
"wheel",
"scikit-build==0.14.0",
"cmake>=3.18",
"nanobind>=0.0.7",
"nanobind>=1.0.0",
"ninja; platform_system!='Windows'"
]

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setup(
name="cholespy",
version="0.1.6",
version="1.0.0",
description="A self-contained sparse Cholesky solver, compatible with CPU and GPU tensor frameworks.",
author="Baptiste Nicolet",
license="BSD",
Expand Down
12 changes: 6 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "cholesky_solver.h"
#include "docstr.h"
#include <nanobind/nanobind.h>
#include <nanobind/tensor.h>
#include <nanobind/ndarray.h>

#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
Expand All @@ -20,9 +20,9 @@ void declare_cholesky(nb::module_ &m, const std::string &typestr, const char *do
nb::class_<Class>(m, class_name.c_str(), docstr)
.def("__init__", [](Class *self,
uint32_t n_rows,
nb::tensor<int32_t, nb::shape<nb::any>, nb::c_contig> ii,
nb::tensor<int32_t, nb::shape<nb::any>, nb::c_contig> jj,
nb::tensor<double, nb::shape<nb::any>, nb::c_contig> x,
nb::ndarray<int32_t, nb::shape<nb::any>, nb::c_contig> ii,
nb::ndarray<int32_t, nb::shape<nb::any>, nb::c_contig> jj,
nb::ndarray<double, nb::shape<nb::any>, nb::c_contig> x,
MatrixType type) {

if (type == MatrixType::COO){
Expand Down Expand Up @@ -78,8 +78,8 @@ void declare_cholesky(nb::module_ &m, const std::string &typestr, const char *do
nb::arg("type"),
doc_constructor)
.def("solve", [](Class &self,
nb::tensor<Float, nb::c_contig> b,
nb::tensor<Float, nb::c_contig> x){
nb::ndarray<Float, nb::c_contig> b,
nb::ndarray<Float, nb::c_contig> x){
if (b.ndim() != 1 && b.ndim() != 2)
throw std::invalid_argument("Expected 1D or 2D tensors as input.");
if (b.shape(0) != x.shape(0) || (b.ndim() == 2 && b.shape(1) != x.shape(1)))
Expand Down

0 comments on commit acb3342

Please sign in to comment.