| | #region Translated by Jose Antonio De Santiago-Castillo.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | #endregion
|
| |
|
| | using System;
|
| | using DotNumerics.FortranLibrary;
|
| |
|
| | namespace DotNumerics.Optimization.LBFGSB
|
| | {
|
| | public class MATUPD
|
| | {
|
| |
|
| |
|
| | #region Dependencies
|
| |
|
| | DCOPY _dcopy; DDOT _ddot;
|
| |
|
| | #endregion
|
| |
|
| |
|
| | #region Variables
|
| |
|
| | const double ONE = 1.0E0;
|
| |
|
| | #endregion
|
| |
|
| | public MATUPD(DCOPY dcopy, DDOT ddot)
|
| | {
|
| |
|
| |
|
| | #region Set Dependencies
|
| |
|
| | this._dcopy = dcopy; this._ddot = ddot;
|
| |
|
| | #endregion
|
| |
|
| | }
|
| |
|
| | public MATUPD()
|
| | {
|
| |
|
| |
|
| | #region Dependencies (Initialization)
|
| |
|
| | DCOPY dcopy = new DCOPY();
|
| | DDOT ddot = new DDOT();
|
| |
|
| | #endregion
|
| |
|
| |
|
| | #region Set Dependencies
|
| |
|
| | this._dcopy = dcopy; this._ddot = ddot;
|
| |
|
| | #endregion
|
| |
|
| | }
|
| | public void Run(int N, int M, ref double[] WS, int offset_ws, ref double[] WY, int offset_wy, ref double[] SY, int offset_sy, ref double[] SS, int offset_ss
|
| | , double[] D, int offset_d, double[] R, int offset_r, ref int ITAIL, int IUPDAT, ref int COL, ref int HEAD
|
| | , ref double THETA, double RR, double DR, double STP, double DTD)
|
| | {
|
| |
|
| | #region Variables
|
| |
|
| | int J = 0; int POINTR = 0; double DDOT = 0;
|
| |
|
| | #endregion
|
| |
|
| |
|
| | #region Implicit Variables
|
| |
|
| | int SS_COL = 0;
|
| |
|
| | #endregion
|
| |
|
| |
|
| | #region Array Index Correction
|
| |
|
| | int o_ws = -1 - N + offset_ws; int o_wy = -1 - N + offset_wy; int o_sy = -1 - M + offset_sy;
|
| | int o_ss = -1 - M + offset_ss; int o_d = -1 + offset_d; int o_r = -1 + offset_r;
|
| |
|
| | #endregion
|
| |
|
| |
|
| | #region Prolog
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | #endregion
|
| |
|
| |
|
| | #region Body
|
| |
|
| | if (IUPDAT <= M)
|
| | {
|
| | COL = IUPDAT;
|
| | ITAIL = FortranLib.Mod(HEAD + IUPDAT - 2,M) + 1;
|
| | }
|
| | else
|
| | {
|
| | ITAIL = FortranLib.Mod(ITAIL,M) + 1;
|
| | HEAD = FortranLib.Mod(HEAD,M) + 1;
|
| | }
|
| |
|
| |
|
| |
|
| | this._dcopy.Run(N, D, offset_d, 1, ref WS, 1+ITAIL * N + o_ws, 1);
|
| | this._dcopy.Run(N, R, offset_r, 1, ref WY, 1+ITAIL * N + o_wy, 1);
|
| |
|
| |
|
| |
|
| | THETA = RR / DR;
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | if (IUPDAT > M)
|
| | {
|
| |
|
| | for (J = 1; J <= COL - 1; J++)
|
| | {
|
| | this._dcopy.Run(J, SS, 2+(J + 1) * M + o_ss, 1, ref SS, 1+J * M + o_ss, 1);
|
| | this._dcopy.Run(COL - J, SY, J + 1+(J + 1) * M + o_sy, 1, ref SY, J+J * M + o_sy, 1);
|
| | }
|
| | }
|
| |
|
| |
|
| | POINTR = HEAD;
|
| | SS_COL = COL * M + o_ss;
|
| | for (J = 1; J <= COL - 1; J++)
|
| | {
|
| | SY[COL+J * M + o_sy] = this._ddot.Run(N, D, offset_d, 1, WY, 1+POINTR * N + o_wy, 1);
|
| | SS[J + SS_COL] = this._ddot.Run(N, WS, 1+POINTR * N + o_ws, 1, D, offset_d, 1);
|
| | POINTR = FortranLib.Mod(POINTR,M) + 1;
|
| | }
|
| | if (STP == ONE)
|
| | {
|
| | SS[COL+COL * M + o_ss] = DTD;
|
| | }
|
| | else
|
| | {
|
| | SS[COL+COL * M + o_ss] = STP * STP * DTD;
|
| | }
|
| | SY[COL+COL * M + o_sy] = DR;
|
| |
|
| | return;
|
| |
|
| |
|
| | #endregion
|
| |
|
| | }
|
| | }
|
| |
|
| |
|
| | }
|
| |
|