spenso 0.5.5

A tensor (n-dim array) network, iterating, and contraction (using automatic abstract index matching) library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::ops::SubAssign;

use crate::{structure::TensorStructure, tensors::data::DenseTensor};

impl<T, U, I> SubAssign<DenseTensor<T, I>> for DenseTensor<U, I>
where
    U: for<'a> SubAssign<&'a T>,
    I: TensorStructure + Clone,
{
    fn sub_assign(&mut self, rhs: DenseTensor<T, I>) {
        for (u, t) in self.data.iter_mut().zip(rhs.data.iter()) {
            *u -= t;
        }
    }
}