| | #region Translated by Jose Antonio De Santiago-Castillo.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | #endregion
|
| |
|
| | using System;
|
| | using DotNumerics.FortranLibrary;
|
| |
|
| | namespace DotNumerics.Optimization.LBFGSB
|
| | {
|
| | public class DDOT
|
| | {
|
| |
|
| | public DDOT()
|
| | {
|
| |
|
| | }
|
| |
|
| | public double Run(int N, double[] DX, int offset_dx, int INCX, double[] DY, int offset_dy, int INCY)
|
| | {
|
| | double ddot = 0;
|
| |
|
| | #region Variables
|
| |
|
| | double DTEMP = 0; int I = 0; int IX = 0; int IY = 0; int M = 0; int MP1 = 0;
|
| |
|
| | #endregion
|
| |
|
| |
|
| | #region Array Index Correction
|
| |
|
| | int o_dx = -1 + offset_dx; int o_dy = -1 + offset_dy;
|
| |
|
| | #endregion
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | #region Body
|
| |
|
| | ddot = 0.0E0;
|
| | DTEMP = 0.0E0;
|
| | if (N <= 0) return ddot;
|
| | if (INCX == 1 && INCY == 1) goto LABEL20;
|
| |
|
| |
|
| |
|
| |
|
| | IX = 1;
|
| | IY = 1;
|
| | if (INCX < 0) IX = ( - N + 1) * INCX + 1;
|
| | if (INCY < 0) IY = ( - N + 1) * INCY + 1;
|
| | for (I = 1; I <= N; I++)
|
| | {
|
| | DTEMP += DX[IX + o_dx] * DY[IY + o_dy];
|
| | IX += INCX;
|
| | IY += INCY;
|
| | }
|
| | ddot = DTEMP;
|
| | return ddot;
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| | LABEL20: M = FortranLib.Mod(N,5);
|
| | if (M == 0) goto LABEL40;
|
| | for (I = 1; I <= M; I++)
|
| | {
|
| | DTEMP += DX[I + o_dx] * DY[I + o_dy];
|
| | }
|
| | if (N < 5) goto LABEL60;
|
| | LABEL40: MP1 = M + 1;
|
| | for (I = MP1; I <= N; I += 5)
|
| | {
|
| | DTEMP += DX[I + o_dx] * DY[I + o_dy] + DX[I + 1 + o_dx] * DY[I + 1 + o_dy] + DX[I + 2 + o_dx] * DY[I + 2 + o_dy] + DX[I + 3 + o_dx] * DY[I + 3 + o_dy] + DX[I + 4 + o_dx] * DY[I + 4 + o_dy];
|
| | }
|
| | LABEL60: ddot = DTEMP;
|
| | return ddot;
|
| |
|
| | #endregion
|
| |
|
| | }
|
| | }
|
| |
|
| |
|
| | }
|
| |
|