mirror of
https://github.com/ArashPartow/exprtk.git
synced 2025-07-08 03:09:03 +00:00
C++ Mathematical Expression Library (ExprTk) https://www.partow.net/programming/exprtk/index.html
This commit is contained in:
committed by
Arash Partow
parent
f46bffcd69
commit
cc1b800c2b
@ -3,7 +3,7 @@
|
||||
* C++ Mathematical Expression Toolkit Library *
|
||||
* *
|
||||
* Simple Example 13 *
|
||||
* Author: Arash Partow (1999-2023) *
|
||||
* Author: Arash Partow (1999-2024) *
|
||||
* URL: https://www.partow.net/programming/exprtk/index.html *
|
||||
* *
|
||||
* Copyright notice: *
|
||||
@ -11,6 +11,7 @@
|
||||
* permitted under the guidelines and in accordance with the *
|
||||
* most current version of the MIT License. *
|
||||
* https://www.opensource.org/licenses/MIT *
|
||||
* SPDX-License-Identifier: MIT *
|
||||
* *
|
||||
**************************************************************
|
||||
*/
|
||||
@ -32,30 +33,30 @@ void savitzky_golay_filter()
|
||||
typedef exprtk::parser<T> parser_t;
|
||||
|
||||
const std::string sgfilter_program =
|
||||
" var weight[9] := "
|
||||
" { "
|
||||
" -21, 14, 39, "
|
||||
" 54, 59, 54, "
|
||||
" 39, 14, -21 "
|
||||
" }; "
|
||||
" "
|
||||
" if (v_in[] >= weight[]) "
|
||||
" { "
|
||||
" var lower_bound := trunc(weight[] / 2); "
|
||||
" var upper_bound := v_in[] - lower_bound; "
|
||||
" "
|
||||
" v_out := 0; "
|
||||
" "
|
||||
" for (var i := lower_bound; i < upper_bound; i += 1) "
|
||||
" { "
|
||||
" for (var j := -lower_bound; j <= lower_bound; j += 1) "
|
||||
" { "
|
||||
" v_out[i] += weight[j + lower_bound] * v_in[i + j]; "
|
||||
" }; "
|
||||
" }; "
|
||||
" "
|
||||
" v_out /= sum(weight); "
|
||||
" } ";
|
||||
" var weight[9] := "
|
||||
" { "
|
||||
" -21, 14, 39, "
|
||||
" 54, 59, 54, "
|
||||
" 39, 14, -21 "
|
||||
" }; "
|
||||
" "
|
||||
" if (v_in[] >= weight[]) "
|
||||
" { "
|
||||
" const var lower_bound := trunc(weight[] / 2); "
|
||||
" const var upper_bound := v_in[] - lower_bound; "
|
||||
" "
|
||||
" v_out := 0; "
|
||||
" "
|
||||
" for (var i := lower_bound; i < upper_bound; i += 1) "
|
||||
" { "
|
||||
" for (var j := -lower_bound; j <= lower_bound; j += 1) "
|
||||
" { "
|
||||
" v_out[i] += weight[j + lower_bound] * v_in[i + j]; "
|
||||
" }; "
|
||||
" }; "
|
||||
" "
|
||||
" v_out /= sum(weight); "
|
||||
" } ";
|
||||
|
||||
const std::size_t n = 1024;
|
||||
|
||||
|
Reference in New Issue
Block a user