Skip to content

Commit c94ca73

Browse files
author
Baptiste Nicolet
committed
Renamed nb::tensor to nb::ndarray to reflect Nanobind API changes (fixes #27 & #28)
1 parent 9089f2d commit c94ca73

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.18...3.22)
22

3-
project(cholespy LANGUAGES CXX C VERSION "0.1.6")
3+
project(cholespy LANGUAGES CXX C VERSION "1.0.0")
44

55
# Nanobind setup from https://github.com/wjakob/nanobind_example/blob/master/CMakeLists.txt
66
if (NOT SKBUILD)
1.12 MB
Binary file not shown.
1.12 MB
Binary file not shown.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ requires = [
44
"wheel",
55
"scikit-build==0.14.0",
66
"cmake>=3.18",
7-
"nanobind>=0.0.7",
7+
"nanobind>=1.0.0",
88
"ninja; platform_system!='Windows'"
99
]
1010

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
setup(
2121
name="cholespy",
22-
version="0.1.6",
22+
version="1.0.0",
2323
description="A self-contained sparse Cholesky solver, compatible with CPU and GPU tensor frameworks.",
2424
author="Baptiste Nicolet",
2525
license="BSD",

src/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "cholesky_solver.h"
22
#include "docstr.h"
33
#include <nanobind/nanobind.h>
4-
#include <nanobind/tensor.h>
4+
#include <nanobind/ndarray.h>
55

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

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

0 commit comments

Comments
 (0)