SyTen

◆ operator[]() [2/4]

template<Rank rank, typename Scalar = CDef>
Scalar const& syten::SparseTensor< rank, Scalar >::operator[] ( Coord const &  coordinates) const
inline

Returns a const reference to the element at the specified coordinate or zero.

Use this if you have a const SparseTensor and hence can ensure that no values are written to it, as references are much cheaper than copying the relatively large scalar values stored here.

References syten::SparseTensor< rank, Scalar >::FullData::dims, syten::SparseTensor< rank, Scalar >::FullData::elements, syten::SparseTensor< rank, Scalar >::fullData, syten::rank(), syten::SparseTensor< rank, Scalar >::singleton, syten::SparseTensor< rank, Scalar >::singletonValue, SYTEN_ASSERT_DEBUG, and syten::SparseTensor< rank, Scalar >::zero.

+ Here is the call graph for this function: