Skip to content

Commit

Permalink
Improvements to dsppp doxygen documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe0606 committed Mar 6, 2024
1 parent 1bd68d7 commit a4e82f8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
10 changes: 10 additions & 0 deletions Documentation/Doxygen/src/guidelines.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# Guidelines {#dsppp_guidelines}

If you use dynamic objects in your algorithms and some temporaries need to be allocated, they'll generally be allocated through a `malloc` since the size is not known at build time. It can be an issue:

* Cost of the memory allocation
* Fragmentations

If you need to allocate those temporaries very often then it may be better to write the algorithm in such a way that the temporary can be reused between different calls.

The function implementing your algorithm would have additional arguments for the temporary matrixes and vectors required in the algorithm.

2 changes: 1 addition & 1 deletion Documentation/Doxygen/src/memory_allocator.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct Vector:Vector_Base<P>
It means that by default the memory allocator is `TMP_ALLOC`.
This `TMP_ALLOC` `#define` can be changed if you define it before including any header from the library.
This `TMP_ALLOC` is a `#define` and can be changed if you define it before including any header from the library.
An allocator should implement a template like:
Expand Down
10 changes: 5 additions & 5 deletions Documentation/Doxygen/src/memory_static_dynamic.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

As we have seen in the previous sections, there are two kind of vectors:

* `Vector<T>` with a dimension know at runtime
* `Vector<T>` with a dimension known at runtime
* `Vector<T,NB>` with a dimension known at build time

The former vectors are called "dynamic" ins this library. The later are called "static".
The former vectors are called "dynamic" in this library. The later are called "static".

This naming "static" / "dynamic" is referring to the dimension. With "dynamic" vectors the same code can, at runtime, create vectors of different length based on a runtime length.

With "static" vectors : the length is fixed at build time and will never change at runtime.

Note that the library also have "static" / "dynamic" matrixes. So, we are going to use "objects" to cover both cases
Note that the library also have "static" / "dynamic" matrixes. So, we are going to use the name "object" to cover both cases in the below explanations.

# Static objects

The advantage of static objects is that the dimension is known at build time. The compiler can thus generate an algorithm that is specialized for those dimensions and thus more efficient.

With static objects it is also possible to use different memory allocator with better performances and determinism.

But, with static objects, objects of different dimension are considered as different types. The compiler will generate different implementation so it will have an impact on the code dimension.
But, with static objects, objects of different dimension are considered as different types. The compiler will generate different implementation so it will have an impact on the code size.

If you need lots of objects of different dimensions, or if the dimensions are nort known at build time, then you need to use dynamic object
If you need lots of objects of different dimensions, or if the dimensions are not known at build time, then you need to use dynamic object

# Dynamic objects

Expand Down
3 changes: 2 additions & 1 deletion Documentation/Doxygen/src/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ The generic `arm_add` source code is a template used to generate different imple

And if the compiler is unable to generate an implementation because the type variable `T` is replaced by a type with no addition operator, then it would be detected by the compiler.

Note that in C++, you can also use overloading of functions. They'll use the same name (but different arguments) but they won't share the same source code.

## Templates for datatypes

C++ templates also apply to structs and classes.
Expand Down Expand Up @@ -57,4 +59,3 @@ A template is just a C++ header. You only need to include this header to start u

Now you can look at an @ref dsppp_vector_example "example with vector operations" showing how to use the library


2 changes: 1 addition & 1 deletion Documentation/Doxygen/src/vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Virtual vectors can have a stride:
d.sub<2>(1) = 0.0f;
```

This line sets the odd elements of the vector to `0.0f`. It is creating a vvirtual vector with stride `2` and starting at index `1` of first vector.
This line sets the odd elements of the vector to `0.0f`. It is creating a virtual vector with stride `2` and starting at index `1` of first vector.

Then, all elements of this virtual vector are set to `0.0f`.

Expand Down
6 changes: 3 additions & 3 deletions Documentation/Doxygen/src/vectorop.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ we need to:
The headers are not yet part of the CMSIS-DSP packs since they are experimental. You can get them from the [CMSIS-DSP github](https://github.com/ARM-software/CMSIS-DSP/tree/main/dsppp/Include/dsppp)

```cpp
#include <memory_pool>
#include <matrix>
#include <dsppp/memory_pool>
#include <dsppp/matrix>

using namespace arm_cmsis_dsp;
```

If fixed point datatypes are required, `#include <fixed_point>` should be used before `<matrix>`
If fixed point datatypes are required, `#include <dsppp/fixed_point>` should be used before `<dsppp/matrix>`

Fixed point requires the use of CMSIS-DSP.

Expand Down

0 comments on commit a4e82f8

Please sign in to comment.