Menu

#657 Create a filter function for matop

v1.1.x
closed
v1.1.5
New Functionality
2023-03-01
2022-02-06
Erik Hänel
No

Create a filter function for matop mode, where the user may supply his data and a custom filter kernel. The user may also select between the boundary modes boundary_reflect = 1 and boundary_clamp = 0 using the VectorIndex functionalities. The function can be named as filter(MAT,KERNEL,MODE) -> MAT and shall support parallel computation.

Analysis:

This requries creating a new function signature MATSIG_MAT_MAT_N in "kernel/core/maths/matdatastructures.hpp" and implementing the handling code in this statement switch (fIter->second.signature) in Matrix evalMatOp(...). Combine MATSIG_MAT_MAT with MATSIG_MAT_N_MOPT to achieve this.

The function itself shall use the second matrix KERNEL as convolution kernel, so that the user may supply a custom filter kernel. To implement the convolution, follow the moving average approach in movavg() (found in Matrix matrixMovAvg(...)) and use the #pragma omp parallel fordirective after the implementation is running correctly.

To handle the boundary conditions, using a VectorIndex might be reasonable, esp. because of its prepending and appending features. Have a look into bool Memory::smooth(...) (search for _vLine.prepend() in "kernel/core/datamanagement/memory.cpp" to get an impression on how this can be done.

Implementation:

  • Implementation: Implemented as described above. A static helper function performs the actual calculation.
  • Revision: [r1237]
  • Implementation test: Tested the errors for unfit kernel sizes and even kernel dimensions. Tested application of a 3x3 kernel over matrices of various sizes. Tested the function by implementing a rudimentary line detection.

Documentation:

  • [x] ChangesLog updated
  • [x] Code changes commented
  • Documentation articles:
    • [ ] corresponding documentation articles updated
    • [x] new documentation articles created
    • [ ] not needed
  • Language files:
    • [x] corresponding language files updated
    • [ ] not needed

Tests:

The new functionality was added to the automatic SW test. Detected deviation was fixed in [r1347].

Related

Commit: [r1237]
Commit: [r1347]

Discussion

  • Erik Hänel

    Erik Hänel - 2022-08-12
    • Version: Planned --> v1.1.5
     
  • Erik Hänel

    Erik Hänel - 2022-09-21
    • labels: --> internal, function, matrix
    • status: open --> accepted
     
  • Erik Hänel

    Erik Hänel - 2022-09-21
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,23 @@
     Create a filter function for matop mode, where the user may supply his data and a custom filter kernel. The user may also select between the boundary modes `boundary_reflect = 1` and `boundary_clamp = 0` using the `VectorIndex` functionalities. The function can be named as `filter(MAT,KERNEL,MODE) -> MAT` and shall support parallel computation.
    +
    +###Analysis:
    +(*Describe, what's the issue and which changes have to be made*)
    +
    +###Implementation:
    +* Implementation: (*Describe, what you've changed*) 
    +* Revision: [rXXX]
    +* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +
    +###Documentation:
    +* [ ] ChangesLog updated
    +* [ ] Code changes commented
    +* **Documentation articles:**
    
    +    * [ ] corresponding documentation articles updated
    +    * [ ] new documentation articles created
    +    * [ ] not needed
    +* **Language files:**
    +    * [ ] corresponding language files updated
    +    * [ ] not needed
    +
    +###Tests:
    +(*Describe, which tests you performed and their outcome*)
    
    • status: accepted --> analyzing
     
  • Erik Hänel

    Erik Hänel - 2022-09-21
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,11 @@
     Create a filter function for matop mode, where the user may supply his data and a custom filter kernel. The user may also select between the boundary modes `boundary_reflect = 1` and `boundary_clamp = 0` using the `VectorIndex` functionalities. The function can be named as `filter(MAT,KERNEL,MODE) -> MAT` and shall support parallel computation.
    
     ###Analysis:
    -(*Describe, what's the issue and which changes have to be made*)
    +This requries creating a new function signature `MATSIG_MAT_MAT_N` in "kernel/core/maths/matdatastructures.hpp" and implementing the handling code in this statement `switch (fIter->second.signature)` in `Matrix evalMatOp(...)`. Combine `MATSIG_MAT_MAT` with `MATSIG_MAT_N_MOPT` to achieve this.
    +
    +The function itself shall use the second matrix `KERNEL` as convolution kernel, so that the user may supply a custom filter kernel. To implement the convolution, follow the moving average approach in `movavg()` (found in `Matrix matrixMovAvg(...)`) and use the `#pragma omp parallel for`directive after the implementation is running correctly.
    +
    +To handle the boundary conditions, using a `VectorIndex` might be reasonable, esp. because of its prepending and appending features. Have a look into `bool Memory::smooth(...)` (search for `_vLine.prepend(`) in "kernel/core/datamanagement/memory.cpp" to get an impression on how this can be done.
    
     ###Implementation:
    
     * Implementation: (*Describe, what you've changed*) 
    
    • status: analyzing --> implementing
    • assigned_to: Erik Hänel --> Raphael Zehner
     
  • Raphael Zehner

    Raphael Zehner - 2022-10-17
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -8,19 +8,19 @@
     To handle the boundary conditions, using a `VectorIndex` might be reasonable, esp. because of its prepending and appending features. Have a look into `bool Memory::smooth(...)` (search for `_vLine.prepend(`) in "kernel/core/datamanagement/memory.cpp" to get an impression on how this can be done.
    
     ###Implementation:
    -* Implementation: (*Describe, what you've changed*) 
    -* Revision: [rXXX]
    -* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +* Implementation: Implemented as described above. A static helper function performs the actual calculation.
    +* Revision: [r1237]
    +* Implementation test: Tested the errors for unfit kernel sizes and even kernel dimensions. Tested application of a 3x3 kernel over matrices of various sizes. Tested the function by implementing a rudimentary line detection.
    
     ###Documentation:
    -* [ ] ChangesLog updated
    -* [ ] Code changes commented
    +* [x] ChangesLog updated
    +* [x] Code changes commented
    
     * **Documentation articles:**
         * [ ] corresponding documentation articles updated
    -    * [ ] new documentation articles created
    +    * [x] new documentation articles created
         * [ ] not needed
     * **Language files:**
    -    * [ ] corresponding language files updated
    +    * [x] corresponding language files updated
         * [ ] not needed
    
     ###Tests:
    
    • status: implementing --> testing
    • assigned_to: Raphael Zehner --> Erik Hänel
     

    Related

    Commit: [r1237]

  • Erik Hänel

    Erik Hänel - 2023-03-01
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -24,4 +24,4 @@
    
         * [ ] not needed
    
     ###Tests:
    -(*Describe, which tests you performed and their outcome*)
    +The new functionality was added to the automatic SW test. Detected deviation was fixed in [r1347].
    
    • status: testing --> closed
     

    Related

    Commit: [r1347]

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB