関数sequence_weighted_sum マニュアル

(The documentation of function sequence_weighted_sum)

Last Update: 2025/7/23


◆機能・用途(Purpose)

複数の時系列データの重み付け和を計算する。
Compute the weighted summation of multiple time series data.

入力時系列データの個数を\(N\)、 それらの時系列データを\(f_n(t)\) (\(n=0,1,\cdots,N-1\))として、この関数では \[\begin{equation} \sum_{n=0}^{N-1} w_n f_n(t) \label{eq.weighted_sum} \end{equation}\] を計算する。ここで\(w_n\)はユーザが指定する重み係数である。
This function computes Eq. (\ref{eq.weighted_sum}), where \(N\) is the number of input time series data, \(f_n(t)\) (\(n=0,1,\cdots,N-1\)) are individual time series data, and \(w_n\) are weights specified by the user.


◆形式(Format)

#include <sequence/operation.h>
inline struct sequence sequence_weighted_sum(const int N,...)


◆引数(Arguments)

N 時系列データの個数。
The number of time series data.
... 重み係数\(w_n\)と入力時系列データ\(f_n(t)\)を \(w_0\), \(f_0(t)\), \(w_1\), \(f_1(t)\), …の順に並べたリスト。
A list of weights \(w_n\) and input time series data \(f_n(t)\) in order \(w_0\), \(f_0(t)\), \(w_1\), \(f_1(t)\), ….


◆戻り値(Return value)

(\ref{eq.weighted_sum})式の時系列データを表す構造体。
A structure that represents the time series data defined by Eq. (\ref{eq.weighted_sum}).


◆使用例(Example)

struct sequence a,b,c,d;
struct sequence e=sequence_weighted_sum(4,1.0,a,2.0,b,3.0,c,4.0,d);

この例では\(e=a+2b+3c+4d\)となる。
This example gives \(e=a+2b+3c+4d\).