Skip to content

Commit

Permalink
Add module/crate level docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kngwyu committed Aug 22, 2018
1 parent 4daf35c commit cb16390
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/convert.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Defines conversion trait between rust types and numpy data types.
use ndarray::*;
use pyo3::Python;

Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Define Errors
//! Defines error types.
use pyo3::*;
use std::error;
Expand Down
32 changes: 32 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
//! `rust-numpy` provides Rust interfaces for [numpy](http://www.numpy.org/) APIs,
//! especially [ndarray](https://www.numpy.org/devdocs/reference/arrays.ndarray.html) class.
//!
//! It uses [pyo3](https://github.com/PyO3/pyo3) for rust bindings to cpython, and uses
//! [ndarray](https://github.com/bluss/ndarray) for rust side matrix library.
//!
//! For numpy dependency, it calls `import numpy.core` internally so you just need numpy
//! installed by `pip install numpy` or other ways in your python environment.
//! You can use both system environment and `virtualenv`.
//!
//! # Example
//!
//! ```
//! #[macro_use]
//! extern crate ndarray;
//! extern crate numpy;
//! #[macro_use]
//! extern crate pyo3;
//! use pyo3::prelude::*;
//! use numpy::*;
//! fn main() {
//! let gil = Python::acquire_gil();
//! let py = gil.python();
//! let np = PyArrayModule::import(py).unwrap();
//! let py_array = array![[1i64, 2], [3, 4]].into_pyarray(py, &np);
//! assert_eq!(
//! py_array.as_array().unwrap(),
//! array![[1i64, 2], [3, 4]].into_dyn(),
//! );
//! }
//! ```
#![feature(specialization)]

#[macro_use]
Expand Down
2 changes: 2 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Implements conversion utitlities.
pub use num_complex::Complex32 as c32;
pub use num_complex::Complex64 as c64;

Expand Down

0 comments on commit cb16390

Please sign in to comment.