関数ML_x2y_givenMemories マニュアル

(The documentation of function ML_x2y_givenMemories)


Last Update: 2025/8/7


◆機能・用途(Purpose)

1つの層での変数\(X_i^{(m)}\)の値を与えて その線形結合\(Y_j^{(m)}\)の値を計算する。 特定の1つの\(m\)において、全ての\(j\)について計算を行う。 関数ML_x2yと異なり、この関数では\(Y_j^{(m)}\)用の動的メモリを 事前に確保しておく必要がある。
Calculate the values of linear combinations \(Y_j^{(m)}\) given the values of variables \(X_i^{(m)}\) in a layer. The calculation is conducted for a single \(m\) and for all \(j\). Different from the function ML_x2y, this function requires the dynamic memory for \(Y_j^{(m)}\) to be allocated in advance to the function call.


◆形式(Format)

#include <machine_learning/cross_entropy.h>
inline void ML_x2y_givenMemories
(const int J,const int Jnext,const double ∗X, double ∗const ∗W,double ∗Y)


◆引数(Arguments)

J 現在の層における変数の数\(J^{(m)}\)。
The number of variables \(J^{(m)}\) in the current layer.
Jnext 次の層における変数の数\(J^{(m+1)}\)。
The number of variables \(J^{(m+1)}\) in the next layer.
X 現在の層における変数の値のリストX[i]\(=X_i^{(m)}\)。 要素数\(J^{(m)}\)の配列として与える。
List of values of variables X[i]\(=X_i^{(m)}\) in the current layer, given as an array of \(J^{(m)}\) components.
W 線形結合の係数W[j][i]\(=W_{j,i}^{(m)}\)。 \(J^{(m+1)}\times [J^{(m)}+1]\) の2次元配列として与える。
The coefficients W[j][i]\(=W_{j,i}^{(m)}\) of the linear combination, given as a 2D array of \(J^{(m+1)}\times [J^{(m)}+1]\) components.
Y 計算した線形結合\(Y_j^{(m)}\)の値のリストの代入先。 関数呼び出し前に要素数\(J^{(m+1)}\)の配列として 動的メモリを確保しておくこと。 関数内でY[j]\(=Y_j^{(m)}\)となるように値が設定される。 ここで\(m\)は処理対象とする層番号。
Memory into which the list of the values of linear combinations \(Y_j^{(m)}\) will be inserted. Allocate a dynamic memory in advance to the function call to make this variable an array of \(J^{(m+1)}\) components. Within the function the array values are set as Y[j]\(=Y_j^{(m)}\), where \(m\) is the target layer.


◆使用例(Example)

int J=5;
int Jnext=3;
double X[]={1.2,3.4,5.6,7.8,9.0};
double W[][J]
  ={{1.1,2.2,3.3,4.4,5.5,6.6},
     {-2.3,-3.4,-4.5,-5.6,-6.7,-7.8},
     {4.2,5.3,6.4,7.5,8.6,9.7}};
double Y[Jnext];
ML_x2y_givenMemories(J,Jnext,X,W,Y);


◆計算式(Formula)

計算式2 の(2)式が用いられる。
Eq. (2) of Formulas 2 are used.