Skip to content

Commit

Permalink
refac: update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bassoy committed Oct 27, 2024
1 parent 90f3675 commit 494bc97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ High-Performance Tensor-Matrix Multiplication Library - TLIB(TTM)
[![Language](https://img.shields.io/badge/C%2B%2B-17-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization)
[![License](https://img.shields.io/badge/license-GPL-blue.svg)](https://github.com/bassoy/ttm/blob/master/LICENSE)
[![Wiki](https://img.shields.io/badge/ttm-wiki-blue.svg)](https://github.com/bassoy/ttm/wiki)
[![Gitter](https://img.shields.io/badge/ttm-chat%20on%20gitter-4eb899.svg)](https://gitter.im/bassoy)
[![Discussions](https://img.shields.io/badge/ttm-discussions-blue.svg)](https://github.com/bassoy/ttm/discussions)
[![Build Status](https://github.com/bassoy/ttm/actions/workflows/test.yml/badge.svg)](https://github.com/bassoy/ttm/actions)

## Summary
**TLIB(TTM)** is C++ high-performance tensor-matrix multiplication **header-only library**.
It provides free C++ functions for parallel computing the **mode-`q` tensor-times-matrix product** of the general form

$$
\underline{\mathbf{C}} = \underline{\mathbf{A}} \bullet_q \mathbf{B} \quad :\Leftrightarrow \quad
\underline{\mathbf{C}} = \underline{\mathbf{A}} \times_q \mathbf{B} \quad :\Leftrightarrow \quad
\underline{\mathbf{C}} (i_1, \dots, i_{q-1}, j, i_{q+1}, \dots, i_p) = \sum_{i_q=1}^{n_q} \underline{\mathbf{A}}({i_1, \dots, i_q, \dots, i_p}) \cdot \mathbf{B}({j,i_q}).
$$

Expand All @@ -37,8 +37,8 @@ Please have a look at the [wiki](https://github.com/bassoy/ttm/wiki) page for mo
* For large tensors reaches peak matrix-times-matrix performance

### Requirements
* Requires the tensor elements to be contiguously stored in memory.
* Element types must be either `float` or `double`.
* Requires the tensor elements to be contiguously stored in memory
* Element types must be either `float` or `double`

## Python Example
```python
Expand Down
10 changes: 5 additions & 5 deletions include/tlib/detail/layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ inline void compute_last_order_layout(OutputIt begin, OutputIt end)
template<class InputIt, class SizeType>
inline auto inverse_mode(InputIt layout_begin, InputIt layout_end, SizeType mode )
{
using value_type = typename std::iterator_traits<InputIt>::value_type;
using value_type = typename std::iterator_traits<InputIt>::value_type;
if(!is_valid_layout(layout_begin,layout_end))
throw std::runtime_error("Error in tlib::detail::inverse_mode(): input layout is not valid.");

Expand All @@ -130,13 +130,13 @@ inline auto inverse_mode(InputIt layout_begin, InputIt layout_end, SizeType mode

auto const p = static_cast<value_type>(p_);

if(mode==0u || mode > SizeType(p))
throw std::runtime_error("Error in tlib::detail::inverse_mode(): mode should be one-based and equal to or less than layout size.");
if(mode==0u || mode > SizeType(p))
throw std::runtime_error("Error in tlib::detail::inverse_mode(): mode should be one-based and equal to or less than layout size.");

auto inverse_mode = value_type{0u};
for(; inverse_mode < p; ++inverse_mode)
if(layout_begin[inverse_mode] == value_type(mode))
break;
if(layout_begin[inverse_mode] == value_type(mode))
break;

assert(inverse_mode < p);

Expand Down

0 comments on commit 494bc97

Please sign in to comment.