matten 0.1.0

A family car multidimensional array (tensor) library for small numerical trials / PoCs.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Integration smoke tests: exercise the public crate surface as a user would.

use matten::{MattenError, Tensor};

#[test]
fn public_construction_and_inspection() {
    let t = Tensor::new(vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0], &[2, 3]);
    assert_eq!(t.shape(), &[2, 3]);
    assert_eq!(t.len(), 6);
    assert_eq!(t.ndim(), 2);
}

#[test]
fn boundary_construction_is_recoverable() {
    let result = Tensor::try_new(vec![1.0, 2.0], &[3]);
    assert!(matches!(result, Err(MattenError::Shape { .. })));
}