├── Atmosphere └── Include │ ├── AtmMetricViscosity.h │ ├── AtmMetricViscosity.inl │ ├── AtmosModel76Simple.h │ ├── AtmosModel76Simple.inl │ ├── AtmosphereLibDefs.h │ ├── AtmosphereModel76.h │ ├── AtmosphereModel76.inl │ ├── NRLMSISE00_CCOR.h │ ├── NRLMSISE00_CCOR.inl │ ├── NRLMSISE00_DENSITY.h │ ├── NRLMSISE00_DENSITY.inl │ ├── NRLMSISE00_GLATF.h │ ├── NRLMSISE00_GLATF.inl │ ├── NRLMSISE00_GLOBE7.h │ ├── NRLMSISE00_GLOBE7.inl │ ├── NRLMSISE00_GTD7.h │ ├── NRLMSISE00_GTD7.inl │ ├── NRLMSISE00_INOUT.h │ ├── NRLMSISE00_SCLAHDNET.h │ ├── NRLMSISE00_SCLAHDNET.inl │ ├── NRLMSISE00_SHARED.h │ ├── NRLMSISE00_SPLINE_INTEGRATORS.h │ └── NRLMSISE00_SPLINE_INTEGRATORS.inl ├── Docs ├── MIL-HDBK-1797.PDF ├── Wind_Forces_2.pdf └── wind simulation.pdf ├── External ├── CUBPACK │ ├── buckley.f90 │ ├── check.f90 │ ├── cui.f90 │ ├── divide.f90 │ ├── ds_routines.f90 │ ├── error_handling.f90 │ ├── global_all.f90 │ ├── internal_types.f90 │ ├── region_processor.f90 │ ├── rule_1.f90 │ ├── rule_c2.f90 │ ├── rule_c3.f90 │ ├── rule_cn.f90 │ ├── rule_general.f90 │ ├── rule_t2.f90 │ ├── rule_t3.f90 │ ├── rule_tn.f90 │ └── volume.f90 ├── FFTPACK │ ├── c1f2kb.f │ ├── c1f2kf.f │ ├── c1f3kb.f │ ├── c1f3kf.f │ ├── c1f4kb.f │ ├── c1f4kf.f │ ├── c1f5kb.f │ ├── c1f5kf.f │ ├── c1fgkb.f │ ├── c1fgkf.f │ ├── c1fm1b.f │ ├── c1fm1f.f │ ├── cfft1b.f │ ├── cfft1f.f │ ├── cfft1i.f │ ├── cfft2b.f │ ├── cfft2f.f │ ├── cfft2i.f │ ├── cfftmb.f │ ├── cfftmf.f │ ├── cfftmi.f │ ├── cmf2kb.f │ ├── cmf2kf.f │ ├── cmf3kb.f │ ├── cmf3kf.f │ ├── cmf4kb.f │ ├── cmf4kf.f │ ├── cmf5kb.f │ ├── cmf5kf.f │ ├── cmfgkb.f │ ├── cmfgkf.f │ ├── cmfm1b.f │ ├── cmfm1f.f │ ├── cosq1b.f │ ├── cosq1f.f │ ├── cosq1i.f │ ├── cosqb1.f │ ├── cosqf1.f │ ├── cosqmb.f │ ├── cosqmf.f │ ├── cosqmi.f │ ├── cost1b.f │ ├── cost1f.f │ ├── cost1i.f │ ├── costb1.f │ ├── costf1.f │ ├── costmb.f │ ├── costmf.f │ ├── costmi.f │ ├── factor.f │ ├── mcfti1.f │ ├── mcsqb1.f │ ├── mcsqf1.f │ ├── mcstb1.f │ ├── mcstf1.f │ ├── mradb2.f │ ├── mradb3.f │ ├── mradb4.f │ ├── mradb5.f │ ├── mradbg.f │ ├── mradf2.f │ ├── mradf3.f │ ├── mradf4.f │ ├── mradf5.f │ ├── mradfg.f │ ├── mrftb1.f │ ├── mrftf1.f │ ├── mrfti1.f │ ├── msntb1.f │ ├── msntf1.f │ ├── r1f2kb.f │ ├── r1f2kf.f │ ├── r1f3kb.f │ ├── r1f3kf.f │ ├── r1f4kb.f │ ├── r1f4kf.f │ ├── r1f5kb.f │ ├── r1f5kf.f │ ├── r1fgkb.f │ ├── r1fgkf.f │ ├── r2w.f │ ├── rfft1b.f │ ├── rfft1f.f │ ├── rfft1i.f │ ├── rfft2b.f │ ├── rfft2f.f │ ├── rfft2i.f │ ├── rfftb1.f │ ├── rfftf1.f │ ├── rffti1.f │ ├── rfftmb.f │ ├── rfftmf.f │ ├── rfftmi.f │ ├── sinq1b.f │ ├── sinq1f.f │ ├── sinq1i.f │ ├── sinqmb.f │ ├── sinqmf.f │ └── sinqmi.f ├── QUADPACK │ ├── dgtsl.f │ ├── dqag.f │ ├── dqage.f │ ├── dqagie.f │ ├── dqagp.f │ ├── dqagpe.f │ ├── dqags.f │ ├── dqagse.f │ ├── dqawc.f │ ├── dqawce.f │ ├── dqawf.f │ ├── dqawfe.f │ ├── dqawo.f │ ├── dqawoe.f │ ├── dqaws.f │ ├── dqawse.f │ ├── dqc25c.f │ ├── dqc25f.f │ ├── dqc25s.f │ ├── dqcheb.f │ ├── dqelg.f │ ├── dqk15.f │ ├── dqk15i.f │ ├── dqk15w.f │ ├── dqk21.f │ ├── dqk31.f │ ├── dqk41.f │ ├── dqk51.f │ ├── dqk61.f │ ├── dqmomo.f │ ├── dqng.f │ ├── dqpsrt.f │ ├── dqwgtc.f │ ├── dqwgtf.f │ ├── dqwgts.f │ ├── fdump.f │ ├── j4save.f │ ├── qag.f │ ├── qage.f │ ├── qagi.f │ ├── qagie.f │ ├── qagp.f │ ├── qagpe.f │ ├── qags.f │ ├── qagse.f │ ├── qawc.f │ ├── qawce.f │ ├── qawfe.f │ ├── qawo.f │ ├── qawoe.f │ ├── qaws.f │ ├── qawse.f │ ├── qc25c.f │ ├── qc25f.f │ ├── qc25s.f │ ├── qcheb.f │ ├── qelg.f │ ├── qk15.f │ ├── qk15i.f │ ├── qk15w.f │ ├── qk21.f │ ├── qk31.f │ ├── qk41.f │ ├── qk51.f │ ├── qk61.f │ ├── qmomo.f │ ├── qng.f │ ├── qpsrt.f │ ├── qwgtc.f │ ├── qwgtf.f │ ├── qwgts.f │ ├── readme.txt │ ├── s88fmt.f │ ├── sgtsl.f │ ├── xerabt.f │ ├── xerctl.f │ ├── xerprt.f │ ├── xerror.f │ ├── xerrwv.f │ ├── xersav.f │ └── xgetua.f ├── RKSUITE │ ├── details.doc │ ├── rksuite.doc │ └── rksuite.f └── SLICOT │ ├── AB01MD.f │ ├── AB01ND.f │ ├── AB01OD.f │ ├── AB04MD.f │ ├── AB05MD.f │ ├── AB05ND.f │ ├── AB05OD.f │ ├── AB05PD.f │ ├── AB05QD.f │ ├── AB05RD.f │ ├── AB05SD.f │ ├── AB07MD.f │ ├── AB07ND.f │ ├── AB08MD.f │ ├── AB08MZ.f │ ├── AB08ND.f │ ├── AB08NX.f │ ├── AB08NZ.f │ ├── AB09AD.f │ ├── AB09AX.f │ ├── AB09BD.f │ ├── AB09BX.f │ ├── AB09CD.f │ ├── AB09CX.f │ ├── AB09DD.f │ ├── AB09ED.f │ ├── AB09FD.f │ ├── AB09GD.f │ ├── AB09HD.f │ ├── AB09HX.f │ ├── AB09HY.f │ ├── AB09ID.f │ ├── AB09IX.f │ ├── AB09IY.f │ ├── AB09JD.f │ ├── AB09JV.f │ ├── AB09JW.f │ ├── AB09JX.f │ ├── AB09KD.f │ ├── AB09KX.f │ ├── AB09MD.f │ ├── AB09ND.f │ ├── AB13AD.f │ ├── AB13AX.f │ ├── AB13BD.f │ ├── AB13CD.f │ ├── AB13DD.f │ ├── AB13DX.f │ ├── AB13ED.f │ ├── AB13FD.f │ ├── AB13ID.f │ ├── AB13MD.f │ ├── AB8NXZ.f │ ├── AG07BD.f │ ├── AG08BD.f │ ├── AG08BY.f │ ├── AG08BZ.f │ ├── AG8BYZ.f │ ├── BB01AD.f │ ├── BB02AD.f │ ├── BB03AD.f │ ├── BB04AD.f │ ├── BD01AD.f │ ├── BD02AD.f │ ├── DE01OD.f │ ├── DE01PD.f │ ├── DF01MD.f │ ├── DG01MD.f │ ├── DG01ND.f │ ├── DG01NY.f │ ├── DG01OD.f │ ├── DK01MD.f │ ├── FB01QD.f │ ├── FB01RD.f │ ├── FB01SD.f │ ├── FB01TD.f │ ├── FB01VD.f │ ├── FD01AD.f │ ├── IB01AD.f │ ├── IB01BD.f │ ├── IB01CD.f │ ├── IB01MD.f │ ├── IB01MY.f │ ├── IB01ND.f │ ├── IB01OD.f │ ├── IB01OY.f │ ├── IB01PD.f │ ├── IB01PX.f │ ├── IB01PY.f │ ├── IB01QD.f │ ├── IB01RD.f │ ├── IB03AD.f │ ├── IB03BD.f │ ├── MA01AD.f │ ├── MA01BD.f │ ├── MA01BZ.f │ ├── MA01CD.f │ ├── MA02AD.f │ ├── MA02BD.f │ ├── MA02BZ.f │ ├── MA02CD.f │ ├── MA02CZ.f │ ├── MA02DD.f │ ├── MA02ED.f │ ├── MA02ES.f │ ├── MA02EZ.f │ ├── MA02FD.f │ ├── MA02GD.f │ ├── MA02GZ.f │ ├── MA02HD.f │ ├── MA02ID.f │ ├── MA02IZ.f │ ├── MA02JD.f │ ├── MA02JZ.f │ ├── MB01KD.f │ ├── MB01LD.f │ ├── MB01MD.f │ ├── MB01ND.f │ ├── MB01PD.f │ ├── MB01QD.f │ ├── MB01RD.f │ ├── MB01RU.f │ ├── MB01RW.f │ ├── MB01RX.f │ ├── MB01RY.f │ ├── MB01SD.f │ ├── MB01TD.f │ ├── MB01UD.f │ ├── MB01UW.f │ ├── MB01UX.f │ ├── MB01VD.f │ ├── MB01WD.f │ ├── MB01XD.f │ ├── MB01XY.f │ ├── MB01YD.f │ ├── MB01ZD.f │ ├── MB02CD.f │ ├── MB02CU.f │ ├── MB02CV.f │ ├── MB02CX.f │ ├── MB02CY.f │ ├── MB02DD.f │ ├── MB02ED.f │ ├── MB02FD.f │ ├── MB02GD.f │ ├── MB02HD.f │ ├── MB02ID.f │ ├── MB02JD.f │ ├── MB02JX.f │ ├── MB02KD.f │ ├── MB02MD.f │ ├── MB02ND.f │ ├── MB02NY.f │ ├── MB02OD.f │ ├── MB02PD.f │ ├── MB02QD.f │ ├── MB02QY.f │ ├── MB02RD.f │ ├── MB02RZ.f │ ├── MB02SD.f │ ├── MB02SZ.f │ ├── MB02TD.f │ ├── MB02TZ.f │ ├── MB02UD.f │ ├── MB02UU.f │ ├── MB02UV.f │ ├── MB02UW.f │ ├── MB02VD.f │ ├── MB02WD.f │ ├── MB02XD.f │ ├── MB02YD.f │ ├── MB03AD.f │ ├── MB03BA.f │ ├── MB03BB.f │ ├── MB03BC.f │ ├── MB03BD.f │ ├── MB03BE.f │ ├── MB03BZ.f │ ├── MB03CD.f │ ├── MB03CZ.f │ ├── MB03DD.f │ ├── MB03DZ.f │ ├── MB03ED.f │ ├── MB03FD.f │ ├── MB03FZ.f │ ├── MB03GD.f │ ├── MB03GZ.f │ ├── MB03HD.f │ ├── MB03HZ.f │ ├── MB03ID.f │ ├── MB03IZ.f │ ├── MB03JD.f │ ├── MB03JZ.f │ ├── MB03KA.f │ ├── MB03KB.f │ ├── MB03KC.f │ ├── MB03KD.f │ ├── MB03KE.f │ ├── MB03LD.f │ ├── MB03LF.f │ ├── MB03LZ.f │ ├── MB03MD.f │ ├── MB03MY.f │ ├── MB03ND.f │ ├── MB03NY.f │ ├── MB03OD.f │ ├── MB03OY.f │ ├── MB03PD.f │ ├── MB03PY.f │ ├── MB03QD.f │ ├── MB03QX.f │ ├── MB03QY.f │ ├── MB03RD.f │ ├── MB03RX.f │ ├── MB03RY - Copy.f │ ├── MB03RY.f │ ├── MB03SD - Copy.f │ ├── MB03SD.f │ ├── MB03TD - Copy.f │ ├── MB03TD.f │ ├── MB03TS - Copy.f │ ├── MB03TS.f │ ├── MB03UD - Copy.f │ ├── MB03UD.f │ ├── MB03VD - Copy.f │ ├── MB03VD.f │ ├── MB03VY - Copy.f │ ├── MB03VY.f │ ├── MB03WA.f │ ├── MB03WD - Copy.f │ ├── MB03WD.f │ ├── MB03WX.f │ ├── MB03XD.f │ ├── MB03XP.f │ ├── MB03XS.f │ ├── MB03XU.f │ ├── MB03XZ.f │ ├── MB03YA.f │ ├── MB03YD.f │ ├── MB03YT.f │ ├── MB03ZA.f │ ├── MB03ZD.f │ ├── MB04AD.f │ ├── MB04AZ.f │ ├── MB04BD.f │ ├── MB04BZ.f │ ├── MB04CD.f │ ├── MB04DD.f │ ├── MB04DI.f │ ├── MB04DS.f │ ├── MB04DY.f │ ├── MB3OYZ.f │ ├── MB3PYZ.f │ ├── NF01BQ.f │ ├── NF01BR.f │ ├── NF01BS.f │ ├── NF01BU.f │ ├── NF01BV.f │ ├── NF01BW.f │ ├── NF01BX.f │ ├── NF01BY.f │ ├── SB01DD.f │ ├── SB01FY.f │ ├── SB01MD.f │ ├── SB02CX.f │ ├── SB02MD.f │ ├── SB02MR.f │ ├── SB02MS.f │ ├── SB02MT.f │ ├── SB02MU.f │ ├── SB02MV.f │ ├── SB02MW.f │ ├── SB02ND.f │ ├── TB01YD.f │ ├── TB01ZD - Copy.f │ ├── TB03AD - Copy.f │ ├── TB03AY - Copy.f │ ├── TB04AD - Copy.f │ ├── TB04AY - Copy.f │ ├── TB04AY.f │ ├── TB04BD - Copy.f │ ├── TB04BD.f │ ├── TB04BV - Copy.f │ ├── TB04BV.f │ ├── TB04BW - Copy.f │ ├── TB04BW.f │ ├── TB04BX.f │ ├── TB04CD.f │ ├── TB05AD.f │ ├── TC01OD.f │ ├── TC04AD.f │ ├── TC05AD.f │ ├── TD03AD.f │ ├── TD03AY.f │ ├── TD04AD.f │ ├── TD05AD.f │ ├── TF01MD.f │ ├── TF01MX.f │ ├── TF01MY.f │ ├── TF01ND.f │ ├── TF01OD.f │ ├── TF01PD.f │ ├── TF01QD.f │ ├── TF01RD.f │ ├── TG01AD.f │ ├── TG01AZ.f │ ├── TG01BD - Copy.f │ ├── TG01CD - Copy.f │ ├── TG01DD - Copy.f │ ├── TG01ED - Copy.f │ ├── TG01FD - Copy.f │ ├── TG01FZ - Copy.f │ ├── TG01HD - Copy.f │ ├── TG01HY.f │ ├── TG01ID.f │ ├── TG01JD.f │ ├── TG01JY.f │ ├── TG01WD.f │ ├── UD01BD.f │ ├── UD01CD.f │ ├── UD01DD.f │ ├── UD01MD.f │ ├── UD01MZ.f │ ├── UD01ND.f │ ├── UE01MD.f │ ├── dcabs1.f │ ├── delctg.f │ ├── dhgeqz.f │ ├── dlagv2.f │ └── dtgsy2.f ├── Guidance ├── Config.h ├── Macros.h ├── SIMD_support.h ├── SlicotAB01MD.h ├── SlicotAB01ND.h ├── SlicotAB01OD.h ├── SlicotAB05MD.h ├── SlicotAB05ND.h ├── SlicotAB05OD.h ├── SlicotAB05PD.h └── Slicot_F77_Interface.h ├── LICENSE ├── MathLib ├── Include │ ├── BetaFunctions.h │ ├── BetaFunctions.inl │ ├── CartesianCoordSys.hpp │ ├── CartesianSystem.h │ ├── CartesianSystem.inl │ ├── Config.h │ ├── CoordAxis.h │ ├── CoordAxis.inl │ ├── CoordinatePoints.h │ ├── CoordinatePoints.inl │ ├── Derivative.h │ ├── Derivative.inl │ ├── DerivativeAVX.h │ ├── DerivativeAVX.inl │ ├── DimensionalAnalysis.hpp │ ├── ErrorFunctions.h │ ├── ErrorFunctions.inl │ ├── F77_FFT_DECLARATIONS.h │ ├── GaussianQuadrature.h │ ├── GaussianQuadrature.inl │ ├── GeocentricCoodinates.h │ ├── Indexing_operators.hpp │ ├── Integrand.h │ ├── Integrand.inl │ ├── IntegratorGKronordEndSingularity.h │ ├── IntegratorGKronordEndSingularity.inl │ ├── IntegratorGaussKronordInfinite.h │ ├── IntegratorGaussKronordInfinite.inl │ ├── IntegratorGaussKronordSingularity.h │ ├── IntegratorGaussKronordSingularity.inl │ ├── MathConstants.h │ ├── MathLibDefinitions.h │ ├── Meta_Vectors.hpp │ ├── MultiThreaded6PQuadrature.h │ ├── MultiThreaded6PQuadrature.inl │ ├── MultiThreaded7PQuadrature.h │ ├── MultiThreaded7PQuadrature.inl │ ├── MultiThreaded8PQuadrature.h │ ├── MultiThreaded8PQuadrature.inl │ ├── MultiThreadedBoolRule.h │ ├── MultiThreadedBoolRule.inl │ ├── MultiThreadedTrapezoid.h │ ├── MultiThreadedTrapezoid.inl │ ├── NDimCubature.hpp │ ├── Normal.h │ ├── Normal.inl │ ├── NormalF64AVX.h │ ├── NormalF64AVX.inl │ ├── PerfMeasurement.h │ ├── PerfMeasurement.inl │ ├── QuadratureEightPoints.h │ ├── QuadratureEightPoints.inl │ ├── QuadratureSevenPoints.h │ ├── QuadratureSevenPoints.inl │ ├── QuadratureSixPoints.h │ ├── QuadratureSixPoints.inl │ ├── Real_CosFFT_1D.h │ ├── Real_CosFFT_1D.inl │ ├── Real_CosFFT_Multiple.h │ ├── Real_CosFFT_Multiple.inl │ ├── Real_FFT_1D.h │ ├── Real_FFT_1D.inl │ ├── Real_FFT_2D.h │ ├── Real_FFT_2D.inl │ ├── Real_FFT_Multiple.h │ ├── Real_FFT_Multiple.inl │ ├── Real_SinFFT_1D.h │ ├── Real_SinFFT_1D.inl │ ├── Real_SinFFT_Multiple.h │ ├── Real_SinFFT_Multiple.inl │ ├── RungeKuttaWrapper.h │ ├── RungeKuttaWrapper.inl │ ├── RungeKutta_F77_Declarations.h │ ├── SIMDMatrix4x4.h │ ├── SIMDMatrix4x4.inl │ ├── SinusCFunctions.h │ ├── SinusCFunctions.inl │ ├── StatisticKurtosisMoment.h │ ├── StatisticKurtosisMoment.inl │ ├── StatisticMin.h │ ├── StatisticMin.inl │ ├── StatisticTailQuantile.h │ ├── Tangent.h │ ├── Tangent.inl │ ├── Tangential.h │ ├── Tangential.inl │ ├── TrapezoidQuadrature.h │ ├── TrapezoidQuadrature.inl │ ├── TrigFuncLUT.h │ ├── TrigFuncLUT.inl │ ├── Vector.h │ ├── Vector.inl │ ├── VectorF64AVX.h │ ├── VectorF64AVX.inl │ ├── Version.h │ ├── Version.inl │ ├── functions_scalar.h │ └── functions_scalar.inl ├── MathLib.vcxproj ├── MathLib.vcxproj.filters ├── MathLib.vcxproj.user └── Source │ ├── CubeEquSolver2.asm │ └── Version.cpp ├── MathLibTest ├── Include │ ├── ConstantsTest.h │ ├── IntegratorGKMultiPoint_TEST.h │ ├── NormalF64AVX_TEST.h │ ├── RungeKuttaWraper_TEST.h │ ├── TrapezoidQuadrature_TEST.h │ ├── TrapezoidQuadrature_TEST.inl │ ├── Utilities.h │ ├── Utils.h │ └── VectorF64AVX_TEST.h ├── MathLibTests.vcxproj ├── MathLibTests.vcxproj.filters ├── MathLibTests.vcxproj.user └── Source │ ├── IntegratorGKMultiPoint_TEST.cpp │ ├── NormalF64AVX_TEST.cpp │ ├── RungeKuttaWrapper_TEST.cpp │ ├── TrapezoidQuadrature_TEST.cpp │ ├── Utilities.cpp │ ├── Utils.cpp │ ├── VectorF64AVX_TEST.cpp │ ├── functions_scalar_test.cpp │ └── main.cpp ├── README.md ├── Radiolocation ├── Include │ ├── CWCosine.h │ ├── CWCosine.inl │ ├── CWSine.h │ ├── CWSine.inl │ ├── ExpChirp.h │ ├── ExpChirp.inl │ ├── GaussianNoiseExpChirp.h │ ├── GaussianNoiseExpChirp.inl │ ├── GaussianNoiseLinChirp.h │ ├── GaussianNoiseLinChirp.inl │ ├── GaussianNoiseModCos.h │ ├── GaussianNoiseModCos.inl │ ├── GaussianNoiseModSawtooth.h │ ├── GaussianNoiseModSawtooth.inl │ ├── GaussianNoiseModSine.h │ ├── GaussianNoiseModSine.inl │ ├── GaussianNoiseModSquareWave.h │ ├── GaussianNoiseModSquareWave.inl │ ├── GaussianNoiseSawtooth.h │ ├── GaussianNoiseSawtooth.inl │ ├── GaussianNoiseSine.h │ ├── GaussianNoiseSine.inl │ ├── GaussianNoiseSquareWave.h │ ├── GaussianNoiseSquareWave.inl │ ├── LibExceptions.h │ ├── LinearChirp.h │ ├── LinearChirp.inl │ ├── Polarization.h │ ├── Polarization.inl │ ├── PureCosine.h │ ├── PureCosine.inl │ ├── PureCosineAWGNoise.h │ ├── PureCosineAWGNoise.inl │ ├── PureCosineDopplerShift.h │ ├── PureCosineDopplerShift.inl │ ├── PureSine.h │ ├── PureSine.inl │ ├── RadLibDefs.h │ ├── RadarRangeResolution.h │ ├── RadarRangeResolution.inl │ ├── RangeMeasurement.inl │ ├── SawtoothModulated.h │ ├── SawtoothModulated.inl │ ├── SawtoothWave.h │ ├── SawtoothWave.inl │ ├── SignalTrain.h │ ├── SignalTrain.inl │ ├── SquareWave.h │ ├── SquareWave.inl │ ├── SquareWaveModulated.h │ ├── SquareWaveModulated.inl │ ├── SurfaceAreaClutterReturn.inl │ ├── WaveformInterface.h │ ├── WhiteGaussianNoise.h │ └── WhiteGaussianNoise.inl ├── Radiolocation.vcxproj ├── Radiolocation.vcxproj.filters ├── Radiolocation.vcxproj.user ├── ReadMe.txt └── Source │ ├── CWCosine.cpp │ ├── CWSine.cpp │ ├── EnergyOfPulse.cpp │ ├── ExpChirp.cpp │ ├── GaussianNoiseExpChirp.cpp │ ├── GaussianNoiseLinChirp.cpp │ ├── GaussianNoiseModCos.cpp │ ├── GaussianNoiseModSawtooth.cpp │ ├── GaussianNoiseModSine.cpp │ ├── GaussianNoiseModSquareWave.cpp │ ├── GaussianNoiseSawtooth.cpp │ ├── GaussianNoiseSine.cpp │ ├── GaussianNoiseSquareWave.cpp │ ├── LinearChirp.cpp │ ├── Polarization.cpp │ ├── PulseAveragePower.cpp │ ├── PureCosMultiTargetReturn.cpp │ ├── PureCosine.cpp │ ├── PureCosineAWGNoise.cpp │ ├── PureCosineDopplerShift.cpp │ ├── PureSine.cpp │ ├── SawtoothModulated.cpp │ ├── SawtoothWave.cpp │ ├── SignalTrain.cpp │ ├── SquareWave.cpp │ ├── SquareWaveModulated.cpp │ ├── SurfaceAreaClutterReturn.cpp │ ├── WaveformInterface.cpp │ └── WhiteGaussianNoise.cpp └── System ├── MemCopyRoutines.h ├── MemCopyRoutines.inl ├── MemCopyRoutinesAVX.h ├── MemCopyRoutinesAVX.inl ├── SystemLibDefs.h ├── TEST_sse_mem_cpy_f32.h ├── TEST_sse_mem_cpy_f32.inl └── TestUtilities.h /Atmosphere/Include/AtmMetricViscosity.h: -------------------------------------------------------------------------------- 1 | #ifndef _ATM_METRIC_VISCOSITY_H_15_03_16 2 | #define _ATM_METRIC_VISCOSITY_H_15_03_16 3 | 4 | 5 | /*---------------------------------------------------------*/ 6 | /*-------------- Metric Viscosity Computation -------------*/ 7 | /*----------------------------------------------------------*/ 8 | 9 | #include "TypeTraits.hpp" 10 | 11 | // for convenience usage only. 12 | namespace ad = atmosphere::detail; 13 | 14 | 15 | namespace atmosphere { 16 | 17 | 18 | 19 | /* 20 | MetricViscosity struct templated on parameter T. 21 | 22 | */ 23 | 24 | template struct MetricViscosity { 25 | 26 | // prevent instantiation on type T different than floating-point single or double precision. 27 | inline std::enable_if::value || ad::is_single_precision::value, T>::type 28 | operator()(const T); 29 | }; 30 | 31 | #include "AtmMetricViscosity.inl" 32 | } 33 | #endif /*_ATM_METRIC_VISCOSITY_H_15_03_16*/ -------------------------------------------------------------------------------- /Atmosphere/Include/AtmMetricViscosity.inl: -------------------------------------------------------------------------------- 1 | 2 | 3 | template inline std::enable_if::value || 4 | ad::is_single_precision::value, T>::type atmosphere::MetricViscosity::operator()(_In_ const T theta) { 5 | 6 | constexpr static T TZERO(288.15); 7 | constexpr static T BETAVISC(1.458E-6); 8 | constexpr static T SUTH(110.4); 9 | T t = theta * TZERO; 10 | return (BETAVISC*std::sqrt(t*t*t) / (t + SUTH)); 11 | } -------------------------------------------------------------------------------- /Atmosphere/Include/AtmosphereLibDefs.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ATMOSPHERE_LIB_DEFS_H_ 3 | #define _ATMOSPHERE_LIB_DEFS_H_ 4 | 5 | 6 | 7 | /* 8 | ---- Check for the Compiler support for C++11 features ---- 9 | */ 10 | #if defined (__INTEL_COMPILER) && (__INTEL_COMPILER) < 1400 11 | #error INTEL Compiler version 14.0 needed for partial support of C++11 and INTEL Compiler 15.0 needed for full support of C++11. 12 | #elif defined (__INTEL_COMPILER) && (__INTEL_COMPILER) < 1000 13 | #error Intel Compiler version 10.0 needed to support at least SSE4. 14 | #elif defined (_MSC_VER) && _MSC_VER < 1500 15 | #error MICROSOFT Visual Studio 2013 Compiler or later is required for MathLib compilation. 16 | #endif 17 | 18 | /* 19 | ---- Enable Support of SIMD ISA ---- 20 | */ 21 | #if defined (__INTEL_COMPILER) && defined (__AVX__) || defined (__AVX2__) 22 | #include 23 | #elif defined (__SSE4_2__) 24 | #include 25 | #elif defined (__SSE4_1__) 26 | #include 27 | #elif defined (__SSSE3__) 28 | #include 29 | #elif defined (__SSE3__) 30 | #include 31 | #elif defined (__SSE2__) 32 | #include 33 | #elif defined (__SSE__) 34 | #include 35 | #elif defined (_MSC_VER) 36 | #include 37 | #endif 38 | 39 | #ifndef USE_OPENMP 40 | #define USE_OPENMP 0x1 41 | #include 42 | #endif 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | 50 | #endif /*_ATMOSPHERE_LIB_DEFS_H_*/ -------------------------------------------------------------------------------- /Atmosphere/Include/NRLMSISE00_CCOR.h: -------------------------------------------------------------------------------- 1 | #ifndef _NRLMSISE00_CCOR_H_18_03_16 2 | #define _NRLMSISE00_CCOR_H_18_03_16 3 | /* -------------------------------------------------------------------- */ 4 | /* --------- N R L M S I S E - 0 0 M O D E L 2 0 0 1 ---------- */ 5 | /* -------------------------------------------------------------------- */ 6 | 7 | /* This file is part of C++ port of NRLMSISE-00 implemented in C. 8 | * @File NRLMSISE00_CCOR.h 9 | * The NRLMSISE-00 model was developed by Mike Picone, Alan Hedin, and 10 | * Doug Drob. They also wrote a NRLMSISE-00 distribution package in 11 | * FORTRAN which is available at 12 | * http://uap-www.nrl.navy.mil/models_web/msis/msis_home.htm 13 | * 14 | * Dominik Brodowski implemented and maintains this C version. You can 15 | * reach him at mail@brodo.de. See the file "DOCUMENTATION" for details, 16 | * and check http://www.brodo.de/english/pub/nrlmsise/index.html for 17 | * updated releases of this package. 18 | * 19 | * Adapted from the work of Dominik Brodowski by Bernard Gingold 20 | */ 21 | 22 | #include "TypeTraits.hpp" 23 | 24 | namespace ad = atmosphere::detail; 25 | 26 | namespace atmosphere { 27 | 28 | /* ------------------------------------------------------------------- */ 29 | /* ------------------------------ CCOR ------------------------------- */ 30 | /* ------------------------------------------------------------------- */ 31 | 32 | template struct CCOR { 33 | 34 | std::enable_if::value || ad::is_double_precision::value, T>::type 35 | operator()(_In_ const T, _In_ const T, _In_ const T, _In_ const T); 36 | }; 37 | 38 | /* ------------------------------------------------------------------- */ 39 | /* ------------------------------ CCOR2 ------------------------------- */ 40 | /* ------------------------------------------------------------------- */ 41 | 42 | template struct CCOR2 { 43 | 44 | std::enable_if::value || ad::is_double_precision::value, T>::type 45 | operator()(_In_ const T, _In_ const T, _In_ const T, _In_ const T, _In_ const T); 46 | }; 47 | #include "NRLMSISE00_CCOR.inl" 48 | } 49 | #endif /*_NRMLSISE00_CCOR_H_18_03_16*/ -------------------------------------------------------------------------------- /Atmosphere/Include/NRLMSISE00_CCOR.inl: -------------------------------------------------------------------------------- 1 | 2 | template 3 | std::enable_if::value || 4 | ad::is_double_precision::value,T>::type 5 | atmosphere::CCOR::operator() 6 | (_In_ const T alt, _In_ const T r, 7 | _In_ const T h1, _In_ const T zh){ 8 | /* CHEMISTRY/DISSOCIATION CORRECTION FOR MSIS MODELS 9 | * ALT - altitude 10 | * R - target ratio 11 | * H1 - transition scale length 12 | * ZH - altitude of 1/2 R 13 | */ 14 | constexpr T seventy( 70.0 ); 15 | T e = (alt - zh) / h1; 16 | if (e > seventy) 17 | return (exp(0.0)); 18 | if (e < -seventy) 19 | return (exp(r)); 20 | T ex = ::exp(e); 21 | e = r / (1.0 + ex); 22 | return (exp(x)); 23 | } 24 | 25 | template 26 | std::enable_if::value || 27 | ad::is_double_precision::value,T>::type 28 | atmosphere::CCOR2::operator() 29 | (_In_ const T alt, _In_ const T r, 30 | _In_ const T h1, _In_ const T zh, _In_ const T h2) { 31 | /* CHEMISTRY/DISSOCIATION CORRECTION FOR MSIS MODELS 32 | * ALT - altitude 33 | * R - target ratio 34 | * H1 - transition scale length 35 | * ZH - altitude of 1/2 R 36 | * H2 - transition scale length #2 ? 37 | */ 38 | T e1 = (alt - zh) / h1; 39 | T e2 = (alt - zh) / h2; 40 | constexpr T seventy(70.0); 41 | if ((e1 > seventy) || (e2 > seventy)) 42 | return (::exp(0.0)); 43 | if ((e1 < -seventy) && (e2 < -seventy)) 44 | return (::exp(r)); 45 | T ex1 = ::exp(e1); 46 | T ex2 = ::exp(e2); 47 | T ccor2v = r / (1.0 + 0.5 * (ex1 + ex2)); 48 | return (::exp(ccor2v)); 49 | } 50 | -------------------------------------------------------------------------------- /Atmosphere/Include/NRLMSISE00_GLATF.h: -------------------------------------------------------------------------------- 1 | #ifndef _NRLMSIS00_GLATF_17_03_16 2 | #define _NRMLSIS00_GLATF_17_03_16 3 | /* -------------------------------------------------------------------- */ 4 | /* --------- N R L M S I S E - 0 0 M O D E L 2 0 0 1 ---------- */ 5 | /* -------------------------------------------------------------------- */ 6 | 7 | /* This file is part of C++ port of NRLMSISE-00 implemented in C. 8 | * @File NRLMSISE00_GLATF.h 9 | * The NRLMSISE-00 model was developed by Mike Picone, Alan Hedin, and 10 | * Doug Drob. They also wrote a NRLMSISE-00 distribution package in 11 | * FORTRAN which is available at 12 | * http://uap-www.nrl.navy.mil/models_web/msis/msis_home.htm 13 | * 14 | * Dominik Brodowski implemented and maintains this C version. You can 15 | * reach him at mail@brodo.de. See the file "DOCUMENTATION" for details, 16 | * and check http://www.brodo.de/english/pub/nrlmsise/index.html for 17 | * updated releases of this package. 18 | * 19 | * Adapted from the work of Dominik Brodowski by Bernard Gingold 20 | */ 21 | 22 | 23 | //#include "AtmosphereLibDefs.h" 24 | #include "TypeTraits.hpp" 25 | 26 | 27 | namespace ad = atmosphere::detail; 28 | 29 | namespace atmosphere { 30 | 31 | /* ------------------------------------------------------------------- */ 32 | /* ------------------------------ GLATF ------------------------------ */ 33 | /* ------------------------------------------------------------------- */ 34 | 35 | template struct GLATF { 36 | 37 | std::enable_if::value || ad::is_double_precision::value, void>::type 38 | operator()(_In_ const T, _In_ T*, _In_ T*); 39 | void t(); 40 | }; 41 | 42 | #include "NRLMSISE00_GLATF.inl" 43 | } 44 | #endif /*_NRLMSISE00_GLATF_17_03_16*/ -------------------------------------------------------------------------------- /Atmosphere/Include/NRLMSISE00_GLATF.inl: -------------------------------------------------------------------------------- 1 | 2 | template std::enable_if::value || ad::is_double_precision::value,void>::type 3 | atmosphere::GLATF::operator()(_In_ const T lat, _In_ T* gv, _In_ T* reff){ 4 | 5 | constexpr T dgtr (1.74533E-2); 6 | T c2 = cos(2.0 * dgtr * lat); 7 | *gv = 980.616 * (1.0 - 0.0026373 * c2); 8 | *reff = 2.0 * (*gv) / (3.085462E-6 + 2.27E-9 * c2) * 1.0E-5; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Atmosphere/Include/NRLMSISE00_SCLAHDNET.h: -------------------------------------------------------------------------------- 1 | #ifndef _NRLMSISE00_SCLAH_DNET_H_18_03_16 2 | #define _NRLMSISE00_SCLAH_DNET_H_18_03_16 3 | 4 | /* -------------------------------------------------------------------- */ 5 | /* --------- N R L M S I S E - 0 0 M O D E L 2 0 0 1 ---------- */ 6 | /* -------------------------------------------------------------------- */ 7 | 8 | /* This file is part of C++ port of NRLMSISE-00 implemented in C. 9 | * @File NRLMSISE00_SCLAH_DNET.h 10 | * The NRLMSISE-00 model was developed by Mike Picone, Alan Hedin, and 11 | * Doug Drob. They also wrote a NRLMSISE-00 distribution package in 12 | * FORTRAN which is available at 13 | * http://uap-www.nrl.navy.mil/models_web/msis/msis_home.htm 14 | * 15 | * Dominik Brodowski implemented and maintains this C version. You can 16 | * reach him at mail@brodo.de. See the file "DOCUMENTATION" for details, 17 | * and check http://www.brodo.de/english/pub/nrlmsise/index.html for 18 | * updated releases of this package. 19 | * 20 | * Adapted from the work of Dominik Brodowski by Bernard Gingold 21 | */ 22 | 23 | #include "TypeTraits.hpp" 24 | #include "NRLMSISE00_SHARED.h" 25 | namespace ad = atmosphere::detail; 26 | namespace ang = atmosphere::nrlmsise00_globals; 27 | namespace atmosphere { 28 | 29 | /* ------------------------------------------------------------------- */ 30 | /* ------------------------------- SCALH ----------------------------- */ 31 | /* ------------------------------------------------------------------- */ 32 | template struct SCALH { 33 | 34 | std::enable_if::value || ad::is_double_precision::value, T>::type 35 | operator()(_In_ const T, _In_ const T, _In_ const T); 36 | }; 37 | 38 | /* ------------------------------------------------------------------- */ 39 | /* -------------------------------- DNET ----------------------------- */ 40 | /* ------------------------------------------------------------------- */ 41 | template struct DNET { 42 | /* TURBOPAUSE CORRECTION FOR MSIS MODELS 43 | * Root mean density 44 | * DD - diffusive density 45 | * DM - full mixed density 46 | * ZHM - transition scale length 47 | * XMM - full mixed molecular weight 48 | * XM - species molecular weight 49 | * DNET - combined density 50 | */ 51 | std::enable_if::value || ad::is_double_precision::value, T>::type 52 | operator()(_In_ T, _In_ const T, _In_ const T, _In_ const T, _In_ const T); 53 | }; 54 | 55 | #include "NRLMSISE00_SCLAHDNET.inl" 56 | } 57 | #endif /*_NRLMSISE00_SCLAH_DNET_H_18_03_16*/ -------------------------------------------------------------------------------- /Atmosphere/Include/NRLMSISE00_SCLAHDNET.inl: -------------------------------------------------------------------------------- 1 | 2 | template std::enable_if::value || ad::is_double_precision::value,T>::type 3 | atmosphere::SCALH::operator()(_In_ const T alt, _In_ const T xm, _In_ const T temp) { 4 | 5 | T rgas = 831.4; 6 | T g = ang::gsurf / (1.0 + alt / ang::re) * (1.0 + alt / ang::re); 7 | g = rgas * temp / (g * xm); 8 | return g; 9 | } 10 | 11 | template std::enable_if::value || ad::is_double_precision::value,T>::type 12 | atmosphere::DNET::operator()(_In_ T dd, _In_ const T dm, _In_ const T zhm, _In_ const T xmm, _In_ const T xm){ 13 | 14 | T a = zhm / (xmm - xm); 15 | if (!((dm > 0.0) && (dd > 0.0))) { 16 | std::cerr << "DNET log args error:" << dm << dd << xm << std::endl; 17 | if ((dd == 0.0) && (dm == 0.0)) 18 | dd = 1.0; 19 | if (dm == 0.0) 20 | return dd; 21 | if (dd == 0.0) 22 | return dm; 23 | } 24 | T ylog = a * log(dm / dd); 25 | if (ylog < -10.0) 26 | return dd; 27 | if (ylog > 10.0) 28 | return dm; 29 | a = dd * pow((1.0 + exp(ylog)), (1.0 / a)); 30 | return a; 31 | } -------------------------------------------------------------------------------- /Atmosphere/Include/NRLMSISE00_SHARED.h: -------------------------------------------------------------------------------- 1 | #ifndef _NRLMSISE00_SHARED_H_21_03_16 2 | #define _NRLMSISE00_SHARED_H_21_03_16 3 | 4 | 5 | /* 6 | Shared Variables 7 | */ 8 | 9 | namespace atmosphere { 10 | 11 | namespace nrlmsise00_globals { 12 | 13 | // As evil as it is:) 14 | 15 | /**************************************************** 16 | PARMB Globals 17 | double precision by default. 18 | *****************************************************/ 19 | double gsurf; 20 | double re; 21 | 22 | /**************************************************** 23 | GTS3C Global variables defaulted to double 24 | precision. 25 | *****************************************************/ 26 | double dd; 27 | 28 | /*************************************************** 29 | DMIX Global variables. 30 | double precision by default. 31 | ****************************************************/ 32 | double dm04; 33 | double dm16; 34 | double dm28; 35 | double dm32; 36 | double dm40; 37 | double dm01; 38 | double dm14; 39 | 40 | /**************************************************** 41 | MESO7 Global static arrays 42 | double precision by default 43 | *****************************************************/ 44 | double meso_tn1[5]; 45 | double meso_tn2[4]; 46 | double meso_tn3[5]; 47 | double meso_tgn1[2]; 48 | double meso_tgn2[2]; 49 | double meso_tgn3[2]; 50 | 51 | /**************************************************** 52 | LPOLY Global static arrays and scalar 53 | variables, double precision by default. 54 | *****************************************************/ 55 | double dfa; 56 | double plg[4][9]; 57 | double ctloc; 58 | double stloc; 59 | double c2tloc; 60 | double s2tloc; 61 | double c3tloc; 62 | double s3tloc; 63 | double apdf; 64 | double apt[4]; 65 | } 66 | } 67 | #endif /*_NRLMSISE00_SHARED_H_21_03_16*/ -------------------------------------------------------------------------------- /Atmosphere/Include/NRLMSISE00_SPLINE_INTEGRATORS.h: -------------------------------------------------------------------------------- 1 | #ifndef _NRLMSISE00_SPLINE_INTEGRATORS_H_21_03_16 2 | #define _NRLMSISE00_SPLINE_INTEGRATORS_H_21_03_16 3 | 4 | 5 | #include "TypeTraits.hpp" 6 | 7 | namespace ad = atmosphere::detail; 8 | namespace atmosphere { 9 | 10 | /* ------------------------------------------------------------------- */ 11 | /* ------------------------------- SPLINI ---------------------------- */ 12 | /* ------------------------------------------------------------------- */ 13 | template struct SPLINE_INTEGRATOR { 14 | 15 | static std::enable_if::value || 16 | ad::is_double_precision::value, void>::type 17 | splinint(_In_ const T*__restrict, _In_ const T* __restrict, _In_ const T* __restrict, 18 | _In_ const int, _In_ const T, _Out_ T*__restrict)noexcept(false); 19 | 20 | }; 21 | 22 | /* ------------------------------------------------------------------- */ 23 | /* ------------------------------- SPLINT ---------------------------- */ 24 | /* ------------------------------------------------------------------- */ 25 | template struct SPLINE_INTERPOLATOR { 26 | 27 | static std::enable_if::value || 28 | ad::is_double_precision::value, void>::type 29 | splinterp(_In_ const T* __restrict, _In_ const T* __restrict, 30 | _In_ const T* __restrict, _In_ const int, _In_ const T, _Out_ T*__restrict)noexcept(false); 31 | }; 32 | 33 | /* ------------------------------------------------------------------- */ 34 | /* ------------------------------- SPLINE ---------------------------- */ 35 | /* ------------------------------------------------------------------- */ 36 | template struct SPLINE_CUBIC_DERIV { 37 | 38 | static std::enable_if::value || 39 | ad::is_double_precision::value, void>::type 40 | splinderiv(_In_ const T*__restrict, _In_ const T*__restrict, _In_ const int, 41 | _In_ const T, _In_ const T, _Out_ T*__restrict)noexcept(false); 42 | }; 43 | #include "NRLMSISE00_SPLINE_INTEGRATORS.inl" 44 | } 45 | #endif /*_NRLMSISE00_SPLINE_INTEGRATORS_H_21_03_16*/ 46 | -------------------------------------------------------------------------------- /Docs/MIL-HDBK-1797.PDF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bgin/MissileSimulation/90adcbf1c049daafb939f3fe9f9dfe792f26d5df/Docs/MIL-HDBK-1797.PDF -------------------------------------------------------------------------------- /Docs/Wind_Forces_2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bgin/MissileSimulation/90adcbf1c049daafb939f3fe9f9dfe792f26d5df/Docs/Wind_Forces_2.pdf -------------------------------------------------------------------------------- /Docs/wind simulation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bgin/MissileSimulation/90adcbf1c049daafb939f3fe9f9dfe792f26d5df/Docs/wind simulation.pdf -------------------------------------------------------------------------------- /External/CUBPACK/internal_types.f90: -------------------------------------------------------------------------------- 1 | ! This file is F-compatible, except for upper/lower case conventions. 2 | !-------------------------------------------------------------------- 3 | Module internal_types 4 | USE Precision_Model 5 | IMPLICIT NONE 6 | private 7 | 8 | ! 9 | ! Named constants, to enhance readability 10 | ! 11 | INTEGER, public, PARAMETER :: & 12 | Simplex = 1 , & 13 | Hyperrectangle = 2, & 14 | EPSTABLENGHT = 52 15 | 16 | ! 17 | ! The following record stores information that determines the 18 | ! behaviour of the global adaptive integration procedure. 19 | ! This information is passed to the region processor. 20 | ! 21 | type, public :: integrator_info 22 | integer :: key, nrsub 23 | REAL(kind=stnd) :: tune 24 | logical :: uniform_subdiv 25 | end type integrator_info 26 | 27 | ! 28 | ! The following record stores information that is specific 29 | ! for the region collection and other data structures. 30 | ! 31 | type, public :: collection_info 32 | integer :: dimens, nrvert, niinfo, nrinfo 33 | end type collection_info 34 | 35 | ! 36 | ! The following record stores scalar information supplied by the user 37 | ! or meant for the user related to the integration procedure. 38 | ! 39 | type, public :: user_info 40 | ! Input 41 | integer :: numfun,numrgn,minpts,maxpts 42 | REAL(kind=stnd) :: epsabs,epsrel 43 | logical :: restart 44 | ! Output 45 | integer :: neval,ifail 46 | end type user_info 47 | 48 | type, public :: epsalg_mem 49 | LOGICAL :: HEURISTIC_USED 50 | INTEGER :: DIVLEVEL 51 | INTEGER, POINTER, DIMENSION(:) :: NRRCOPY 52 | REAL(kind=stnd) :: ERRORMAXPOOL, EPSABS, EPSREL 53 | REAL(kind=stnd), POINTER, DIMENSION(:) :: ERLARG, & 54 | RESULT1, & 55 | ABSERR1 56 | REAL(kind=stnd), POINTER, DIMENSION(:,:) :: RCOPY, & 57 | RESLA 58 | end type epsalg_mem 59 | 60 | end module internal_types 61 | -------------------------------------------------------------------------------- /External/FFTPACK/cfft1i.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | SUBROUTINE CFFT1I (N, WSAVE, LENSAV, IER) 32 | INTEGER N, LENSAV, IER 33 | REAL WSAVE(LENSAV) 34 | C 35 | IER = 0 36 | C 37 | IF (LENSAV .LT. 2*N + INT(LOG(REAL(N))/LOG(2.)) + 4) THEN 38 | IER = 2 39 | CALL XERFFT ('CFFTMI ', 3) 40 | ENDIF 41 | C 42 | IF (N .EQ. 1) RETURN 43 | C 44 | IW1 = N+N+1 45 | CALL MCFTI1 (N,WSAVE,WSAVE(IW1),WSAVE(IW1+1)) 46 | C 47 | RETURN 48 | END 49 | -------------------------------------------------------------------------------- /External/FFTPACK/cfftmi.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | SUBROUTINE CFFTMI (N, WSAVE, LENSAV, IER) 32 | INTEGER N, LENSAV, IER 33 | REAL WSAVE(LENSAV) 34 | C 35 | IER = 0 36 | C 37 | IF (LENSAV .LT. 2*N + INT(LOG(REAL(N))/LOG(2.)) + 4) THEN 38 | IER = 2 39 | CALL XERFFT ('CFFTMI ', 3) 40 | ENDIF 41 | C 42 | IF (N .EQ. 1) RETURN 43 | C 44 | IW1 = N+N+1 45 | CALL MCFTI1 (N,WSAVE,WSAVE(IW1),WSAVE(IW1+1)) 46 | RETURN 47 | END 48 | -------------------------------------------------------------------------------- /External/FFTPACK/factor.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | SUBROUTINE FACTOR (N,NF,FAC) 32 | REAL FAC(*) 33 | INTEGER NTRYH(4) 34 | DATA NTRYH(1),NTRYH(2),NTRYH(3),NTRYH(4)/4,2,3,5/ 35 | C 36 | NL = N 37 | NF = 0 38 | J = 0 39 | 101 J = J+1 40 | IF (J-4) 102,102,103 41 | 102 NTRY = NTRYH(J) 42 | GO TO 104 43 | 103 NTRY = NTRY+2 44 | 104 NQ = NL/NTRY 45 | NR = NL-NTRY*NQ 46 | IF (NR) 101,105,101 47 | 105 NF = NF+1 48 | FAC(NF) = NTRY 49 | NL = NQ 50 | IF (NL .NE. 1) GO TO 104 51 | RETURN 52 | END 53 | -------------------------------------------------------------------------------- /External/FFTPACK/mcfti1.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | SUBROUTINE MCFTI1 (N,WA,FNF,FAC) 32 | REAL WA(*),FAC(*) 33 | C 34 | CALL FACTOR (N,NF,FAC) 35 | FNF = NF 36 | IW = 1 37 | L1 = 1 38 | DO 110 K1=1,NF 39 | IP = FAC(K1) 40 | L2 = L1*IP 41 | IDO = N/L2 42 | CALL TABLES (IDO,IP,WA(IW)) 43 | IW = IW+(IP-1)*(IDO+IDO) 44 | L1 = L2 45 | 110 CONTINUE 46 | RETURN 47 | END 48 | -------------------------------------------------------------------------------- /External/FFTPACK/r2w.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | subroutine r2w(ldr,ldw,l,m,r,w) 32 | dimension r(ldr,*),w(ldw,*) 33 | do j=1,m 34 | do i=1,l 35 | w(i,j) = r( i,j) 36 | end do 37 | end do 38 | return 39 | end 40 | -------------------------------------------------------------------------------- /External/FFTPACK/rfft1b.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | SUBROUTINE RFFT1B ( N, INC, R, LENR, WSAVE, LENSAV, 32 | 1 WORK, LENWRK, IER) 33 | INTEGER N, INC, LENR, LENSAV, LENWRK, IER 34 | REAL R(LENR), WSAVE(LENSAV) ,WORK(LENWRK) 35 | C 36 | IER = 0 37 | C 38 | IF (LENR .LT. INC*(N-1) + 1) THEN 39 | IER = 1 40 | CALL XERFFT ('RFFT1B ', 6) 41 | ELSEIF (LENSAV .LT. N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN 42 | IER = 2 43 | CALL XERFFT ('RFFT1B ', 8) 44 | ELSEIF (LENWRK .LT. N) THEN 45 | IER = 3 46 | CALL XERFFT ('RFFT1B ', 10) 47 | ENDIF 48 | C 49 | IF (N .EQ. 1) RETURN 50 | C 51 | CALL RFFTB1 (N,INC,R,WORK,WSAVE,WSAVE(N+1)) 52 | RETURN 53 | END 54 | -------------------------------------------------------------------------------- /External/FFTPACK/rfft1f.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | SUBROUTINE RFFT1F ( N, INC, R, LENR, WSAVE, LENSAV, 32 | 1 WORK, LENWRK, IER) 33 | INTEGER N, INC, LENR, LENSAV, LENWRK, IER 34 | REAL R(LENR), WSAVE(LENSAV), WORK(LENWRK) 35 | C 36 | IER = 0 37 | C 38 | IF (LENR .LT. INC*(N-1) + 1) THEN 39 | IER = 1 40 | CALL XERFFT ('RFFT1F ', 6) 41 | ELSEIF (LENSAV .LT. N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN 42 | IER = 2 43 | CALL XERFFT ('RFFT1F ', 8) 44 | ELSEIF (LENWRK .LT. N) THEN 45 | IER = 3 46 | CALL XERFFT ('RFFT1F ', 10) 47 | ENDIF 48 | C 49 | IF (N .EQ. 1) RETURN 50 | C 51 | CALL RFFTF1 (N,INC,R,WORK,WSAVE,WSAVE(N+1)) 52 | RETURN 53 | END 54 | -------------------------------------------------------------------------------- /External/FFTPACK/rfft1i.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | SUBROUTINE RFFT1I ( N, WSAVE, LENSAV, IER ) 32 | INTEGER N, LENSAV, IER 33 | REAL WSAVE(LENSAV) 34 | C 35 | IER = 0 36 | C 37 | IF (LENSAV .LT. N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN 38 | IER = 2 39 | CALL XERFFT ('RFFT1I ', 3) 40 | ENDIF 41 | C 42 | IF (N .EQ. 1) RETURN 43 | C 44 | CALL RFFTI1 (N,WSAVE(1),WSAVE(N+1)) 45 | RETURN 46 | END 47 | -------------------------------------------------------------------------------- /External/FFTPACK/rfftmi.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | SUBROUTINE RFFTMI (N, WSAVE, LENSAV, IER) 32 | INTEGER N, LENSAV, IER 33 | REAL WSAVE(LENSAV) 34 | C 35 | IER = 0 36 | C 37 | IF (LENSAV .LT. N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN 38 | IER = 2 39 | CALL XERFFT ('RFFTMI ', 3) 40 | ENDIF 41 | C 42 | IF (N .EQ. 1) RETURN 43 | C 44 | CALL MRFTI1 (N,WSAVE(1),WSAVE(N+1)) 45 | RETURN 46 | END 47 | -------------------------------------------------------------------------------- /External/FFTPACK/sinq1i.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | SUBROUTINE SINQ1I (N, WSAVE, LENSAV, IER) 32 | INTEGER N, LENSAV, IER 33 | REAL WSAVE(LENSAV) 34 | C 35 | IER = 0 36 | C 37 | IF (LENSAV .LT. 2*N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN 38 | IER = 2 39 | CALL XERFFT ('SINQ1I', 3) 40 | GO TO 300 41 | ENDIF 42 | C 43 | CALL COSQ1I (N, WSAVE, LENSAV, IER1) 44 | IF (IER1 .NE. 0) THEN 45 | IER = 20 46 | CALL XERFFT ('SINQ1I',-5) 47 | ENDIF 48 | 300 RETURN 49 | END 50 | -------------------------------------------------------------------------------- /External/FFTPACK/sinqmi.f: -------------------------------------------------------------------------------- 1 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 | C * * 3 | C * copyright (c) 2011 by UCAR * 4 | C * * 5 | C * University Corporation for Atmospheric Research * 6 | C * * 7 | C * all rights reserved * 8 | C * * 9 | C * FFTPACK version 5.1 * 10 | C * * 11 | C * A Fortran Package of Fast Fourier * 12 | C * * 13 | C * Subroutines and Example Programs * 14 | C * * 15 | C * by * 16 | C * * 17 | C * Paul Swarztrauber and Dick Valent * 18 | C * * 19 | C * of * 20 | C * * 21 | C * the National Center for Atmospheric Research * 22 | C * * 23 | C * Boulder, Colorado (80307) U.S.A. * 24 | C * * 25 | C * which is sponsored by * 26 | C * * 27 | C * the National Science Foundation * 28 | C * * 29 | C * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 30 | C 31 | SUBROUTINE SINQMI (N, WSAVE, LENSAV, IER) 32 | INTEGER N, LENSAV, IER 33 | REAL WSAVE(LENSAV) 34 | C 35 | IER = 0 36 | C 37 | IF (LENSAV .LT. 2*N + INT(LOG(REAL(N))/LOG(2.)) +4) THEN 38 | IER = 2 39 | CALL XERFFT ('SINQMI', 3) 40 | GO TO 300 41 | ENDIF 42 | C 43 | CALL COSQMI (N, WSAVE, LENSAV, IER1) 44 | IF (IER1 .NE. 0) THEN 45 | IER = 20 46 | CALL XERFFT ('SINQMI',-5) 47 | ENDIF 48 | 300 CONTINUE 49 | RETURN 50 | END 51 | -------------------------------------------------------------------------------- /External/QUADPACK/dqwgtc.f: -------------------------------------------------------------------------------- 1 | double precision function dqwgtc(x,c,p2,p3,p4,kp) 2 | c***begin prologue dqwgtc 3 | c***refer to dqk15w 4 | c***routines called (none) 5 | c***revision date 810101 (yymmdd) 6 | c***keywords weight function, cauchy principal value 7 | c***author piessens,robert,appl. math. & progr. div. - k.u.leuven 8 | c de doncker,elise,appl. math. & progr. div. - k.u.leuven 9 | c***purpose this function subprogram is used together with the 10 | c routine qawc and defines the weight function. 11 | c***end prologue dqwgtc 12 | c 13 | double precision c,p2,p3,p4,x 14 | integer kp 15 | c***first executable statement dqwgtc 16 | dqwgtc = 0.1d+01/(x-c) 17 | return 18 | end 19 | -------------------------------------------------------------------------------- /External/QUADPACK/dqwgtf.f: -------------------------------------------------------------------------------- 1 | double precision function dqwgtf(x,omega,p2,p3,p4,integr) 2 | c***begin prologue dqwgtf 3 | c***refer to dqk15w 4 | c***routines called (none) 5 | c***revision date 810101 (yymmdd) 6 | c***keywords cos or sin in weight function 7 | c***author piessens,robert, appl. math. & progr. div. - k.u.leuven 8 | c de doncker,elise,appl. math. * progr. div. - k.u.leuven 9 | c***end prologue dqwgtf 10 | c 11 | double precision dcos,dsin,omega,omx,p2,p3,p4,x 12 | integer integr 13 | c***first executable statement dqwgtf 14 | omx = omega*x 15 | go to(10,20),integr 16 | 10 dqwgtf = dcos(omx) 17 | go to 30 18 | 20 dqwgtf = dsin(omx) 19 | 30 return 20 | end 21 | -------------------------------------------------------------------------------- /External/QUADPACK/dqwgts.f: -------------------------------------------------------------------------------- 1 | double precision function dqwgts(x,a,b,alfa,beta,integr) 2 | c***begin prologue dqwgts 3 | c***refer to dqk15w 4 | c***routines called (none) 5 | c***revision date 810101 (yymmdd) 6 | c***keywords weight function, algebraico-logarithmic 7 | c end-point singularities 8 | c***author piessens,robert,appl. math. & progr. div. - k.u.leuven 9 | c de doncker,elise,appl. math. & progr. div. - k.u.leuven 10 | c***purpose this function subprogram is used together with the 11 | c routine dqaws and defines the weight function. 12 | c***end prologue dqwgts 13 | c 14 | double precision a,alfa,b,beta,bmx,dlog,x,xma 15 | integer integr 16 | c***first executable statement dqwgts 17 | xma = x-a 18 | bmx = b-x 19 | dqwgts = xma**alfa*bmx**beta 20 | go to (40,10,20,30),integr 21 | 10 dqwgts = dqwgts*dlog(xma) 22 | go to 40 23 | 20 dqwgts = dqwgts*dlog(bmx) 24 | go to 40 25 | 30 dqwgts = dqwgts*dlog(xma)*dlog(bmx) 26 | 40 return 27 | end 28 | -------------------------------------------------------------------------------- /External/QUADPACK/fdump.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE FDUMP 2 | C***BEGIN PROLOGUE FDUMP 3 | C***DATE WRITTEN 790801 (YYMMDD) 4 | C***REVISION DATE 820801 (YYMMDD) 5 | C***CATEGORY NO. Z 6 | C***KEYWORDS ERROR,XERROR PACKAGE 7 | C***AUTHOR JONES, R. E., (SNLA) 8 | C***PURPOSE Symbolic dump (should be locally written). 9 | C***DESCRIPTION 10 | C ***Note*** Machine Dependent Routine 11 | C FDUMP is intended to be replaced by a locally written 12 | C version which produces a symbolic dump. Failing this, 13 | C it should be replaced by a version which prints the 14 | C subprogram nesting list. Note that this dump must be 15 | C printed on each of up to five files, as indicated by the 16 | C XGETUA routine. See XSETUA and XGETUA for details. 17 | C 18 | C Written by Ron Jones, with SLATEC Common Math Library Subcommittee 19 | C Latest revision --- 23 May 1979 20 | C***ROUTINES CALLED (NONE) 21 | C***END PROLOGUE FDUMP 22 | C***FIRST EXECUTABLE STATEMENT FDUMP 23 | RETURN 24 | END 25 | -------------------------------------------------------------------------------- /External/QUADPACK/j4save.f: -------------------------------------------------------------------------------- 1 | function j4save(iwhich,ivalue,iset) 2 | c 3 | c abstract 4 | c j4save saves and recalls several global variables needed 5 | c by the library error handling routines. 6 | c 7 | c description of parameters 8 | c --input-- 9 | c iwhich - index of item desired. 10 | c = 1 refers to current error number. 11 | c = 2 refers to current error control flag. 12 | c = 3 refers to current unit number to which error 13 | c messages are to be sent. (0 means use standard.) 14 | c = 4 refers to the maximum number of times any 15 | c message is to be printed (as set by xermax). 16 | c = 5 refers to the total number of units to which 17 | c each error message is to be written. 18 | c = 6 refers to the 2nd unit for error messages 19 | c = 7 refers to the 3rd unit for error messages 20 | c = 8 refers to the 4th unit for error messages 21 | c = 9 refers to the 5th unit for error messages 22 | c ivalue - the value to be set for the iwhich-th parameter, 23 | c if iset is .true. . 24 | c iset - if iset=.true., the iwhich-th parameter will be 25 | c given the value, ivalue. if iset=.false., the 26 | c iwhich-th parameter will be unchanged, and ivalue 27 | c is a dummy parameter. 28 | c --output-- 29 | c the (old) value of the iwhich-th parameter will be returned 30 | c in the function value, j4save. 31 | c 32 | c written by ron jones, with slatec common math library subcommittee 33 | c adapted from bell laboratories port library error handler 34 | c latest revision --- 23 may 1979 35 | c 36 | logical iset 37 | integer iparam(9) 38 | data iparam(1),iparam(2),iparam(3),iparam(4)/0,1,0,10/ 39 | data iparam(5)/1/ 40 | data iparam(6),iparam(7),iparam(8),iparam(9)/0,0,0,0/ 41 | j4save = iparam(iwhich) 42 | if (iset) iparam(iwhich) = ivalue 43 | return 44 | end 45 | -------------------------------------------------------------------------------- /External/QUADPACK/qwgtc.f: -------------------------------------------------------------------------------- 1 | real function qwgtc(x,c,p2,p3,p4,kp) 2 | c***begin prologue qwgtc 3 | c***refer to qk15w 4 | c***routines called (none) 5 | c***revision date 810101 (yymmdd) 6 | c***keywords weight function, cauchy principal value 7 | c***author piessens,robert,appl. math. & progr. div. - k.u.leuven 8 | c de doncker,elise,appl. math. & progr. div. - k.u.leuven 9 | c***purpose this function subprogram is used together with the 10 | c routine qawc and defines the weight function. 11 | c***end prologue qwgtc 12 | c 13 | real c,p2,p3,p4,x 14 | integer kp 15 | c***first executable statement 16 | qwgtc = 0.1e+01/(x-c) 17 | return 18 | end 19 | -------------------------------------------------------------------------------- /External/QUADPACK/qwgtf.f: -------------------------------------------------------------------------------- 1 | real function qwgtf(x,omega,p2,p3,p4,integr) 2 | c***begin prologue qwgtf 3 | c***refer to qk15w 4 | c***routines called (none) 5 | c***revision date 810101 (yymmdd) 6 | c***keywords cos or sin in weight function 7 | c***author piessens,robert, appl. math. & progr. div. - k.u.leuven 8 | c de doncker,elise,appl. math. * progr. div. - k.u.leuven 9 | c***end prologue qwgtf 10 | c 11 | real omega,omx,p2,p3,p4,x 12 | integer integr 13 | c***first executable statement 14 | omx = omega*x 15 | go to(10,20),integr 16 | 10 qwgtf = cos(omx) 17 | go to 30 18 | 20 qwgtf = sin(omx) 19 | 30 return 20 | end 21 | -------------------------------------------------------------------------------- /External/QUADPACK/qwgts.f: -------------------------------------------------------------------------------- 1 | real function qwgts(x,a,b,alfa,beta,integr) 2 | c***begin prologue qwgts 3 | c***refer to qk15w 4 | c***routines called (none) 5 | c***revision date 810101 (yymmdd) 6 | c***keywords weight function, algebraico-logarithmic 7 | c end-point singularities 8 | c***author piessens,robert,appl. math. & progr. div. - k.u.leuven 9 | c de doncker,elise,appl. math. & progr. div. - k.u.leuven 10 | c***purpose this function subprogram is used together with the 11 | c routine qaws and defines the weight function. 12 | c***end prologue qwgts 13 | c 14 | real a,alfa,b,beta,bmx,x,xma 15 | integer integr 16 | c***first executable statement 17 | xma = x-a 18 | bmx = b-x 19 | qwgts = xma**alfa*bmx**beta 20 | go to (40,10,20,30),integr 21 | 10 qwgts = qwgts*alog(xma) 22 | go to 40 23 | 20 qwgts = qwgts*alog(bmx) 24 | go to 40 25 | 30 qwgts = qwgts*alog(xma)*alog(bmx) 26 | 40 return 27 | end 28 | -------------------------------------------------------------------------------- /External/QUADPACK/s88fmt.f: -------------------------------------------------------------------------------- 1 | subroutine s88fmt(n,ivalue,ifmt) 2 | c 3 | c abstract 4 | c s88fmt replaces ifmt(1), ... ,ifmt(n) with the 5 | c characters corresponding to the n least significant 6 | c digits of ivalue. 7 | c 8 | c taken from the bell laboratories port library error handler 9 | c latest revision --- 7 june 1978 10 | c 11 | dimension ifmt(n),idigit(10) 12 | data idigit(1),idigit(2),idigit(3),idigit(4),idigit(5), 13 | 1 idigit(6),idigit(7),idigit(8),idigit(9),idigit(10) 14 | 2 /1h0,1h1,1h2,1h3,1h4,1h5,1h6,1h7,1h8,1h9/ 15 | nt = n 16 | it = ivalue 17 | 10 if (nt .eq. 0) return 18 | index = mod(it,10) 19 | ifmt(nt) = idigit(index+1) 20 | it = it/10 21 | nt = nt - 1 22 | go to 10 23 | end 24 | -------------------------------------------------------------------------------- /External/QUADPACK/xerabt.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE XERABT(MESSG,NMESSG) 2 | C***BEGIN PROLOGUE XERABT 3 | C***DATE WRITTEN 790801 (YYMMDD) 4 | C***REVISION DATE 820801 (YYMMDD) 5 | C***CATEGORY NO. R3C 6 | C***KEYWORDS ERROR,XERROR PACKAGE 7 | C***AUTHOR JONES, R. E., (SNLA) 8 | C***PURPOSE Aborts program execution and prints error message. 9 | C***DESCRIPTION 10 | C Abstract 11 | C ***Note*** machine dependent routine 12 | C XERABT aborts the execution of the program. 13 | C The error message causing the abort is given in the calling 14 | C sequence, in case one needs it for printing on a dayfile, 15 | C for example. 16 | C 17 | C Description of Parameters 18 | C MESSG and NMESSG are as in XERROR, except that NMESSG may 19 | C be zero, in which case no message is being supplied. 20 | C 21 | C Written by Ron Jones, with SLATEC Common Math Library Subcommittee 22 | C Latest revision --- 19 MAR 1980 23 | C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR- 24 | C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES, 25 | C 1982. 26 | C***ROUTINES CALLED (NONE) 27 | C***END PROLOGUE XERABT 28 | CHARACTER*(*) MESSG 29 | C***FIRST EXECUTABLE STATEMENT XERABT 30 | if(nmessg.ne.0) then 31 | write(i1mach(4),100)messg 32 | 100 format(' xerabt:',a) 33 | endif 34 | STOP 35 | END 36 | -------------------------------------------------------------------------------- /External/QUADPACK/xerctl.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE XERCTL(MESSG1,NMESSG,NERR,LEVEL,KONTRL) 2 | C***BEGIN PROLOGUE XERCTL 3 | C***DATE WRITTEN 790801 (YYMMDD) 4 | C***REVISION DATE 820801 (YYMMDD) 5 | C***CATEGORY NO. R3C 6 | C***KEYWORDS ERROR,XERROR PACKAGE 7 | C***AUTHOR JONES, R. E., (SNLA) 8 | C***PURPOSE Allows user control over handling of individual errors. 9 | C***DESCRIPTION 10 | C Abstract 11 | C Allows user control over handling of individual errors. 12 | C Just after each message is recorded, but before it is 13 | C processed any further (i.e., before it is printed or 14 | C a decision to abort is made), a call is made to XERCTL. 15 | C If the user has provided his own version of XERCTL, he 16 | C can then override the value of KONTROL used in processing 17 | C this message by redefining its value. 18 | C KONTRL may be set to any value from -2 to 2. 19 | C The meanings for KONTRL are the same as in XSETF, except 20 | C that the value of KONTRL changes only for this message. 21 | C If KONTRL is set to a value outside the range from -2 to 2, 22 | C it will be moved back into that range. 23 | C 24 | C Description of Parameters 25 | C 26 | C --Input-- 27 | C MESSG1 - the first word (only) of the error message. 28 | C NMESSG - same as in the call to XERROR or XERRWV. 29 | C NERR - same as in the call to XERROR or XERRWV. 30 | C LEVEL - same as in the call to XERROR or XERRWV. 31 | C KONTRL - the current value of the control flag as set 32 | C by a call to XSETF. 33 | C 34 | C --Output-- 35 | C KONTRL - the new value of KONTRL. If KONTRL is not 36 | C defined, it will remain at its original value. 37 | C This changed value of control affects only 38 | C the current occurrence of the current message. 39 | C***REFERENCES JONES R.E., KAHANER D.K., "XERROR, THE SLATEC ERROR- 40 | C HANDLING PACKAGE", SAND82-0800, SANDIA LABORATORIES, 41 | C 1982. 42 | C***ROUTINES CALLED (NONE) 43 | C***END PROLOGUE XERCTL 44 | CHARACTER*20 MESSG1 45 | C***FIRST EXECUTABLE STATEMENT XERCTL 46 | RETURN 47 | END 48 | -------------------------------------------------------------------------------- /External/QUADPACK/xerprt.f: -------------------------------------------------------------------------------- 1 | subroutine xerprt(messg,nmessg) 2 | c 3 | c abstract 4 | c print the hollerith message in messg, of length messg, 5 | c on each file indicated by xgetua. 6 | c this version prints exactly the right number of characters, 7 | c not a number of words, and thus should work on machines 8 | c which do not blank fill the last word of the hollerith. 9 | c 10 | c ron jones, june 1980 11 | c 12 | integer f(10),g(14),lun(5) 13 | dimension messg(nmessg) 14 | data f(1),f(2),f(3),f(4),f(5),f(6),f(7),f(8),f(9),f(10) 15 | 1 / 1h( ,1h1 ,1hx ,1h, ,1h ,1h ,1ha ,1h ,1h ,1h) / 16 | data g(1),g(2),g(3),g(4),g(5),g(6),g(7),g(8),g(9),g(10) 17 | 1 / 1h( ,1h1 ,1hx ,1h ,1h ,1h ,1h ,1h ,1h ,1h / 18 | data g(11),g(12),g(13),g(14) 19 | 1 / 1h ,1h ,1h ,1h) / 20 | data la/1ha/,lcom/1h,/,lblank/1h / 21 | c prepare format for whole lines 22 | nchar = i1mach(6) 23 | nfield = 72/nchar 24 | call s88fmt(2,nfield,f(5)) 25 | call s88fmt(2,nchar,f(8)) 26 | c prepare format for last, partial line, if needed 27 | ncharl = nfield*nchar 28 | nlines = nmessg/ncharl 29 | nword = nlines*nfield 30 | nchrem = nmessg - nlines*ncharl 31 | if (nchrem.le.0) go to 40 32 | do 10 i=4,13 33 | 10 g(i) = lblank 34 | nfield = nchrem/nchar 35 | if (nfield.le.0) go to 20 36 | c prepare whole word fields 37 | g(4) = lcom 38 | call s88fmt(2,nfield,g(5)) 39 | g(7) = la 40 | call s88fmt(2,nchar,g(8)) 41 | 20 continue 42 | nchlst = mod(nchrem,nchar) 43 | if (nchlst.le.0) go to 30 44 | c prepare partial word field 45 | g(10) = lcom 46 | g(11) = la 47 | call s88fmt(2,nchlst,g(12)) 48 | 30 continue 49 | 40 continue 50 | c print the message 51 | nword1 = nword+1 52 | nword2 = (nmessg+nchar-1)/nchar 53 | call xgetua(lun,nunit) 54 | do 50 kunit = 1,nunit 55 | iunit = lun(kunit) 56 | if (iunit.eq.0) iunit = i1mach(4) 57 | if (nword.gt.0) write (iunit,f) (messg(i),i=1,nword) 58 | if (nchrem.gt.0) write (iunit,g) (messg(i),i=nword1,nword2) 59 | 50 continue 60 | return 61 | end 62 | -------------------------------------------------------------------------------- /External/QUADPACK/xerror.f: -------------------------------------------------------------------------------- 1 | subroutine xerror(messg,nmessg,nerr,level) 2 | c 3 | c abstract 4 | c xerror processes a diagnostic message, in a manner 5 | c determined by the value of level and the current value 6 | c of the library error control flag, kontrl. 7 | c (see subroutine xsetf for details.) 8 | c 9 | c description of parameters 10 | c --input-- 11 | c messg - the hollerith message to be processed, containing 12 | c no more than 72 characters. 13 | c nmessg- the actual number of characters in messg. 14 | c nerr - the error number associated with this message. 15 | c nerr must not be zero. 16 | c level - error category. 17 | c =2 means this is an unconditionally fatal error. 18 | c =1 means this is a recoverable error. (i.e., it is 19 | c non-fatal if xsetf has been appropriately called.) 20 | c =0 means this is a warning message only. 21 | c =-1 means this is a warning message which is to be 22 | c printed at most once, regardless of how many 23 | c times this call is executed. 24 | c 25 | c examples 26 | c call xerror(23hsmooth -- num was zero.,23,1,2) 27 | c call xerror(43hinteg -- less than full accuracy achieved., 28 | c 43,2,1) 29 | c call xerror(65hrooter -- actual zero of f found before interval 30 | c 1 fully collapsed.,65,3,0) 31 | c call xerror(39hexp -- underflows being set to zero.,39,1,-1) 32 | c 33 | c written by ron jones, with slatec common math library subcommittee 34 | c latest revision --- 7 feb 1979 35 | c 36 | dimension messg(nmessg) 37 | call xerrwv(messg,nmessg,nerr,level,0,0,0,0,0.,0.) 38 | return 39 | end 40 | -------------------------------------------------------------------------------- /External/QUADPACK/xgetua.f: -------------------------------------------------------------------------------- 1 | subroutine xgetua(iunit,n) 2 | c 3 | c abstract 4 | c xgetua may be called to determine the unit number or numbers 5 | c to which error messages are being sent. 6 | c these unit numbers may have been set by a call to xsetun, 7 | c or a call to xsetua, or may be a default value. 8 | c 9 | c description of parameters 10 | c --output-- 11 | c iunit - an array of one to five unit numbers, depending 12 | c on the value of n. a value of zero refers to the 13 | c default unit, as defined by the i1mach machine 14 | c constant routine. only iunit(1),...,iunit(n) are 15 | c defined by xgetua. the values of iunit(n+1),..., 16 | c iunit(5) are not defined (for n.lt.5) or altered 17 | c in any way by xgetua. 18 | c n - the number of units to which copies of the 19 | c error messages are being sent. n will be in the 20 | c range from 1 to 5. 21 | c 22 | c written by ron jones, with slatec common math library subcommittee 23 | c 24 | dimension iunit(5) 25 | n = j4save(5,0,.false.) 26 | do 30 i=1,n 27 | index = i+4 28 | if (i.eq.1) index = 3 29 | iunit(i) = j4save(index,0,.false.) 30 | 30 continue 31 | return 32 | end 33 | -------------------------------------------------------------------------------- /External/SLICOT/DG01NY.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE DG01NY( INDI, N, XR, XI ) 2 | C 3 | C SLICOT RELEASE 5.5. 4 | C 5 | C Copyright (c) 2002-2012 NICONET e.V. 6 | C 7 | C PURPOSE 8 | C 9 | C Auxiliary routine called only by DG01ND. 10 | C 11 | C For efficiency, no tests of the input scalar parameters are 12 | C performed. 13 | C 14 | C .. Parameters .. 15 | DOUBLE PRECISION ZERO, HALF, ONE, TWO, EIGHT 16 | PARAMETER ( ZERO=0.0D0, HALF=0.5D0, ONE = 1.0D0, 17 | $ TWO=2.0D0, EIGHT=8.0D0 ) 18 | C .. Scalar Arguments .. 19 | CHARACTER INDI 20 | INTEGER N 21 | C .. Array Arguments .. 22 | DOUBLE PRECISION XI(*), XR(*) 23 | C .. Local Scalars .. 24 | LOGICAL LINDI 25 | INTEGER I, J, N2 26 | DOUBLE PRECISION AI, AR, BI, BR, HELPI, HELPR, PI2, WHELP, WI, 27 | $ WR, WSTPI, WSTPR 28 | C .. External Functions .. 29 | LOGICAL LSAME 30 | EXTERNAL LSAME 31 | C .. Intrinsic Functions .. 32 | INTRINSIC ATAN, DBLE, SIN 33 | C .. Executable Statements .. 34 | C 35 | LINDI = LSAME( INDI, 'D' ) 36 | C 37 | C Initialisation. 38 | C 39 | PI2 = EIGHT*ATAN( ONE ) 40 | IF ( LINDI ) PI2 = -PI2 41 | C 42 | WHELP = PI2/DBLE( 2*N ) 43 | WSTPI = SIN( WHELP ) 44 | WHELP = SIN( HALF*WHELP ) 45 | WSTPR = -TWO*WHELP*WHELP 46 | WI = ZERO 47 | C 48 | IF ( LINDI ) THEN 49 | WR = ONE 50 | XR(N+1) = XR(1) 51 | XI(N+1) = XI(1) 52 | ELSE 53 | WR = -ONE 54 | END IF 55 | C 56 | C Recursion. 57 | C 58 | N2 = N/2 + 1 59 | DO 10 I = 1, N2 60 | J = N + 2 - I 61 | AR = XR(I) + XR(J) 62 | AI = XI(I) - XI(J) 63 | BR = XI(I) + XI(J) 64 | BI = XR(J) - XR(I) 65 | IF ( LINDI ) THEN 66 | AR = HALF*AR 67 | AI = HALF*AI 68 | BR = HALF*BR 69 | BI = HALF*BI 70 | END IF 71 | HELPR = WR*BR - WI*BI 72 | HELPI = WR*BI + WI*BR 73 | XR(I) = AR + HELPR 74 | XI(I) = AI + HELPI 75 | XR(J) = AR - HELPR 76 | XI(J) = HELPI - AI 77 | WHELP = WR 78 | WR = WR + WR*WSTPR - WI*WSTPI 79 | WI = WI + WI*WSTPR + WHELP*WSTPI 80 | 10 CONTINUE 81 | C 82 | RETURN 83 | C *** Last line of DG01NY *** 84 | END 85 | -------------------------------------------------------------------------------- /External/SLICOT/MA01AD.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE MA01AD( XR, XI, YR, YI ) 2 | C 3 | C SLICOT RELEASE 5.5. 4 | C 5 | C Copyright (c) 2002-2012 NICONET e.V. 6 | C 7 | C PURPOSE 8 | C 9 | C To compute the complex square root YR + i*YI of a complex number 10 | C XR + i*XI in real arithmetic. The returned result is so that 11 | C YR >= 0.0 and SIGN(YI) = SIGN(XI). 12 | C 13 | C ARGUMENTS 14 | C 15 | C Input/Output Parameters 16 | C 17 | C XR (input) DOUBLE PRECISION 18 | C XI (input) DOUBLE PRECISION 19 | C These scalars define the real and imaginary part of the 20 | C complex number of which the square root is sought. 21 | C 22 | C YR (output) DOUBLE PRECISION 23 | C YI (output) DOUBLE PRECISION 24 | C These scalars define the real and imaginary part of the 25 | C complex square root. 26 | C 27 | C METHOD 28 | C 29 | C The complex square root YR + i*YI of the complex number XR + i*XI 30 | C is computed in real arithmetic, taking care to avoid overflow. 31 | C 32 | C REFERENCES 33 | C 34 | C Adapted from EISPACK subroutine CSROOT. 35 | C 36 | C CONTRIBUTOR 37 | C 38 | C P. Benner, Universitaet Bremen, Germany, and 39 | C R. Byers, University of Kansas, Lawrence, USA, 40 | C Aug. 1998, routine DCROOT. 41 | C V. Sima, Research Institute for Informatics, Bucharest, Romania, 42 | C Oct. 1998, SLICOT Library version. 43 | C 44 | C REVISIONS 45 | C 46 | C - 47 | C 48 | C ****************************************************************** 49 | C 50 | C .. Parameters .. 51 | DOUBLE PRECISION ZERO, HALF 52 | PARAMETER ( ZERO = 0.0D0, HALF = 1.0D0/2.0D0 ) 53 | C .. 54 | C .. Scalar Arguments .. 55 | DOUBLE PRECISION XR, XI, YR, YI 56 | C .. 57 | C .. Local Scalars .. 58 | DOUBLE PRECISION S 59 | C .. 60 | C .. External Functions .. 61 | DOUBLE PRECISION DLAPY2 62 | EXTERNAL DLAPY2 63 | C 64 | C .. Intrinsic functions .. 65 | INTRINSIC ABS, SQRT 66 | C .. 67 | C .. Executable Statements .. 68 | C 69 | S = SQRT( HALF*( DLAPY2( XR, XI ) + ABS( XR ) ) ) 70 | IF ( XR.GE.ZERO ) YR = S 71 | IF ( XI.LT.ZERO ) S = -S 72 | IF ( XR.LE.ZERO ) THEN 73 | YI = S 74 | IF ( XR.LT.ZERO ) YR = HALF*( XI/S ) 75 | ELSE 76 | YI = HALF*( XI/YR ) 77 | END IF 78 | C 79 | RETURN 80 | C *** Last line of MA01AD *** 81 | END 82 | -------------------------------------------------------------------------------- /External/SLICOT/MA02ED.f: -------------------------------------------------------------------------------- 1 | SUBROUTINE MA02ED( UPLO, N, A, LDA ) 2 | C 3 | C SLICOT RELEASE 5.5. 4 | C 5 | C Copyright (c) 2002-2012 NICONET e.V. 6 | C 7 | C PURPOSE 8 | C 9 | C To store by symmetry the upper or lower triangle of a symmetric 10 | C matrix, given the other triangle. 11 | C 12 | C ARGUMENTS 13 | C 14 | C Mode Parameters 15 | C 16 | C UPLO CHARACTER*1 17 | C Specifies which part of the matrix is given as follows: 18 | C = 'U': Upper triangular part; 19 | C = 'L': Lower triangular part. 20 | C For all other values, the array A is not referenced. 21 | C 22 | C Input/Output Parameters 23 | C 24 | C N (input) INTEGER 25 | C The order of the matrix A. N >= 0. 26 | C 27 | C A (input/output) DOUBLE PRECISION array, dimension (LDA,N) 28 | C On entry, the leading N-by-N upper triangular part 29 | C (if UPLO = 'U'), or lower triangular part (if UPLO = 'L'), 30 | C of this array must contain the corresponding upper or 31 | C lower triangle of the symmetric matrix A. 32 | C On exit, the leading N-by-N part of this array contains 33 | C the symmetric matrix A with all elements stored. 34 | C 35 | C LDA INTEGER 36 | C The leading dimension of the array A. LDA >= max(1,N). 37 | C 38 | C CONTRIBUTOR 39 | C 40 | C V. Sima, Research Institute for Informatics, Bucharest, Romania, 41 | C Oct. 1998. 42 | C 43 | C REVISIONS 44 | C 45 | C - 46 | C 47 | C ****************************************************************** 48 | C 49 | C .. Scalar Arguments .. 50 | CHARACTER UPLO 51 | INTEGER LDA, N 52 | C .. Array Arguments .. 53 | DOUBLE PRECISION A(LDA,*) 54 | C .. Local Scalars .. 55 | INTEGER J 56 | C .. External Functions .. 57 | LOGICAL LSAME 58 | EXTERNAL LSAME 59 | C .. External Subroutines .. 60 | EXTERNAL DCOPY 61 | C 62 | C .. Executable Statements .. 63 | C 64 | C For efficiency reasons, the parameters are not checked for errors. 65 | C 66 | IF( LSAME( UPLO, 'L' ) ) THEN 67 | C 68 | C Construct the upper triangle of A. 69 | C 70 | DO 20 J = 2, N 71 | CALL DCOPY( J-1, A(J,1), LDA, A(1,J), 1 ) 72 | 20 CONTINUE 73 | C 74 | ELSE IF( LSAME( UPLO, 'U' ) ) THEN 75 | C 76 | C Construct the lower triangle of A. 77 | C 78 | DO 40 J = 2, N 79 | CALL DCOPY( J-1, A(1,J), 1, A(J,1), LDA ) 80 | 40 CONTINUE 81 | C 82 | END IF 83 | RETURN 84 | C *** Last line of MA02ED *** 85 | END 86 | -------------------------------------------------------------------------------- /External/SLICOT/MB03MY.f: -------------------------------------------------------------------------------- 1 | DOUBLE PRECISION FUNCTION MB03MY( NX, X, INCX ) 2 | C 3 | C SLICOT RELEASE 5.5. 4 | C 5 | C Copyright (c) 2002-2012 NICONET e.V. 6 | C 7 | C PURPOSE 8 | C 9 | C To compute the absolute minimal value of NX elements in an array. 10 | C The function returns the value zero if NX < 1. 11 | C 12 | C ARGUMENTS 13 | C 14 | C NX (input) INTEGER 15 | C The number of elements in X to be examined. 16 | C 17 | C X (input) DOUBLE PRECISION array, dimension (NX * INCX) 18 | C The one-dimensional array of which the absolute minimal 19 | C value of the elements is to be computed. 20 | C This array is not referenced if NX < 1. 21 | C 22 | C INCX (input) INTEGER 23 | C The increment to be taken in the array X, defining the 24 | C distance between two consecutive elements. INCX >= 1. 25 | C INCX = 1, if all elements are contiguous in memory. 26 | C 27 | C NUMERICAL ASPECTS 28 | C 29 | C None. 30 | C 31 | C CONTRIBUTOR 32 | C 33 | C Release 3.0: V. Sima, Katholieke Univ. Leuven, Belgium, Mar. 1997. 34 | C Supersedes Release 2.0 routine MB03AZ by S. Van Huffel, Katholieke 35 | C University, Leuven, Belgium. 36 | C 37 | C REVISIONS 38 | C 39 | C June 16, 1997. 40 | C 41 | C KEYWORDS 42 | C 43 | C None. 44 | C 45 | C ****************************************************************** 46 | C 47 | C .. Parameters .. 48 | DOUBLE PRECISION ZERO 49 | PARAMETER ( ZERO = 0.0D0 ) 50 | C .. Scalar Arguments .. 51 | INTEGER INCX, NX 52 | C .. Array Arguments .. 53 | DOUBLE PRECISION X(*) 54 | C .. Local Scalars .. 55 | INTEGER I 56 | DOUBLE PRECISION DX 57 | C .. Intrinsic Functions .. 58 | INTRINSIC ABS 59 | C .. Executable Statements .. 60 | C 61 | C Quick return if possible. 62 | C 63 | IF ( NX.LE.0 ) THEN 64 | MB03MY = ZERO 65 | RETURN 66 | END IF 67 | C 68 | MB03MY = ABS( X(1) ) 69 | C 70 | DO 20 I = 1+INCX, NX*INCX, INCX 71 | DX = ABS( X(I) ) 72 | IF ( DX.LT.MB03MY ) MB03MY = DX 73 | 20 CONTINUE 74 | C 75 | RETURN 76 | C *** Last line of MB03MY *** 77 | END 78 | -------------------------------------------------------------------------------- /External/SLICOT/SB02CX.f: -------------------------------------------------------------------------------- 1 | LOGICAL FUNCTION SB02CX( REIG, IEIG ) 2 | C 3 | C SLICOT RELEASE 5.5. 4 | C 5 | C Copyright (c) 2002-2012 NICONET e.V. 6 | C 7 | C PURPOSE 8 | C 9 | C To select the purely imaginary eigenvalues in computing the 10 | C H-infinity norm of a system. 11 | C 12 | C ARGUMENTS 13 | C 14 | C Input/Output Parameters 15 | C 16 | C REIG (input) DOUBLE PRECISION 17 | C The real part of the current eigenvalue considered. 18 | C 19 | C IEIG (input) DOUBLE PRECISION 20 | C The imaginary part of the current eigenvalue considered. 21 | C 22 | C METHOD 23 | C 24 | C The function value SB02CX is set to .TRUE. for a purely imaginary 25 | C eigenvalue and to .FALSE., otherwise. 26 | C 27 | C REFERENCES 28 | C 29 | C None. 30 | C 31 | C NUMERICAL ASPECTS 32 | C 33 | C None. 34 | C 35 | C CONTRIBUTOR 36 | C 37 | C P. Hr. Petkov, Technical University of Sofia, May, 1999. 38 | C 39 | C REVISIONS 40 | C 41 | C P. Hr. Petkov, Technical University of Sofia, Oct. 2000. 42 | C 43 | C KEYWORDS 44 | C 45 | C H-infinity norm, robust control. 46 | C 47 | C ****************************************************************** 48 | C 49 | C .. Parameters .. 50 | DOUBLE PRECISION HUNDRD 51 | PARAMETER ( HUNDRD = 100.0D+0 ) 52 | C .. 53 | C .. Scalar Arguments .. 54 | DOUBLE PRECISION IEIG, REIG 55 | C .. 56 | C .. Local Scalars .. 57 | DOUBLE PRECISION EPS, TOL 58 | C .. 59 | C .. External Functions .. 60 | DOUBLE PRECISION DLAMCH 61 | EXTERNAL DLAMCH 62 | C .. 63 | C .. Intrinsic Functions .. 64 | INTRINSIC ABS 65 | C .. 66 | C .. Executable Statements .. 67 | C 68 | C Get the machine precision. 69 | C 70 | EPS = DLAMCH( 'Epsilon' ) 71 | C 72 | C Set the tolerance in the determination of the purely 73 | C imaginary eigenvalues. 74 | C 75 | TOL = HUNDRD*EPS 76 | SB02CX = ABS( REIG ).LT.TOL 77 | C 78 | RETURN 79 | C *** Last line of SB02CX *** 80 | END 81 | -------------------------------------------------------------------------------- /External/SLICOT/SB02MR.f: -------------------------------------------------------------------------------- 1 | LOGICAL FUNCTION SB02MR( REIG, IEIG ) 2 | C 3 | C SLICOT RELEASE 5.5. 4 | C 5 | C Copyright (c) 2002-2012 NICONET e.V. 6 | C 7 | C PURPOSE 8 | C 9 | C To select the unstable eigenvalues for solving the continuous-time 10 | C algebraic Riccati equation. 11 | C 12 | C ARGUMENTS 13 | C 14 | C Input/Output Parameters 15 | C 16 | C REIG (input) DOUBLE PRECISION 17 | C The real part of the current eigenvalue considered. 18 | C 19 | C IEIG (input) DOUBLE PRECISION 20 | C The imaginary part of the current eigenvalue considered. 21 | C 22 | C METHOD 23 | C 24 | C The function value SB02MR is set to .TRUE. for an unstable 25 | C eigenvalue and to .FALSE., otherwise. 26 | C 27 | C REFERENCES 28 | C 29 | C None. 30 | C 31 | C NUMERICAL ASPECTS 32 | C 33 | C None. 34 | C 35 | C CONTRIBUTOR 36 | C 37 | C V. Sima, Katholieke Univ. Leuven, Belgium, Aug. 1997. 38 | C 39 | C REVISIONS 40 | C 41 | C - 42 | C 43 | C KEYWORDS 44 | C 45 | C Algebraic Riccati equation, closed loop system, continuous-time 46 | C system, optimal regulator, Schur form. 47 | C 48 | C ****************************************************************** 49 | C 50 | C .. Parameters .. 51 | DOUBLE PRECISION ZERO 52 | PARAMETER ( ZERO = 0.0D0 ) 53 | C .. Scalar Arguments .. 54 | DOUBLE PRECISION IEIG, REIG 55 | C .. Executable Statements .. 56 | C 57 | SB02MR = REIG.GE.ZERO 58 | C 59 | RETURN 60 | C *** Last line of SB02MR *** 61 | END 62 | -------------------------------------------------------------------------------- /External/SLICOT/SB02MS.f: -------------------------------------------------------------------------------- 1 | LOGICAL FUNCTION SB02MS( REIG, IEIG ) 2 | C 3 | C SLICOT RELEASE 5.5. 4 | C 5 | C Copyright (c) 2002-2012 NICONET e.V. 6 | C 7 | C PURPOSE 8 | C 9 | C To select the unstable eigenvalues for solving the discrete-time 10 | C algebraic Riccati equation. 11 | C 12 | C ARGUMENTS 13 | C 14 | C Input/Output Parameters 15 | C 16 | C REIG (input) DOUBLE PRECISION 17 | C The real part of the current eigenvalue considered. 18 | C 19 | C IEIG (input) DOUBLE PRECISION 20 | C The imaginary part of the current eigenvalue considered. 21 | C 22 | C METHOD 23 | C 24 | C The function value SB02MS is set to .TRUE. for an unstable 25 | C eigenvalue (i.e., with modulus greater than or equal to one) and 26 | C to .FALSE., otherwise. 27 | C 28 | C REFERENCES 29 | C 30 | C None. 31 | C 32 | C NUMERICAL ASPECTS 33 | C 34 | C None. 35 | C 36 | C CONTRIBUTOR 37 | C 38 | C V. Sima, Katholieke Univ. Leuven, Belgium, Aug. 1997. 39 | C 40 | C REVISIONS 41 | C 42 | C - 43 | C 44 | C KEYWORDS 45 | C 46 | C Algebraic Riccati equation, closed loop system, discrete-time 47 | C system, optimal regulator, Schur form. 48 | C 49 | C ****************************************************************** 50 | C 51 | C .. Parameters .. 52 | DOUBLE PRECISION ONE 53 | PARAMETER ( ONE = 1.0D0 ) 54 | C .. Scalar Arguments .. 55 | DOUBLE PRECISION IEIG, REIG 56 | C .. External Functions .. 57 | DOUBLE PRECISION DLAPY2 58 | EXTERNAL DLAPY2 59 | C .. Executable Statements .. 60 | C 61 | SB02MS = DLAPY2( REIG, IEIG ).GE.ONE 62 | C 63 | RETURN 64 | C *** Last line of SB02MS *** 65 | END 66 | -------------------------------------------------------------------------------- /External/SLICOT/SB02MV.f: -------------------------------------------------------------------------------- 1 | LOGICAL FUNCTION SB02MV( REIG, IEIG ) 2 | C 3 | C SLICOT RELEASE 5.5. 4 | C 5 | C Copyright (c) 2002-2012 NICONET e.V. 6 | C 7 | C PURPOSE 8 | C 9 | C To select the stable eigenvalues for solving the continuous-time 10 | C algebraic Riccati equation. 11 | C 12 | C ARGUMENTS 13 | C 14 | C Input/Output Parameters 15 | C 16 | C REIG (input) DOUBLE PRECISION 17 | C The real part of the current eigenvalue considered. 18 | C 19 | C IEIG (input) DOUBLE PRECISION 20 | C The imaginary part of the current eigenvalue considered. 21 | C 22 | C METHOD 23 | C 24 | C The function value SB02MV is set to .TRUE. for a stable eigenvalue 25 | C and to .FALSE., otherwise. 26 | C 27 | C REFERENCES 28 | C 29 | C None. 30 | C 31 | C NUMERICAL ASPECTS 32 | C 33 | C None. 34 | C 35 | C CONTRIBUTOR 36 | C 37 | C V. Sima, Katholieke Univ. Leuven, Belgium, Aug. 1997. 38 | C 39 | C REVISIONS 40 | C 41 | C - 42 | C 43 | C KEYWORDS 44 | C 45 | C Algebraic Riccati equation, closed loop system, continuous-time 46 | C system, optimal regulator, Schur form. 47 | C 48 | C ****************************************************************** 49 | C 50 | C .. Parameters .. 51 | DOUBLE PRECISION ZERO 52 | PARAMETER ( ZERO = 0.0D0 ) 53 | C .. Scalar Arguments .. 54 | DOUBLE PRECISION IEIG, REIG 55 | C .. Executable Statements .. 56 | C 57 | SB02MV = REIG.LT.ZERO 58 | C 59 | RETURN 60 | C *** Last line of SB02MV *** 61 | END 62 | -------------------------------------------------------------------------------- /External/SLICOT/SB02MW.f: -------------------------------------------------------------------------------- 1 | LOGICAL FUNCTION SB02MW( REIG, IEIG ) 2 | C 3 | C SLICOT RELEASE 5.5. 4 | C 5 | C Copyright (c) 2002-2012 NICONET e.V. 6 | C 7 | C PURPOSE 8 | C 9 | C To select the stable eigenvalues for solving the discrete-time 10 | C algebraic Riccati equation. 11 | C 12 | C ARGUMENTS 13 | C 14 | C Input/Output Parameters 15 | C 16 | C REIG (input) DOUBLE PRECISION 17 | C The real part of the current eigenvalue considered. 18 | C 19 | C IEIG (input) DOUBLE PRECISION 20 | C The imaginary part of the current eigenvalue considered. 21 | C 22 | C METHOD 23 | C 24 | C The function value SB02MW is set to .TRUE. for a stable 25 | C eigenvalue (i.e., with modulus less than one) and to .FALSE., 26 | C otherwise. 27 | C 28 | C REFERENCES 29 | C 30 | C None. 31 | C 32 | C NUMERICAL ASPECTS 33 | C 34 | C None. 35 | C 36 | C CONTRIBUTOR 37 | C 38 | C V. Sima, Katholieke Univ. Leuven, Belgium, Aug. 1997. 39 | C 40 | C REVISIONS 41 | C 42 | C - 43 | C 44 | C KEYWORDS 45 | C 46 | C Algebraic Riccati equation, closed loop system, discrete-time 47 | C system, optimal regulator, Schur form. 48 | C 49 | C ****************************************************************** 50 | C 51 | C .. Parameters .. 52 | DOUBLE PRECISION ONE 53 | PARAMETER ( ONE = 1.0D0 ) 54 | C .. Scalar Arguments .. 55 | DOUBLE PRECISION IEIG, REIG 56 | C .. External Functions .. 57 | DOUBLE PRECISION DLAPY2 58 | EXTERNAL DLAPY2 59 | C .. Executable Statements .. 60 | C 61 | SB02MW = DLAPY2( REIG, IEIG ).LT.ONE 62 | C 63 | RETURN 64 | C *** Last line of SB02MW *** 65 | END 66 | -------------------------------------------------------------------------------- /External/SLICOT/dcabs1.f: -------------------------------------------------------------------------------- 1 | DOUBLE PRECISION FUNCTION DCABS1(Z) 2 | * .. Scalar Arguments .. 3 | DOUBLE COMPLEX Z 4 | * .. 5 | * .. 6 | * Purpose 7 | * ======= 8 | * 9 | * DCABS1 computes absolute value of a double complex number 10 | * 11 | * .. Intrinsic Functions .. 12 | INTRINSIC ABS,DBLE,DIMAG 13 | * 14 | DCABS1 = ABS(DBLE(Z)) + ABS(DIMAG(Z)) 15 | RETURN 16 | END 17 | -------------------------------------------------------------------------------- /External/SLICOT/delctg.f: -------------------------------------------------------------------------------- 1 | LOGICAL FUNCTION DELCTG( PAR1, PAR2, PAR3 ) 2 | C 3 | C SLICOT RELEASE 5.5. 4 | C 5 | C Copyright (c) 2002-2012 NICONET e.V. 6 | C 7 | C PURPOSE 8 | C 9 | C Void logical function for DGGES. 10 | C 11 | DOUBLE PRECISION PAR1, PAR2, PAR3 12 | C 13 | DELCTG = .TRUE. 14 | RETURN 15 | END 16 | -------------------------------------------------------------------------------- /Guidance/Macros.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __MACROS_H__ 3 | #define __MACROS_H__ 4 | 5 | //File granularity version. 6 | #ifndef MACROS_VERSION_MAJOR 7 | #define MACROS_VERSION_MAJOR 1 8 | #endif 9 | 10 | #ifndef MACROS_VERSION_MINOR 11 | #define MACROS_VERSION_MINOR 0 12 | #endif 13 | 14 | #ifndef MACROS_PATCH_VERSION 15 | #define MACROS_PATCH_VERSION 0 16 | #endif 17 | 18 | #ifndef MACROS_CREATE_DATE 19 | #define MACROS_CREATE_DATE "Date: 2016-09-17 Time: 15:38 PM GMT+2" 20 | #endif 21 | 22 | // Set this value to successful build date/time. 23 | #ifndef MACROS_BUILD_DATE 24 | #define MACROS_BUILD_DATE "" 25 | #endif 26 | 27 | #include "SlicotAB01ND.h" 28 | #include "SlicotAB01OD.h" 29 | 30 | using namespace guidance::slicot_wrappers; 31 | 32 | // This parametrized macros is expanded to AB01ND Constructor call. 33 | 34 | #define CONSTRUCT_AB01ND_1(JOBZ,N,M,LDA,LDB,NCONT,INDCON,LDZ,TOL,LDWORK,INFO) F77_AB01ND<> obj{JOBZ,N,M,LDA,LDB,NCONT, \ 35 | INDCON, LDZ, TOL, LDWORK, INFO}; 36 | 37 | #define CONSTRUCT_AB01ND_2(JOBZ,N,M,LDA,A,LDB,B,NCONT,INDCON,LDZ,TOL,LDWORK,INFO) F77_AB01ND<> obj2{JOBZ,N,M,LDA,A,LDB,B,NCONT,\ 38 | INDCON, LDZ, TOL, LDWORK, INFO}; 39 | 40 | #define CONSTRUCT_INIT_AB01ND_1(JOBZ,N,M,LDA,A,LDB,B,NCONT,INDCON,LDZ,TOL,LDWORK,INFO) \ 41 | F77_AB01ND<> obj3{JOBZ,N,M,LDA,LDB,NCONT,INDCON,LDZ,TOL,LDWORK,INFO}; \ 42 | obj3.init_input_arrays(A,B) \ 43 | 44 | #endif /*__MACROS_H__*/ -------------------------------------------------------------------------------- /Guidance/SIMD_support.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SIMD_SUPPORT_H__ 3 | #define __SIMD_SUPPORT_H__ 4 | 5 | // File version granularity 6 | #if !defined(SIMD_SUPPORT_VERSION_MAJOR) 7 | #define SIMD_SUPPORT_VERSION_MAJOR 1 8 | #endif 9 | 10 | #if !defined(SIMD_SUPPORT_VERSION_MINOR) 11 | #define SIMD_SUPPORT_VERSION_MINOR 0 12 | #endif 13 | 14 | #if !defined(SIMD_SUPPORT_PATCH_VERSION) 15 | #define SIMD_SUPPORT_PATCH_VERSION 0 16 | #endif 17 | 18 | #if !defined(SIMD_SUPPORT_CREATE_DATE) 19 | #define SIMD_SUPPORT_CREATE_DATE "Date: 2016-09-12 Time: 18:16 PM GMT + 2" 20 | #endif 21 | 22 | // Set this value to successful build date/time. 23 | #if !defined(SIMD_SUPPORT_BUILD_DATE) 24 | #define SIMD_SUPPORT_BUILD_DATE "" 25 | #endif 26 | 27 | /* Determine SIMD architecture ISA set 28 | and its corresponding intrinsic sets. 29 | */ 30 | 31 | 32 | #if !defined SIMDISA 33 | #if defined (__AVX512__) || defined (__AVX512CD__) || defined (__AVX512DQ__) \ 34 | || defined (__AVX512ER__) || defined (__AVX512F__) || defined (__AVXPF__) 35 | #defined SIMDISA 9 36 | #elif defined (__AVX2__) 37 | #define SIMDISA 8 38 | #elif defined (__AVX__) 39 | #define SIMDISA 7 40 | #elif defined (__SSE4_2__) 41 | #define SIMDISA 6 42 | #elif defined (__SSE4__) 43 | #define SIMDISA 5 44 | #elif defined (__SSSE3__) 45 | #define SIMDISA 4 46 | #elif defined (__SSE3__) 47 | define SIMDISA 3 48 | #elif defined (__SSE2__) 49 | #define SIMDISA 2 50 | #elif defined (__SSE__) 51 | #define SIMDISA 1 52 | #elif defined (_M_IX86_FP) 53 | #define SIMDISA _M_IX86_FP 54 | #else 55 | #define SIMDISA 0 56 | #endif 57 | #endif 58 | 59 | #if defined __INTEL_COMPILER 60 | #if SIMDISA > 8 61 | #include 62 | #elif SIMDISA == 8 63 | #include 64 | #elif SIMDISA == 7 65 | #include 66 | #elif SIMDISA == 6 67 | #include 68 | #elif SIMDISA == 5 69 | #include 70 | #elif SIMDISA == 4 71 | #include 72 | #elif SIMDISA == 3 73 | #include 74 | #elif SIMDISA == 2 75 | #include 76 | #elif defined _MSC_VER 77 | #include 78 | #else 79 | #error "Unsuported compiler detected." 80 | #endif 81 | #endif 82 | 83 | 84 | 85 | #endif /*__SIMD_SUPPORT_H__*/ -------------------------------------------------------------------------------- /Guidance/SlicotAB01MD.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SLICOT_AB01MD_H__ 3 | #define __SLICOT_AB01MD_H__ 4 | 5 | // File version granularity. 6 | #ifndef SLICOT_AB01MD_VERSION_MAJOR 7 | #define SLICOT_AB01MD_VERSION_MAJOR 1 8 | #endif 9 | 10 | #ifndef SLICOT_AB01MD_VERSION_MINOR 11 | #define SLICOT_AB01MD_VERSION_MINOR 0 12 | #endif 13 | 14 | #ifndef SLICOT_AB01MD_PATCH_VERSION 15 | #define SLICOT_AB01MD_PATCH_VERSION 0 16 | #endif 17 | 18 | #ifndef SLICOT_AB01MD_CREATE_DATE 19 | #define SLICOT_AB01MD_CREATE_DATE "Date: 2016-09-13 Time: 18:27 PM GMT+2" 20 | #endif 21 | 22 | #ifndef SLICOT_AB01MD_BUILD_DATE 23 | #define SLICOT_AB01MD_BUILD_DATE " " 24 | #endif 25 | 26 | #include "Slicot_F77_Interface.h" 27 | #include 28 | #include 29 | #include 30 | 31 | namespace guidance { 32 | namespace slicot_wrappers { 33 | 34 | 35 | struct F77_AB01MD { 36 | 37 | F77_AB01MD(_In_ const unsigned char JOBZ, 38 | _In_ const int N, 39 | _In_ const int LDA, 40 | _In_ const int NCONT, 41 | _In_ const int LDZ, 42 | _In_ const double TOL, 43 | _In_ const int LDWORK, 44 | _In_ const int INFO) 45 | : 46 | m_JOBZ{ JOBZ }, 47 | m_N{ N }, 48 | m_LDA{ LDA }, 49 | m_A(m_LDA * m_N), 50 | m_B(m_N), 51 | m_NCONT{ NCONT }, 52 | m_LDZ{ LDZ }, 53 | m_Z(m_LDZ * m_N), 54 | m_TAU(m_N), 55 | m_TOL{ TOL }, 56 | m_LDWORK{ LDWORK }, 57 | m_DWORK(m_LDWORK), 58 | m_INFO{ INFO } {} 59 | 60 | 61 | void Call_AB01MD() { 62 | 63 | AB01MD(&this->m_JOBZ, &this->m_N, &this->m_A[0], &this->m_LDA, &this->m_B[0], 64 | &this->m_NCONT, &this->m_Z[0], &this->m_LDZ, &this->m_TAU[0], &this->m_TOL, 65 | &this->m_DWORK[0], &this->m_LDWORK, &this->m_INFO); 66 | } 67 | 68 | unsigned char m_JOBZ; 69 | 70 | _In_ int m_N; 71 | 72 | _In_ int m_LDA; 73 | 74 | _Inout_ VF64 m_A; 75 | 76 | _Inout_ VF64 m_B; 77 | 78 | _Out_ int m_NCONT; 79 | 80 | _In_ int m_LDZ; 81 | 82 | _Out_ VF64 m_Z; 83 | 84 | _Out_ VF64 m_TAU; 85 | 86 | double m_TOL; 87 | 88 | int m_LDWORK; 89 | 90 | VF64 m_DWORK; 91 | 92 | int m_INFO; 93 | 94 | }; 95 | 96 | 97 | /* 98 | 99 | */ 100 | } 101 | } 102 | 103 | #endif /*__SLICOT_ABO1MD_H__*/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 bgin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /MathLib/Include/CartesianCoordSys.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _CARTESIAN_COORD_SYSTEM_HPP_ 2 | #define _CARTESIAN_COORD_SYSTEM_HPP_ 0x1 3 | 4 | 5 | #include "MathLibDefinitions.h" 6 | 7 | 8 | namespace mathlib { 9 | 10 | /* 11 | Earth reference frame. 12 | */ 13 | 14 | template class EarthRefFrame { 15 | 16 | 17 | 18 | 19 | public: 20 | 21 | /* 22 | @brief Default Ctor. 23 | */ 24 | EarthRefFrame() noexept(true) = default; 25 | 26 | /* 27 | @brief "Main" class Ctor. 28 | */ 29 | EarthRefFrame(_In_ const Vector &v1, _In_ const Vector &v2) : 30 | m_oV1{ v1 }, m_oV2{ v2 } { 31 | 32 | this->m_oV3.operator=( Vector.cross(m_oV1, m_oV2)); 33 | } 34 | 35 | /* 36 | @brief Copy-Ctor 37 | */ 38 | EarthRefFrame(_In_ const EarthRefFrame &rhs) : 39 | m_oV1{ rhs.m_oV1 }, 40 | m_oV2{ rhs.m_oV2 }, 41 | m_oV3{ rhs.m_oV3 } 42 | {} 43 | 44 | /* 45 | @brief Move-Ctor. 46 | */ 47 | EarthRefFrame(_In_ EarthRefFrame &&rhs) : 48 | m_oV1{ std::move(rhs.m_oV1) }, 49 | m_oV2{ std::move(rhs.m_oV2) }, 50 | m_oV3{ std::move(rhs.m_oV3) } 51 | {} 52 | 53 | /* 54 | @brief Default Dtor 55 | */ 56 | ~EarthRefFrame() noexcept(true) = default; 57 | 58 | 59 | /* 60 | @brief *this = rhs (copy) 61 | */ 62 | auto operator=(_In_ const EarthRefFrame &rhs)->EarthRefFrame & { 63 | 64 | if (this == &rhs) return (*this); 65 | this->m_oV1.operator=(rhs.m_oV1); 66 | this->m_oV2.operator=(rhs.m_oV2); 67 | this->m_oV3.operator=(rhs.m_oV3); 68 | return (*this); 69 | } 70 | 71 | /* 72 | @brief *this = rhs (move) 73 | */ 74 | auto operator=(_In_ EarthRefFrame &&rhs)->EarthRefFrame & { 75 | 76 | if (this == &rhs) return (*this); 77 | this->m_oV1.operator(std::move(rhs.m_oV1)); 78 | this->m_oV2.operator(std::move(rhs.m_oV2)); 79 | this->m_oV3.operator(std::move(rhs.m_oV3)); 80 | return (*this); 81 | } 82 | 83 | /* 84 | @brief ostream& operator<< 85 | */ 86 | 87 | 88 | private: 89 | 90 | /* 91 | @brief component v1 of the coordinate system. 92 | */ 93 | Vector m_oV1; 94 | 95 | /* 96 | @brief component v2 of the coordinate system. 97 | */ 98 | Vector m_oV2; 99 | 100 | /* 101 | @brief component v3 of the coordinate system. 102 | */ 103 | Vector m_oV3; 104 | }; 105 | } 106 | #endif /*_CARTESIAN_COORD_SYSTEM_HPP_*/ -------------------------------------------------------------------------------- /MathLib/Include/Derivative.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _DERIVATIVE_H_ 3 | #define _DERIVATIVE_H_ 4 | 5 | #include "MathUtils.h" 6 | #include 7 | 8 | namespace mathlib 9 | { 10 | 11 | template class DyDx 12 | { 13 | public: 14 | 15 | template __forceinline static DyDx differentiate(Function, _Ty, _Ty); 16 | 17 | template __forceinline static DyDx differentiate2(Function, _Ty,_Ty); 18 | 19 | __forceinline _Ty get_deriv() const; 20 | 21 | __forceinline _Ty get_error() const; 22 | 23 | //__forceinline static DyDx test1(const _Ty, const _Ty); 24 | private: 25 | 26 | _Ty deriv; 27 | _Ty error; 28 | 29 | __forceinline DyDx(const _Ty, const _Ty); 30 | }; 31 | 32 | #include "Derivative.inl" 33 | } 34 | #endif /*_DERIVATIVE_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Derivative.inl: -------------------------------------------------------------------------------- 1 | 2 | template __forceinline mathlib::DyDx<_Ty>::DyDx(const _Ty der, const _Ty err) : deriv(der), error(err) 3 | { 4 | 5 | } 6 | 7 | template __forceinline _Ty mathlib::DyDx<_Ty>::get_deriv() const 8 | { 9 | return this->deriv; 10 | } 11 | 12 | template __forceinline _Ty mathlib::DyDx<_Ty>::get_error() const 13 | { 14 | return this->error; 15 | } 16 | 17 | /*template __forceinline mathlib::DyDx<_Ty> mathlib::DyDx<_Ty>::test1(const _Ty arg1, const _Ty arg2) 18 | { 19 | return mathlib::DyDx<_Ty>(arg1, arg2); 20 | }*/ 21 | 22 | 23 | template template __forceinline mathlib::DyDx<_Ty> mathlib::DyDx<_Ty>::differentiate(Function f, _Ty x, _Ty h) 24 | { 25 | const int numtabs = 10; 26 | const double con = 1.4L, con2 = (con * con); 27 | const double big_val = DBL_MAX; 28 | const double safe_val = 2.0L; 29 | _Ty error, derivative, errort; 30 | double hh, fac; 31 | _Ty **a = mathlib::AllocateVec2D<_Ty>::allocate2D(numtabs, numtabs); 32 | if (a == nullptr) throw std::runtime_error("Failed to allocate memory for array a\n"); 33 | 34 | if (h == 0.0) throw std::runtime_error("h cannot be zero\n"); 35 | 36 | 37 | 38 | hh = h; 39 | a[0][0] = (f(x + hh) - f(x - hh)) / (2.0L * hh); 40 | //std::printf("a[0][0] = %.15f\n", a[0][0]); 41 | error = big_val; 42 | for (auto i = 1; i < numtabs; ++i) 43 | { 44 | hh /= con; 45 | a[0][i] = (f(x + hh) - f(x - hh)) / (2.0L*hh); 46 | //std::printf("a[0][%d]=%.15f\n", i, a[0][i]); 47 | fac = con2; 48 | for (auto j = 1; j <= i; ++j) 49 | { 50 | a[j][i] = (a[j - 1][i] * fac - a[j - 1][i - 1]) / (fac - 1.0); 51 | //std::printf("a[%d][%d]=%.15f\n", j, i, a[j][i]); 52 | fac = con2*fac; 53 | errort = std::fmax(fabs(a[j][i] - a[j - 1][i]), fabs(a[j][i] - a[j - 1][i - 1])); 54 | if (errort <= error) 55 | { 56 | error = errort; 57 | derivative = a[j][i]; 58 | } 59 | } 60 | if (fabs(a[i][i] - a[i - 1][i - 1]) >= safe_val * error) break; 61 | } 62 | 63 | mathlib::AllocateVec2D<_Ty>::deallocate2D(a); 64 | 65 | return mathlib::DyDx<_Ty>(derivative, error); 66 | } 67 | 68 | template template __forceinline mathlib::DyDx<_Ty> mathlib::DyDx<_Ty>::differentiate2(Function f, 69 | _Ty x,_Ty h) 70 | { 71 | if (std::fabs(h) < std::numeric_limits<_Ty>::epsilon()) throw std::runtime_error("h cannot be 0.0 in differentiate2\n"); 72 | 73 | //_Ty temp = x + h; 74 | // h = temp - x; 75 | h = std::sqrt(std::numeric_limits<_Ty>::epsilon()) * (std::fabs(x) + std::sqrt(std::numeric_limits<_Ty>::epsilon())); 76 | _Ty ans = (f(x + h) - f(x - h)) / (2.0L * h); 77 | _Ty err = std::numeric_limits::epsilon() * std::fabs((f(x) / h)); 78 | 79 | return mathlib::DyDx<_Ty>(ans, err); 80 | } -------------------------------------------------------------------------------- /MathLib/Include/DerivativeAVX.h: -------------------------------------------------------------------------------- 1 | #ifndef _DERIVATIVE_AVX_H_ 2 | #define _DERIVATIVE_AVX_H_ 3 | #include "MathLibDefinitions.h" 4 | 5 | namespace mathlib 6 | { 7 | 8 | class DyDxAVX 9 | { 10 | 11 | public: 12 | 13 | template __forceinline static DyDxAVX differentiate(Functions, __m256d, __m256d ); 14 | 15 | __forceinline const __m256d get_derivative() const; 16 | 17 | __forceinline __m256d get_derivative(); 18 | 19 | __forceinline const __m256d get_error() const; 20 | 21 | __forceinline __m256d get_error(); 22 | 23 | private: 24 | 25 | __m256d derivative; 26 | __m256d error; 27 | 28 | __forceinline DyDxAVX(const __m256d, const __m256d); 29 | 30 | }; 31 | 32 | #include "DerivativeAVX.inl" 33 | } 34 | #endif /*_DERIVATIVE_AVX_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/DerivativeAVX.inl: -------------------------------------------------------------------------------- 1 | 2 | __forceinline mathlib::DyDxAVX::DyDxAVX(const __m256d deriv, const __m256d err) : derivative(deriv), error(err) 3 | { 4 | 5 | } 6 | 7 | __forceinline const __m256d mathlib::DyDxAVX::get_derivative() const 8 | { 9 | return this->derivative; 10 | } 11 | 12 | __forceinline __m256d mathlib::DyDxAVX::get_derivative() 13 | { 14 | return this->derivative; 15 | } 16 | 17 | __forceinline const __m256d mathlib::DyDxAVX::get_error() const 18 | { 19 | return this->error; 20 | } 21 | 22 | __forceinline __m256d mathlib::DyDxAVX::get_error() 23 | { 24 | return this->error; 25 | } 26 | 27 | template __forceinline mathlib::DyDxAVX mathlib::DyDxAVX::differentiate(Functions f, __m256d x, __m256d h ) 28 | { 29 | __m256d result = _mm256_cmp_pd(h, _mm256_setzero_pd(), 0); 30 | for (auto i = 0; i != 4; ++i) 31 | if (result.m256d_f64[i]) throw std::runtime_error("__m256d h cannot be zero\n"); 32 | 33 | __m256d deriv = _mm256_div_pd(_mm256_sub_pd(f(_mm256_add_pd(x, h)), f(_mm256_sub_pd(x, h))),_mm256_mul_pd(_mm256_set1_pd(2.0L),h)); 34 | __m256d err = _mm256_mul_pd(_mm256_set1_pd(std::numeric_limits::epsilon()), _mm256_div_pd(f(x), h)); 35 | 36 | return DyDxAVX(deriv, err); 37 | } -------------------------------------------------------------------------------- /MathLib/Include/GaussianQuadrature.h: -------------------------------------------------------------------------------- 1 | #ifndef _GAUSSIAN_QUADRATURE_H_ 2 | #define _GAUSSIAN_QUADRATURE_H_ 3 | 4 | #include "MathLibDefinitions.h" 5 | #include "Derivative.h" 6 | 7 | namespace mathlib 8 | { 9 | 10 | template class GaussianQdrtr 11 | { 12 | 13 | public: 14 | 15 | template __forceinline static GaussianQdrtr integrate(Function f, _Ty, _Ty); 16 | 17 | __forceinline _Ty get_integral() const; 18 | 19 | __forceinline _Ty get_error() const; 20 | 21 | private: 22 | 23 | template __forceinline static _Ty compute_error(); 24 | 25 | _Ty integral; 26 | _Ty error; 27 | 28 | __forceinline GaussianQdrtr(const _Ty, const _Ty); 29 | }; 30 | 31 | template class GaussQuadrature 32 | { 33 | 34 | 35 | public: 36 | 37 | __forceinline GaussQuadrature(); 38 | 39 | __forceinline GaussQuadrature(const double, const double, _Ty &functor); 40 | 41 | __forceinline GaussQuadrature(const GaussQuadrature &); 42 | 43 | __forceinline GaussQuadrature & integrate(); 44 | 45 | __forceinline double get_a() const; 46 | 47 | __forceinline double get_b() const; 48 | 49 | __forceinline double get_integral() const; 50 | 51 | __forceinline std::function get_functor() const; 52 | 53 | private: 54 | 55 | double a, b, integral; 56 | _Ty &functor; 57 | }; 58 | 59 | #include "GaussianQuadrature.inl" 60 | } 61 | #endif /*_GAUSSIAN_QUADRATURE_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Integrand.h: -------------------------------------------------------------------------------- 1 | #ifndef _INTEGRAND_H_ 2 | #define _INTEGRAND_H_ 3 | 4 | #include 5 | #include "MathLibDefinitions.h" 6 | 7 | 8 | namespace mathlib 9 | { 10 | // struct which represent integrand and various auxiliary variables 11 | // needed to perform multi-threaded quadrature. 12 | struct Fx 13 | { 14 | std::function fptr; 15 | 16 | double a, b; 17 | unsigned num_steps; 18 | unsigned int NWorkers; 19 | unsigned int * Workers; 20 | DWORD * ThIDArray; 21 | CRITICAL_SECTION cs; 22 | double result{ 0.0 }; 23 | }; 24 | 25 | __forceinline void static InitFx(mathlib::Fx *, std::function, double, double, const unsigned int, 26 | const unsigned int); 27 | 28 | __forceinline void static DeallocFx(mathlib::Fx *); 29 | 30 | // Global struct ued to hold the result of Quadrture. 31 | // This is flawed solution. 32 | struct QdrtrResult 33 | { 34 | double result ; 35 | }; 36 | 37 | #include "Integrand.inl" 38 | } 39 | #endif /*_INTEGRAND_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Integrand.inl: -------------------------------------------------------------------------------- 1 | 2 | __forceinline void mathlib::InitFx(mathlib::Fx * fx, std::function func, double aa, double bb, const unsigned int nWorkers, 3 | const unsigned int nSteps) 4 | { 5 | _ASSERT((0 < nWorkers) && (nullptr != fx)); 6 | _ASSERT(1 <= nSteps); 7 | fx->a = aa; 8 | fx->b = bb; 9 | fx->fptr = func; 10 | fx->NWorkers = nWorkers; 11 | fx->num_steps = nSteps; 12 | fx->ThIDArray = new DWORD[fx->NWorkers]; 13 | fx->Workers = new unsigned int[fx->NWorkers]; 14 | } 15 | 16 | __forceinline void mathlib::DeallocFx(mathlib::Fx * fx) 17 | { 18 | if (fx->Workers && fx->ThIDArray) 19 | { 20 | delete[] fx->Workers; 21 | delete[] fx->ThIDArray; 22 | } 23 | } -------------------------------------------------------------------------------- /MathLib/Include/IntegratorGKronordEndSingularity.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | C++ wrapper class for QUADPACK QAGS Integrators - implementation. 3 | 4 | @file IntegratorGKronordEndSingularity.inl 5 | @author: Bernard Gingold 6 | @version: 1.0 25/12/2015 7 | @description: QUADRATURE_F77_DECLARATIONS.h 8 | */ 9 | 10 | void mathlib::IntegratorQAGS::x_qags(float(*f)(float *), float a, float b, float epsabs, float epsrel, float result, 11 | float abserr, int neval, int ier, int limit, int lenw, int last, std::vector &iwork, std::vector &work) 12 | { 13 | QAGS(f, &a, &b, &epsabs, &epsrel, &result, &abserr, &neval, &ier, &limit, &lenw, &last, &iwork[0], &work[0]); 14 | } 15 | 16 | void mathlib::IntegratorQAGS::x_qagse(float(*f)(float *), float a, float b, float epsabs, float epsrel, int limit, 17 | float result, float abserr, int neval, int ier, std::vector &alist, std::vector &blist, std::vector &rlist, 18 | std::vector &elist, std::vector &iord, int last) 19 | { 20 | QAGSE(f, &a, &b, &epsabs, &epsrel, &limit, &result, &abserr, &neval, &ier, &alist[0], &blist[0], &rlist[0], &elist[0], 21 | &iord[0], &last); 22 | } 23 | 24 | void mathlib::IntegratorQAGS::x_qags(double(*f)(double *), double a, double b, double epsabs, double epsrel, double result, 25 | double abserr, int neval, int ier, int limit, int lenw, int last, std::vector &iwork, std::vector &work) 26 | { 27 | DQAGS(f, &a, &b, &epsabs, &epsrel, &result, &abserr, &neval, &ier, &limit, &lenw, &last, &iwork[0], &work[0]); 28 | } 29 | 30 | void mathlib::IntegratorQAGS::x_qagse(double(*f)(double *), double a, double b, double epsabs, double epsrel, int limit, 31 | double result, double abserr, int neval, int ier, std::vector &alist, std::vector &blist, std::vector &rlist, 32 | std::vector &elist, std::vector &iord, int last) 33 | { 34 | DQAGSE(f, &a, &b, &epsabs, &epsrel, &limit, &result, &abserr, &neval, &ier, &alist[0], &blist[0], &rlist[0], &elist[0], &iord[0], &last); 35 | } -------------------------------------------------------------------------------- /MathLib/Include/IntegratorGaussKronordInfinite.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | C++ wrapper class for QUADPACK QAGI Integrators - implementation. 3 | 4 | @file IntegratorGaussKronordInfinite.inl 5 | @author: Bernard Gingold 6 | @version: 1.0 25/12/2015 7 | @description: QUADRATURE_F77_DECLARATIONS.h 8 | */ 9 | 10 | void mathlib::IntegratorQAGI::x_qagi(float(*f)(float *), float bound, int inf, float epsabs, float epsrel, float result, 11 | float abserr, int neval, int ier, int limit, int lenw, int last, std::vector &iwork, std::vector &work) 12 | { 13 | QAGI(f, &bound, &inf, &epsabs, &epsrel, &result, &abserr, &neval, &ier, &limit, &lenw, &last, &iwork[0], &work[0]); 14 | } 15 | 16 | 17 | void mathlib::IntegratorQAGI::x_qagie(float(*f)(float *), float bound, float inf, float epsabs, float epsrel, int limit, 18 | float result, float abserr, int neval, int ier, std::vector &alist, std::vector &blist, std::vector &rlist, 19 | std::vector &elist, int iord, int last) 20 | { 21 | QAGIE(f, &bound, &inf, &epsabs, &epsrel, &limit, &result, &abserr, &neval, &ier, &alist[0], &blist[0], &rlist[0], &elist[0], &iord, &last); 22 | } 23 | 24 | void mathlib::IntegratorQAGI::x_qagi(double(*f)(double *), double bound, int inf, double epsabs, double epsrel, double result, 25 | double abserr, int neval, int ier, int limit, int lenw, int last, std::vector &iwork, std::vector &work) 26 | { 27 | DQAGI(f, &bound, &inf, &epsabs, &epsrel, &result, &abserr, &neval, &ier, &limit, &lenw, &last, &iwork[0], &work[0]); 28 | } 29 | 30 | void mathlib::IntegratorQAGI::x_qagie(double(*f)(double *), double bound, double inf, double epsabs, double epsrel, int limit, 31 | double result, double abserr, int neval, int ier, std::vector &alist, std::vector &blist, std::vector &rlist, 32 | std::vector &elist, int iord, int last) 33 | { 34 | DQAGIE(f, &bound, &inf, &epsabs, &epsrel, &limit, &result, &abserr, &neval, &ier, &alist[0], &blist[0], &rlist[0], &elist[0], &iord, &last); 35 | } -------------------------------------------------------------------------------- /MathLib/Include/IntegratorGaussKronordSingularity.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | C++ wrapper class for QUADPACK QAGP Integrators - implementation. 3 | 4 | @file IntegratorGaussKronordSingularity.inl 5 | @author: Bernard Gingold 6 | @version: 1.0 25/12/2015 7 | @description: QUADRATURE_F77_DECLARATIONS.h 8 | */ 9 | 10 | void mathlib::IntegratorQAGP::x_qagp(float(*f)(float *), float a, float b, int npts2, std::vector &points, float epsabs, 11 | float epsrel, float result, float abserr, int neval, int ier, int leniw, int lenw, int last, std::vector &iwork, 12 | std::vector &work) 13 | { 14 | QAGP(f, &a, &b, &npts2, &points[0], &epsabs, &epsrel, &result, &abserr, &neval, &ier, &leniw, &lenw, &last, &iwork[0], &work[0]); 15 | } 16 | 17 | void mathlib::IntegratorQAGP::x_qagpe(float(*f)(float *), float a, float b, int npts2, std::vector &points, float epsabs, 18 | float epsrel, int limit, float result, float abserr, int neval, int ier, std::vector &alist, std::vector &blist, 19 | std::vector &rlist, std::vector &elist, std::vector &pts, std::vector &level, std::vector &ndin, 20 | int iord, int last) 21 | { 22 | QAGPE(f, &a, &b, &npts2, &points[0], &epsabs, &epsrel, &limit, &result, &abserr, &neval, &ier, &alist[0], &blist[0], &rlist[0], 23 | &elist[0], &pts[0], &level[0], &ndin[0], &iord, &last); 24 | } 25 | 26 | void mathlib::IntegratorQAGP::x_qagp(double(*f)(double *), double a, double b, int npts2, std::vector &points, double epsabs, 27 | double epsrel, double result, double abserr, int neval, int ier, int leniw, int lenw, int last, std::vector &iwork, 28 | std::vector &work) 29 | { 30 | DQAGP(f, &a, &b, &npts2, &points[0], &epsabs, &epsrel, &result, &abserr, &neval, &ier, &leniw, &lenw, &last, &iwork[0], &work[0]); 31 | } 32 | 33 | void mathlib::IntegratorQAGP::x_qagpe(double(*f)(double *), double a, double b, int npts2, std::vector &points, double epsabs, 34 | double epsrel, int limit, double result, double abserr, int neval, int ier, std::vector &alist, std::vector &blist, 35 | std::vector &rlist, std::vector &elist, std::vector &pts, std::vector &level, std::vector &ndin, 36 | int iord, int last) 37 | { 38 | DQAGPE(f, &a, &b, &npts2, &points[0], &epsabs, &epsrel, &limit, &result, &abserr, &neval, &ier, &alist[0], &blist[0], 39 | &rlist[0], &elist[0], &pts[0], &level[0], &ndin[0], &iord, &last); 40 | } -------------------------------------------------------------------------------- /MathLib/Include/MathLibDefinitions.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _MATH_LIB_DEFINITIONS_H_ 3 | #define _MATH_LIB_DEFINITIONS_H_ 4 | 5 | 6 | #if defined (__INTEL_COMPILER) && (__INTEL_COMPILER) < 1400 7 | #error INTEL Compiler version 14.0 needed for partial support of C++11 and INTEL Compiler 15.0 needed for full support of C++11. 8 | #elif defined (__INTEL_COMPILER) && (__INTEL_COMPILER) < 1000 9 | #error Intel Compiler version 10.0 needed to support at least SSE4. 10 | #elif defined (_MSC_VER) && _MSC_VER < 1500 11 | #error MICROSOFT Visual Studio 2013 Compiler or later is required for MathLib compilation. 12 | #endif 13 | 14 | 15 | 16 | // Force inclusion of Intel Intrinsics: SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX Header Files. 17 | #if defined (__INTEL_COMPILER) && defined (__AVX__) 18 | #include 19 | #elif defined (__SSE4_2__) 20 | #include 21 | #elif defined (__SSE4_1__) 22 | #include 23 | #elif defined (__SSSE3__) 24 | #include 25 | #elif defined (__SSE3__) 26 | #include 27 | #elif defined (__SSE2__) 28 | #include 29 | #elif defined (__SSE__) 30 | #include 31 | #elif defined (_MSC_VER) 32 | #include 33 | #endif 34 | 35 | // Frequently used STD header files 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #if defined _DEBUG 43 | #include 44 | #ifndef DEBUG_PRINT 45 | // Debug macro 46 | /*#define DEBUG_PRINT(expr, message, arg1, arg2) \ 47 | do \ 48 | { \ 49 | \ 50 | \ 51 | \ 52 | if ((expr) && \ 53 | (1 == _CrtDbgReport(_CRT_ERROR, __FILE__, __LINE__, message, arg1, arg2))) \ 54 | _CrtDbgBreak(); \ 55 | } while (0);*/ 56 | #endif 57 | #ifndef PRINT_DATA 58 | #define PRINT_DATA 0x0 59 | #endif 60 | #ifndef PRINT_TO_FILE 61 | #define PRINT_TO_FILE 0x0 62 | #endif 63 | #endif 64 | #endif /*_MATH_LIB_DEFINITIONS_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/MultiThreaded6PQuadrature.h: -------------------------------------------------------------------------------- 1 | #ifndef _MULTI_THREADED_6P_QUADRATURE_H_ 2 | #define _MULTI_THREADED_6P_QUADRATURE_H_ 3 | 4 | 5 | #include "Integrand.h" 6 | 7 | 8 | namespace mathlib 9 | { 10 | //CRITICAL_SECTION cs4; 11 | //QdrtrResult qr4; 12 | 13 | class MTNewtonCotes6P 14 | { 15 | 16 | public: 17 | 18 | __forceinline static DWORD WINAPI nc6p_qdrtr(LPVOID); 19 | 20 | __forceinline static double run_computation(mathlib::Fx *); 21 | }; 22 | 23 | #include "MultiThreaded6PQuadrature.inl" 24 | } 25 | #endif /*_MULTI_THREADED_6P_QUADRATURE_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/MultiThreaded6PQuadrature.inl: -------------------------------------------------------------------------------- 1 | 2 | __forceinline DWORD WINAPI mathlib::MTNewtonCotes6P::nc6p_qdrtr(LPVOID lpvoid) 3 | { 4 | _ASSERT(nullptr != lpvoid); 5 | double sum = 0.0L, h, term; 6 | unsigned int start; 7 | Fx * fx = static_cast(lpvoid); 8 | 9 | if (1 >= fx->num_steps) 10 | throw std::runtime_error("Fatal Error in nc6p_qdrtr: 1 >= num_steps\n"); 11 | 12 | start = *static_cast(fx->Workers); 13 | h = (fx->b - fx->a) / (5.0L * static_cast(fx->num_steps)); 14 | term = 0.00347222222222222L * (5.0 * h); 15 | sum = 19.0L * fx->fptr(fx->a) + 75.0L * (fx->fptr(fx->a + h) + fx->fptr(fx->a + 4.0L * h)) + 50.0L * (fx->fptr(fx->a + 2.0L * h) + 16 | fx->fptr(fx->a + 3.0L * h)) + 19.0L * fx->fptr(fx->b); 17 | 18 | for (auto i = start; i < fx->num_steps; i += fx->NWorkers) 19 | { 20 | double x = fx->a + 5.0L * h * static_cast(i); 21 | sum += 38.0L * fx->fptr(x) + 75.0L * (fx->fptr(x + h) + fx->fptr(x + 4.0L * h)) + 50.0L * (fx->fptr(x + 2.0L * h) + 22 | fx->fptr(x + 3.0L* h)); 23 | 24 | } 25 | sum *= term; 26 | ::EnterCriticalSection(&fx->cs); 27 | fx->result += sum; 28 | ::LeaveCriticalSection(&fx->cs); 29 | 30 | return 0; 31 | } 32 | 33 | __forceinline double mathlib::MTNewtonCotes6P::run_computation(mathlib::Fx * fx) 34 | { 35 | _ASSERT(nullptr != fx); 36 | double qdrtr_approx = std::numeric_limits::quiet_NaN(); 37 | HANDLE * ThreadArray = new HANDLE[fx->NWorkers]; 38 | ::InitializeCriticalSection(&fx->cs); 39 | for (auto i = 0; i != fx->NWorkers; ++i) 40 | { 41 | fx->Workers[i] = i + 1; 42 | ThreadArray[i] = ::CreateThread(0, 0, static_cast(nc6p_qdrtr), fx, 0, &fx->ThIDArray[i]); 43 | if (NULL == ThreadArray[i]) 44 | { 45 | std::printf("::CreateThread failed with an error: %d\n", ::GetLastError()); 46 | ::ExitProcess(1); 47 | } 48 | } 49 | ::WaitForMultipleObjects(fx->NWorkers, ThreadArray, TRUE, INFINITE); 50 | for (auto i = 0; i != fx->NWorkers; ++i) ::CloseHandle(ThreadArray[i]); 51 | 52 | delete[] ThreadArray; 53 | qdrtr_approx = fx->result; 54 | return qdrtr_approx; 55 | } -------------------------------------------------------------------------------- /MathLib/Include/MultiThreaded7PQuadrature.h: -------------------------------------------------------------------------------- 1 | #ifndef _MULTI_THREADED_7P_QUADRATURE_H_ 2 | #define _MULTI_THREADED_7P_QUADRATURE_H_ 3 | 4 | #include "Integrand.h" 5 | 6 | namespace mathlib 7 | { 8 | 9 | 10 | //CRITICAL_SECTION cs5; 11 | //QdrtrResult qr5; 12 | 13 | class MTNewtonCotes7P 14 | { 15 | 16 | public: 17 | 18 | __forceinline static DWORD WINAPI nc7p_qdrtr(LPVOID); 19 | 20 | __forceinline static double run_computation(mathlib::Fx *); 21 | }; 22 | 23 | #include "MultiThreaded7PQuadrature.inl" 24 | } 25 | #endif /*_MULTI_THREADED_7P_QUADRATURE_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/MultiThreaded7PQuadrature.inl: -------------------------------------------------------------------------------- 1 | __forceinline DWORD WINAPI mathlib::MTNewtonCotes7P::nc7p_qdrtr(LPVOID lpvoid) 2 | { 3 | _ASSERT(nullptr != lpvoid); 4 | double sum = 0.0L, h, term; 5 | unsigned int start; 6 | Fx * fx = static_cast(lpvoid); 7 | 8 | if (1 >= fx->num_steps) 9 | throw std::runtime_error("Fatal Error in nc7_qdrtr: 1 >= num_steps\n"); 10 | 11 | //start = *static_cast(fx->Threads); 12 | start = *static_cast(fx->Workers); 13 | h = (fx->b - fx->a) / (6.0L * static_cast(fx->num_steps)); 14 | term = 0.00714285714L * h; 15 | sum = 41.0L * fx->fptr(fx->a) + 216.0L * (fx->fptr(fx->a + h) + fx->fptr(fx->a + 5.0L * h)) + 16 | 27.0L * (fx->fptr(fx->a + 2.0L * h) + fx->fptr(fx->a + 4.0L * h)) + 17 | 272.0L * fx->fptr(fx->a + 3.0L * h) + 41.0L * fx->fptr(fx->b); 18 | 19 | for (auto i = 0; i < fx->num_steps; i += fx->NWorkers) 20 | { 21 | double x = fx->a + 6.0L * h * static_cast(i); 22 | sum += 82.0L * fx->fptr(x) + 216.0L * (fx->fptr(x + h) + fx->fptr(x + 5.0L * h)) + 23 | 27.0L * (fx->fptr(x + 2.0L * h) + fx->fptr(x + 4.0L * h)) + 24 | 272.0L * fx->fptr(x + 3.0L * h); 25 | } 26 | 27 | sum *= term; 28 | ::EnterCriticalSection(&fx->cs); 29 | fx->result += sum; 30 | ::LeaveCriticalSection(&fx->cs); 31 | 32 | return 0; 33 | } 34 | 35 | __forceinline double mathlib::MTNewtonCotes7P::run_computation(mathlib::Fx * fx) 36 | { 37 | _ASSERT(nullptr != fx); 38 | double qdrtr_approx = std::numeric_limits::quiet_NaN(); 39 | HANDLE * ThreadArray = new HANDLE[fx->NWorkers]; 40 | 41 | ::InitializeCriticalSection(&fx->cs); 42 | for (auto i = 0; i != fx->NWorkers; ++i) 43 | { 44 | fx->Workers[i] = i + 1; 45 | ThreadArray[i] = ::CreateThread(0, 0, static_cast(nc7p_qdrtr), fx, 0, &fx->ThIDArray[i]); 46 | if (NULL == ThreadArray[i]) 47 | { 48 | std::printf("::CreateThread failed with an error: %d\n", ::GetLastError()); 49 | ::ExitProcess(1); 50 | } 51 | 52 | } 53 | ::WaitForMultipleObjects(fx->NWorkers, ThreadArray, TRUE, INFINITE); 54 | for (auto i = 0; i != fx->NWorkers; ++i) ::CloseHandle(ThreadArray[i]); 55 | 56 | delete[] ThreadArray; 57 | qdrtr_approx = fx->result; 58 | return qdrtr_approx; 59 | 60 | } -------------------------------------------------------------------------------- /MathLib/Include/MultiThreaded8PQuadrature.h: -------------------------------------------------------------------------------- 1 | #ifndef _MULTI_THREADED_8P_QUADRATURE_H_ 2 | #define _MULTI_THREADED_8P_QUADRATURE_H_ 3 | 4 | 5 | #include "Integrand.h" 6 | 7 | namespace mathlib 8 | { 9 | 10 | //CRITICAL_SECTION cs6; 11 | //QdrtrResult qr6; 12 | 13 | class MTNewtonCotes8P 14 | { 15 | 16 | public: 17 | 18 | 19 | __forceinline static DWORD WINAPI nc8p_qdrtr(LPVOID); 20 | 21 | __forceinline static double run_computation(mathlib::Fx *); 22 | 23 | }; 24 | 25 | #include "MultiThreaded8PQuadrature.inl" 26 | } 27 | #endif /*_MULTI_THREADED_8P_QUADRATURE_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/MultiThreaded8PQuadrature.inl: -------------------------------------------------------------------------------- 1 | __forceinline DWORD WINAPI mathlib::MTNewtonCotes8P::nc8p_qdrtr(LPVOID lpvoid) 2 | { 3 | _ASSERT(nullptr != lpvoid); 4 | double sum = 0.0L, h, term; 5 | unsigned int start; 6 | Fx * fx = static_cast(lpvoid); 7 | if (1 >= fx->num_steps) 8 | throw std::runtime_error("Fatal Error in nc8p_qdrtr: 1 >= num_steps\n"); 9 | 10 | start = *static_cast(fx->Workers); 11 | h = (fx->b - fx->a) / (7.0L * static_cast(fx->num_steps)); 12 | term = 4.050925925925e-4L * h; 13 | sum = 751.0L * fx->fptr(fx->a) + 3577.0L * (fx->fptr(fx->a + h) + fx->fptr(fx->a + 6.0L * h)) + 1323.0L * (fx->fptr(fx->a + 2.0L * h) + 14 | fx->fptr(fx->a + 5.0L * h)) + 2989.0L * (fx->fptr(fx->a + 3.0L * h) + fx->fptr(fx->a + 4.0L * h)) + 751.0L * fx->fptr(fx->b); 15 | 16 | for (auto i = start; i < fx->num_steps; i += fx->NWorkers) 17 | { 18 | double x = fx->fptr(fx->a) + 7.0L * h * static_cast(i); 19 | sum += 1502.0L * fx->fptr(x) + 3577.0L * (fx->fptr(x + h) + fx->fptr(x + 6.0L * h)) + 1323.0L * (fx->fptr(x + 2.0L * h) + 20 | fx->fptr(x + 5.0L * h)) + 2989.0L * (fx->fptr(x + 3.0L * h) + fx->fptr(x + 4.0L * h)); 21 | } 22 | 23 | sum *= term; 24 | ::EnterCriticalSection(&fx->cs); 25 | fx->result += sum; 26 | ::LeaveCriticalSection(&fx->cs); 27 | 28 | return 0; 29 | 30 | } 31 | 32 | __forceinline double mathlib::MTNewtonCotes8P::run_computation(mathlib::Fx * fx) 33 | { 34 | _ASSERT(nullptr != fx); 35 | 36 | double qdrtr_approx = std::numeric_limits::quiet_NaN(); 37 | HANDLE * ThreadArray = new HANDLE[fx->NWorkers]; 38 | ::InitializeCriticalSection(&fx->cs); 39 | for (auto i = 0; i != fx->NWorkers; ++i) 40 | { 41 | fx->Workers[i] = i + 1; 42 | ThreadArray[i] = ::CreateThread(0, 0, static_cast(nc8p_qdrtr), fx, 0, &fx->ThIDArray[i]); 43 | if (NULL == ThreadArray[i]) 44 | { 45 | std::printf("::CreateThread failed with an error:%d\n", ::GetLastError()); 46 | ::ExitProcess(1); 47 | } 48 | } 49 | ::WaitForMultipleObjects(fx->NWorkers, ThreadArray, TRUE, INFINITE); 50 | for (auto i = 0; i != fx->NWorkers; ++i) ::CloseHandle(ThreadArray[i]); 51 | 52 | delete[] ThreadArray; 53 | qdrtr_approx = fx->result; 54 | return qdrtr_approx; 55 | } -------------------------------------------------------------------------------- /MathLib/Include/MultiThreadedBoolRule.h: -------------------------------------------------------------------------------- 1 | #ifndef _MULTI_THREADED_BOOL_RULE_H_ 2 | #define _MULTI_THREADED_BOOL_RULE_H_ 3 | 4 | 5 | #include "Integrand.h" 6 | 7 | namespace mathlib 8 | { 9 | //CRITICAL_SECTION cs3; 10 | //QdrtrResult qr3; 11 | 12 | class MTBoolQdrtr 13 | { 14 | 15 | 16 | public: 17 | 18 | __forceinline static DWORD WINAPI boole_qdrtr(LPVOID); 19 | 20 | __forceinline static double run_computation(mathlib::Fx *); 21 | }; 22 | 23 | #include "MultiThreadedBoolRule.inl" 24 | } 25 | #endif /*_MULTI_THREADED_BOOL_RULE_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/MultiThreadedBoolRule.inl: -------------------------------------------------------------------------------- 1 | __forceinline DWORD WINAPI mathlib::MTBoolQdrtr::boole_qdrtr(LPVOID lpvoid) 2 | { 3 | _ASSERT(nullptr != lpvoid); 4 | 5 | double h = 0.0L, sum = 0.0L, term; 6 | unsigned int start; 7 | Fx * fx = static_cast(lpvoid); 8 | 9 | if (1 >= fx->num_steps) 10 | throw std::runtime_error("Fatal Error in boole_qdrtr: 1 >= num_steps\n"); 11 | 12 | start = *static_cast(fx->Workers); 13 | h = (fx->b - fx->a) / (4.0L * static_cast(fx->num_steps)); 14 | term = 0.022222222222L * (2.0L * h); 15 | sum = 7.0L * fx->fptr(fx->a) + 32.0L * (fx->fptr(fx->a + h) + fx->fptr(fx->a + 3.0L * h)) + 12.0L * fx->fptr(fx->a + 2.0L * h) + 16 | 7.0L * fx->fptr(fx->b); 17 | 18 | for (auto i = start; i < fx->num_steps; i += fx->NWorkers) 19 | { 20 | double x = fx->a + 4.0L * h * static_cast(i); 21 | sum += 14.0L * fx->fptr(x) + 32.0L * (fx->fptr(x + h) + fx->fptr(x + 3.0L * h)) + 12.0L * fx->fptr(x + 2.0L * h); 22 | 23 | } 24 | 25 | sum *= term; 26 | ::EnterCriticalSection(&fx->cs); 27 | fx->result += sum; 28 | ::LeaveCriticalSection(&fx->cs); 29 | 30 | return 0; 31 | } 32 | 33 | __forceinline double mathlib::MTBoolQdrtr::run_computation(mathlib::Fx * fx) 34 | { 35 | _ASSERT(nullptr != fx); 36 | 37 | double qdrtr_approx = std::numeric_limits::quiet_NaN(); 38 | HANDLE * ThreadArray = new HANDLE[fx->NWorkers]; 39 | ::InitializeCriticalSection(&fx->cs); 40 | for (auto i = 0; i != fx->NWorkers; ++i) 41 | { 42 | fx->Workers[i] = i + 1; 43 | ThreadArray[i] = ::CreateThread(0, 0, static_cast(boole_qdrtr), fx, 0, &fx->ThIDArray[i]); 44 | if (NULL == ThreadArray[i]) 45 | { 46 | std::printf("::CreateThread failed with an error: %d\n", ::GetLastError()); 47 | ::ExitProcess(1); 48 | } 49 | } 50 | ::WaitForMultipleObjects(fx->NWorkers, ThreadArray, TRUE, INFINITE); 51 | for (auto i = 0; i != fx->NWorkers; ++i) ::CloseHandle(ThreadArray[i]); 52 | 53 | delete[] ThreadArray; 54 | qdrtr_approx = fx->result; 55 | return qdrtr_approx; 56 | 57 | } -------------------------------------------------------------------------------- /MathLib/Include/MultiThreadedTrapezoid.h: -------------------------------------------------------------------------------- 1 | #ifndef _MULTI_THREADED_TRAPEZOID_H_ 2 | #define _MULTI_THREADED_TRAPEZOID_H_ 3 | 4 | #include "Integrand.h" 5 | namespace mathlib 6 | { 7 | 8 | //This usage is flawed when multiple calls to trpzd_qdrtr are made. 9 | //CRITICAL_SECTION mutex1; 10 | //QdrtrResult qr1; 11 | // 12 | 13 | 14 | class MTTrpzd 15 | { 16 | 17 | public: 18 | 19 | 20 | 21 | 22 | __forceinline static DWORD WINAPI trpzd_qdrtr(LPVOID); 23 | 24 | __forceinline static double run_computation(mathlib::Fx *); 25 | 26 | 27 | }; 28 | 29 | 30 | #include "MultiThreadedTrapezoid.inl" 31 | } 32 | #endif /*_MULTI_THREADED_TRAPEZOID_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/MultiThreadedTrapezoid.inl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DWORD WINAPI mathlib::MTTrpzd::trpzd_qdrtr(LPVOID lpvoid) 5 | { 6 | _ASSERT(lpvoid != nullptr); 7 | 8 | double h = 0.0L, term = 0.0L, sum = 0.0L; 9 | unsigned int start; 10 | Fx * fx = static_cast(lpvoid); 11 | 12 | if (1 >= fx->num_steps) 13 | throw std::runtime_error("Fatal Error in trpzd_qdrtr: 1 >= num_steps\n"); 14 | 15 | start = *static_cast(fx->Workers); 16 | h = (fx->b - fx->a) / static_cast(fx->num_steps); 17 | sum = 0.5L * (fx->b - fx->a) * (fx->fptr(fx->a) + fx->fptr(fx->b)); 18 | 19 | for (auto i = start; i < fx->num_steps; i += fx->NWorkers) 20 | { 21 | double x = fx->a + h * static_cast(i); 22 | sum += fx->fptr(x); 23 | //std::printf("sum=%.15f\n", sum); 24 | //std::printf("start=%d, num_steps=%d\n", start, fx->num_steps); 25 | } 26 | 27 | sum *= h; 28 | ::EnterCriticalSection(&fx->cs); 29 | fx->result += sum; 30 | //std::printf("result=%.15f\n",qr1.result ); 31 | ::LeaveCriticalSection(&fx->cs); 32 | 33 | return 0; 34 | } 35 | 36 | double __forceinline mathlib::MTTrpzd::run_computation(Fx * fx) 37 | { 38 | _ASSERT(fx != nullptr); 39 | double qdrtr_approx = std::numeric_limits::quiet_NaN(); 40 | 41 | HANDLE * ThreadArray = new HANDLE[fx->NWorkers]; 42 | ::InitializeCriticalSection(&fx->cs); 43 | for (auto i = 0; i != fx->NWorkers; ++i) 44 | { 45 | fx->Workers[i] = i + 1; 46 | ThreadArray[i] = ::CreateThread(0, 0, static_cast(trpzd_qdrtr), fx, 0, &fx->ThIDArray[0]); 47 | if (NULL == ThreadArray[i]) 48 | { 49 | std::printf("::CreateThread failed with an error %d\n", ::GetLastError()); 50 | ::ExitProcess(1); 51 | } 52 | } 53 | ::WaitForMultipleObjects(fx->NWorkers, ThreadArray, TRUE, INFINITE); 54 | for (auto i = 0; i != fx->NWorkers; ++i) ::CloseHandle(ThreadArray[i]); 55 | 56 | delete[] ThreadArray; 57 | qdrtr_approx = fx->result; 58 | return qdrtr_approx; 59 | } -------------------------------------------------------------------------------- /MathLib/Include/QuadratureEightPoints.h: -------------------------------------------------------------------------------- 1 | #ifndef _QUADRATURE_EIGHT_POINTS_H_ 2 | #define _QUADRATURE_EIGHT_POINTS_H_ 3 | 4 | #include "MathLibDefinitions.h" 5 | #include "Derivative.h" 6 | 7 | namespace mathlib 8 | { 9 | 10 | template class Qdrtr8Points 11 | { 12 | 13 | public: 14 | 15 | template __forceinline static Qdrtr8Points integrate(Function, _Ty, _Ty, const int, const int); 16 | 17 | __forceinline const _Ty get_integral() const; 18 | 19 | __forceinline _Ty get_integral(); 20 | 21 | __forceinline const _Ty get_error() const; 22 | 23 | __forceinline _Ty get_error(); 24 | 25 | private: 26 | 27 | template __forceinline static _Ty compute_error(Function, _Ty, _Ty, _Ty); 28 | _Ty integral; 29 | _Ty error; 30 | 31 | __forceinline Qdrtr8Points(const _Ty, const _Ty); 32 | }; 33 | 34 | 35 | template class NewtonCotes8P 36 | { 37 | 38 | public: 39 | 40 | __forceinline NewtonCotes8P(); 41 | 42 | __forceinline NewtonCotes8P(const double, const double, const int, _Ty &functor); 43 | 44 | __forceinline NewtonCotes8P(const NewtonCotes8P &); 45 | 46 | __forceinline NewtonCotes8P & integrate(const int); 47 | 48 | __forceinline double get_a() const; 49 | 50 | __forceinline double get_b() const; 51 | 52 | __forceinline double get_integral() const; 53 | 54 | __forceinline double get_error() const; 55 | 56 | __forceinline std::function get_functor() const; 57 | 58 | __forceinline int get_n() const; 59 | 60 | 61 | private: 62 | 63 | __forceinline void compute_error(const double); 64 | 65 | double a, b, error, integral; 66 | int n; 67 | _Ty &functor; 68 | }; 69 | 70 | 71 | #include "QuadratureEightPoints.inl" 72 | } 73 | #endif /*_QUADRATURE_EIGHT_POINTS_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/QuadratureSevenPoints.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _QUADRATURE_SEVEN_POINTS_H_ 3 | #define _QUADRATURE_SEVEN_POINTS_H_ 4 | 5 | #include "MathLibDefinitions.h" 6 | #include "Derivative.h" 7 | 8 | namespace mathlib 9 | { 10 | 11 | template class Qdrtr7Points 12 | { 13 | 14 | public: 15 | 16 | template __forceinline static Qdrtr7Points integrate(Function, _Ty, _Ty, const int, const int); 17 | 18 | __forceinline const _Ty get_error() const; 19 | 20 | __forceinline _Ty get_error(); 21 | 22 | __forceinline const _Ty get_integral() const; 23 | 24 | __forceinline _Ty get_integral(); 25 | 26 | private: 27 | 28 | _Ty integral; 29 | _Ty error; 30 | __forceinline Qdrtr7Points(const _Ty, const _Ty); 31 | 32 | template __forceinline static _Ty compute_error(Function, _Ty, _Ty, _Ty); 33 | }; 34 | 35 | template class NewtonCotes7P 36 | { 37 | 38 | public: 39 | 40 | __forceinline NewtonCotes7P(); 41 | 42 | __forceinline NewtonCotes7P(const double, const double, const int, _Ty &functor); 43 | 44 | __forceinline NewtonCotes7P(const NewtonCotes7P &); 45 | 46 | __forceinline NewtonCotes7P & integrate(const int); 47 | 48 | __forceinline std::function get_functor() const; 49 | 50 | __forceinline double get_a() const; 51 | 52 | __forceinline double get_b() const; 53 | 54 | __forceinline double get_integral() const; 55 | 56 | __forceinline double get_error() const; 57 | 58 | __forceinline int get_n() const; 59 | 60 | 61 | 62 | private: 63 | 64 | __forceinline void compute_error(const double); 65 | double a, b, integral, error; 66 | int n; 67 | _Ty &functor; 68 | }; 69 | 70 | 71 | #include "QuadratureSevenPoints.inl" 72 | } 73 | #endif /*_QUADRATURE_SEVEN_POINTS_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/QuadratureSixPoints.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _QUADRATURE_SIX_POINTS_H_ 3 | #define _QUADRATURE_SIX_POINTS_H_ 4 | 5 | #include "MathLibDefinitions.h" 6 | #include "Derivative.h" 7 | namespace mathlib 8 | { 9 | template class QdrtrSixPoints 10 | { 11 | 12 | public: 13 | 14 | template __forceinline static QdrtrSixPoints integrate(Function, _Ty, _Ty, const int,const int); 15 | 16 | __forceinline const _Ty get_integral() const; 17 | 18 | __forceinline _Ty get_integral(); 19 | 20 | __forceinline const _Ty get_error() const; 21 | 22 | __forceinline _Ty get_error(); 23 | 24 | private: 25 | 26 | template __forceinline static _Ty compute_error(Function, _Ty, _Ty, _Ty); 27 | 28 | _Ty integral; 29 | _Ty error; 30 | 31 | __forceinline QdrtrSixPoints(const _Ty, const _Ty); 32 | }; 33 | 34 | template class NewtonCotes6P 35 | { 36 | 37 | public: 38 | 39 | __forceinline NewtonCotes6P(); 40 | 41 | __forceinline NewtonCotes6P(const double, const double, const int, _Ty &functor); 42 | 43 | __forceinline NewtonCotes6P(const NewtonCotes6P &); 44 | 45 | __forceinline NewtonCotes6P & integrate(const int); 46 | 47 | __forceinline double get_a() const; 48 | 49 | __forceinline double get_b() const; 50 | 51 | __forceinline double get_integral() const; 52 | 53 | __forceinline double get_error() const; 54 | 55 | __forceinline int get_n() const; 56 | 57 | 58 | 59 | 60 | private: 61 | 62 | __forceinline void compute_error(double); 63 | double a, b, integral, error; 64 | int n; 65 | _Ty &functor; 66 | }; 67 | 68 | 69 | #include "QuadratureSixPoints.inl" 70 | } 71 | #endif /*_QUADRATURE_SIX_POINTS_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Real_CosFFT_1D.h: -------------------------------------------------------------------------------- 1 | #ifndef _REAL_COSINE_FFT_1D_H_ 2 | #define _REAL_COSINE_FFT_1D_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Real Cosine FFT forward/backward Direction 1D class - wrapper definition. 6 | Wrapper around FFTPACK 5.1 library 7 | @file Real_CosFFT_1D 8 | @author: Bernard Gingold 9 | @version: 1.0 26/10/2015 10 | @description: in F77_FFT_DECLARATIONS.h 11 | */ 12 | 13 | #include "MathLibDefinitions.h" 14 | #include "F77_FFT_DECLARATIONS.h" 15 | 16 | namespace mathlib 17 | { 18 | 19 | class RealCosFFT1D 20 | { 21 | 22 | public: 23 | 24 | 25 | /* 26 | @brief wrapper for F77 COSTI routine. 27 | */ 28 | void real_cos_transf_init(int, 29 | std::vector &, 30 | int, 31 | int); 32 | 33 | 34 | /* 35 | @brief wrapper for F77 COST1B routine. 36 | */ 37 | void real_cos_transf_backward(int, 38 | int, 39 | std::vector &, 40 | int, 41 | std::vector &, 42 | int, 43 | std::vector &, 44 | int, 45 | int); 46 | 47 | /* 48 | @brief wrapper for F77 COST1F routine. 49 | */ 50 | void real_cos_transf_forward(int, 51 | int, 52 | std::vector &, 53 | int, 54 | std::vector &, 55 | int, 56 | std::vector &, 57 | int, 58 | int); 59 | }; 60 | 61 | #include "Real_CosFFT_1D.inl" 62 | } 63 | #endif /*_REAL_COSINE_FFT_1D_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Real_CosFFT_1D.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Real Cosine FFT forward/backward Direction 1D class - wrapper implmentation. 4 | Wrapper around FFTPACK 5.1 library 5 | @file Real_CosFFT_1D.inl 6 | @author: Bernard Gingold 7 | @version: 1.0 26/10/2015 8 | @description: in F77_FFT_DECLARATIONS.h 9 | */ 10 | 11 | 12 | 13 | 14 | void mathlib::RealCosFFT1D::real_cos_transf_init(int N, std::vector &WSAVE, 15 | int LENSAV, int IER) 16 | { 17 | // Call Fortran COSTI subroutine. 18 | /* 19 | @desc subroutine COST1I initializes array WSAVE for use 20 | in its companion routines COST1F and COST1B. The prime factor- 21 | ization of N together with a tabulation of the trigonometric 22 | functions are computed and stored in array WSAVE. Separate 23 | WSAVE arrays are required for different values of N. 24 | */ 25 | COSTI(&N, &WSAVE[0], &LENSAV, &IER); 26 | } 27 | 28 | void mathlib::RealCosFFT1D::real_cos_transf_backward(int N, int INC, std::vector &R, 29 | int LENR, std::vector &WSAVE, int LENSAV, std::vector &WORK, 30 | int LENWRK, int IER) 31 | { 32 | // Call Fortan COST1B subroutine. 33 | /* 34 | @desc routine COST1B computes the one-dimensional Fourier 35 | transform of an even sequence within a real array. This 36 | transform is referred to as the backward transform or Fourier 37 | synthesis, transforming the sequence from spectral to physical 38 | space. 39 | */ 40 | COST1B(&N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 41 | } 42 | 43 | void mathlib::RealCosFFT1D::real_cos_transf_forward(int N, int INC, std::vector &R, 44 | int LENR, std::vector &WSAVE, int LENSAV, std::vector &WORK, 45 | int LENWRK, int IER) 46 | { 47 | // Call Fortran COST1F subroutine 48 | /* 49 | @desc routine COST1F computes the one-dimensional Fourier 50 | transform of an even sequence within a real array. This transform 51 | is referred to as the forward transform or Fourier analysis, 52 | transforming the sequence from physical to spectral space. 53 | */ 54 | COST1F(&N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 55 | } -------------------------------------------------------------------------------- /MathLib/Include/Real_CosFFT_Multiple.h: -------------------------------------------------------------------------------- 1 | #ifndef _REAL_COSINE_FFT_MULTIPLE_H_ 2 | #define _REAL_COSINE_FFT_MULTIPLE_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Real Cosine FFT forward/backward Direction 1D class - wrapper definition. 6 | Wrapper around FFTPACK 5.1 library 7 | @file Real_CosFFT_Multiple.h 8 | @author: Bernard Gingold 9 | @version: 1.0 26/10/2015 10 | @description: in F77_FFT_DECLARATIONS.h 11 | */ 12 | 13 | #include "MathLibDefinitions.h" 14 | #include "F77_FFT_DECLARATIONS.h" 15 | 16 | namespace mathlib 17 | { 18 | 19 | 20 | class RealCosFFTMultiple 21 | { 22 | 23 | public: 24 | 25 | 26 | /* 27 | @brief wrapper for F77 COSTMI routine. 28 | */ 29 | void real_cosfft_multiple_init(int, 30 | std::vector &, 31 | int, 32 | int); 33 | 34 | 35 | /* 36 | @brief wrapper for F77 COSTMB routine. 37 | */ 38 | void real_cosfft_multiple_backward(int, 39 | int, 40 | int, 41 | int, 42 | std::vector &, 43 | int, 44 | std::vector &, 45 | int, 46 | std::vector &, 47 | int, 48 | int); 49 | 50 | /* 51 | @brief wrapper for F77 COSTMF routine. 52 | */ 53 | void real_cosfft_multiple_forward(int, 54 | int, 55 | int, 56 | int, 57 | std::vector &, 58 | int, 59 | std::vector &, 60 | int, 61 | std::vector &, 62 | int, 63 | int); 64 | }; 65 | 66 | #include "Real_CosFFT_Multiple.inl" 67 | } 68 | 69 | #endif /*_REAL_COSINE_FFT_MULTIPLE_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Real_CosFFT_Multiple.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Real Cosine FFT forward/backward Direction 1D class - wrapper implementation. 4 | Wrapper around FFTPACK 5.1 library 5 | @file Real_CosFFT_Multiple.inl 6 | @author: Bernard Gingold 7 | @version: 1.0 26/10/2015 8 | @description: in F77_FFT_DECLARATIONS.h 9 | */ 10 | 11 | 12 | void mathlib::RealCosFFTMultiple::real_cosfft_multiple_init(int N, std::vector &WSAVE, 13 | int LENSAV, int IER) 14 | { 15 | // Call Fortran COSTMI subroutine. 16 | COSTMI(&N, &WSAVE[0], &LENSAV, &IER); 17 | } 18 | 19 | void mathlib::RealCosFFTMultiple::real_cosfft_multiple_backward(int LOT, int JUMP, int N, int INC, 20 | std::vector &R, int LENR, std::vector &WSAVE, int LENSAV, 21 | std::vector &WORK, int LENWRK, int IER) 22 | { 23 | // Call Fortran COSTMB routine. 24 | COSTMB(&LOT, &JUMP, &N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 25 | } 26 | 27 | void mathlib::RealCosFFTMultiple::real_cosfft_multiple_forward(int LOT, int JUMP, int N, int INC, 28 | std::vector &R, int LENR, std::vector &WSAVE, int LENSAV, 29 | std::vector &WORK, int LENWRK, int IER) 30 | { 31 | COSTMF(&LOT, &JUMP, &N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 32 | } 33 | -------------------------------------------------------------------------------- /MathLib/Include/Real_FFT_1D.h: -------------------------------------------------------------------------------- 1 | #ifndef _REAL_FFT_1D_H_ 2 | #define _REAL_FFT_1D_H_ 3 | 4 | #include "MathLibDefinitions.h" 5 | #include "F77_FFT_DECLARATIONS.h" 6 | 7 | namespace mathlib 8 | { 9 | 10 | 11 | 12 | class RealFFT1D 13 | { 14 | 15 | public: 16 | 17 | static void real_fft_init1D(int, 18 | std::vector &, 19 | int, 20 | int); 21 | 22 | static void real_fft_backward1D(int, 23 | int, 24 | std::vector &, 25 | int, 26 | std::vector &, 27 | int, 28 | std::vector &, 29 | int, 30 | int); 31 | 32 | static void real_fft__forward1D(int, 33 | int, 34 | std::vector &, 35 | int, 36 | std::vector &, 37 | int, 38 | std::vector &, 39 | int, 40 | int); 41 | }; 42 | 43 | #include "Real_FFT_1D.inl" 44 | } 45 | #endif /*_REAL_FFT-1D_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Real_FFT_1D.inl: -------------------------------------------------------------------------------- 1 | 2 | void mathlib::RealFFT1D::real_fft_init1D(int N, std::vector &WSAVE, int LENSAV, int IER) 3 | { 4 | RFFT1I(&N, &WSAVE[0], &LENSAV, &IER); 5 | } 6 | 7 | void mathlib::RealFFT1D::real_fft_backward1D(int N, int INC, std::vector &R, int LENR, 8 | std::vector &WSAVE, int LENSAV, std::vector &WORK, int LENWRK, int IER) 9 | { 10 | RFFT1B(&N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 11 | } 12 | 13 | void mathlib::RealFFT1D::real_fft__forward1D(int N, int INC, std::vector &R, int LENR, 14 | std::vector &WSAVE, int LENSAV, std::vector &WORK, int LENWRK, int IER) 15 | { 16 | RFFT1F(&N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 17 | } -------------------------------------------------------------------------------- /MathLib/Include/Real_FFT_2D.h: -------------------------------------------------------------------------------- 1 | #ifndef _REAL_FFT_2D_H_ 2 | #define _REAL_FFT_2D_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Real FFT forward/backward Direction 2D class - definition. 6 | @file: Real_FFT_2D.h 7 | Wrapper around FFTPACK 5.1 library 8 | @author: Bernard Gingold 9 | @version: 1.0 26/10/2015 10 | @description: file F77_FFT_DECLARATIONS.h 11 | 12 | */ 13 | 14 | #include "MathLibDefinitions.h" 15 | #include "F77_FFT_DECLARATIONS.h" 16 | 17 | namespace mathlib 18 | { 19 | 20 | 21 | 22 | class RealFFT2D 23 | { 24 | public: 25 | 26 | /* 27 | @brief wrapper for F77 RFFT2I routine. 28 | For description of arguments go to F77_FFT_DECLARATIONS.h file 29 | */ 30 | void real_fft_init2D(int , 31 | int , 32 | std::vector & , 33 | int , 34 | int ); 35 | 36 | /* 37 | @brief wrapper for F77 RFFT2B routine 38 | 4th argument should be vector set to size of LDIMxM 39 | */ 40 | void real_fft_backward2D(int , 41 | int , 42 | int , 43 | std::vector &, 44 | std::vector &, 45 | int , 46 | std::vector &, 47 | int , 48 | int ); 49 | 50 | /* 51 | @brief wrapper for F77 RFFT2F routine 52 | 4th argument should be set to size of LDIMxM 53 | */ 54 | void real_fft_forward2D(int , 55 | int , 56 | int , 57 | std::vector &, 58 | std::vector &, 59 | int , 60 | std::vector &, 61 | int , 62 | int ); 63 | }; 64 | 65 | #include "Real_FFT_2D.inl" 66 | } 67 | #endif /*_REAL_FFT_2D_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Real_FFT_2D.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Real FFT forward/backward Direction 1D class - wrapper implementation. 4 | Wrapper around FFTPACK 5.1 library 5 | @author: Bernard Gingold 6 | @version: 1.0 26/10/2015 7 | 8 | */ 9 | 10 | void mathlib::RealFFT2D::real_fft_init2D(int L, int M, std::vector &WSAVE, int LENSAV, int IER) 11 | { 12 | RFFT2I(&L, &M, &WSAVE[0], &LENSAV, &IER); 13 | } 14 | 15 | void mathlib::RealFFT2D::real_fft_backward2D(int LDIM, int L, int M, std::vector &R, 16 | std::vector &WSAVE, int LENSAV, std::vector &WORK, int LENWRK, int IER) 17 | { 18 | RFFT2B(&LDIM, &L, &M, &R[0], &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 19 | } 20 | 21 | void mathlib::RealFFT2D::real_fft_forward2D(int LDM, int L, int M, std::vector &R, 22 | std::vector &WSAVE, int LENSAV, std::vector &WORK, int LENWRK, int IER) 23 | { 24 | RFFT2F(&LDM, &L, &M, &R[0], &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 25 | } -------------------------------------------------------------------------------- /MathLib/Include/Real_FFT_Multiple.h: -------------------------------------------------------------------------------- 1 | #ifndef _REAL_FFT_MULTIPLE_H_ 2 | #define _REAL_FFT_MULTIPLE_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Real FFT forward/backward Direction Multiple class - definition. 6 | Wrapper around FFTPACK 5.1 library 7 | @file Real_FFT_Multiple.h 8 | @author: Bernard Gingold 9 | @version: 1.0 26/10/2015 10 | @description F77_FFT_DECLARATIONS.h 11 | 12 | */ 13 | 14 | #include "MathLibDefinitions.h" 15 | #include "F77_FFT_DECLARATIONS.h" 16 | 17 | namespace mathlib 18 | { 19 | 20 | class RealFFTMultiple 21 | { 22 | 23 | 24 | public: 25 | 26 | 27 | /* 28 | @brief wrapper for F77 RFFTMI routine 29 | */ 30 | void real_fft_multiple_init(int, 31 | std::vector &, 32 | int, 33 | int); 34 | 35 | 36 | /* 37 | @brief wrapper for F77 RFFTMB routine. 38 | 39 | */ 40 | void real_fft_multiple_backward(int, 41 | int, 42 | int, 43 | int, 44 | std::vector &, 45 | int, 46 | std::vector &, 47 | int, 48 | std::vector &, 49 | int, 50 | int); 51 | 52 | /* 53 | @brief wrapper for F77 RFFTMF routine. 54 | */ 55 | void real_fft_multiple_forward(int, 56 | int, 57 | int, 58 | int, 59 | std::vector &, 60 | int, 61 | std::vector &, 62 | int, 63 | std::vector &, 64 | int, 65 | int); 66 | 67 | 68 | }; 69 | 70 | #include "Real_FFT_Multiple.inl" 71 | } 72 | #endif/*_REAL_FFT_MULTIPLE_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Real_FFT_Multiple.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Real FFT forward/backward Direction Multiple class - implementation. 4 | Wrapper around FFTPACK 5.1 library 5 | @file Real_FFT_Multiple.h 6 | @author: Bernard Gingold 7 | @version: 1.0 26/10/2015 8 | @description F77_FFT_DECLARATIONS.h 9 | 10 | */ 11 | 12 | void mathlib::RealFFTMultiple::real_fft_multiple_init(int N, std::vector &WSAVE, 13 | int LENSAV, int IER) 14 | { 15 | RFFTMI(&N, &WSAVE[0], &LENSAV, &IER); 16 | } 17 | 18 | 19 | void mathlib::RealFFTMultiple::real_fft_multiple_backward(int LOT, int JUMP, int N, int INC, 20 | std::vector &R, int LENR, std::vector &WSAVE, int LENSAV, 21 | std::vector &WORK, int LENWRK, int IER) 22 | { 23 | RFFTMB(&LOT, &JUMP, &N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 24 | } 25 | 26 | 27 | void mathlib::RealFFTMultiple::real_fft_multiple_forward(int LOT, int JUMP, int N, int INC, 28 | std::vector &R, int LENR, std::vector &WSAVE, int LENSAV, 29 | std::vector &WORK, int LENWRK, int IER) 30 | { 31 | RFFTMF(&LOT, &JUMP, &N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 32 | } -------------------------------------------------------------------------------- /MathLib/Include/Real_SinFFT_1D.h: -------------------------------------------------------------------------------- 1 | #ifndef _REAL_SINE_FFT_1D_H_ 2 | #define _REAL_SINE_FFT_1D_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Real Sine FFT forward/backward Direction 1D class - wrapper definition. 6 | Wrapper around FFTPACK 5.1 library 7 | @file Real_SinFFT_1D.h 8 | @author: Bernard Gingold 9 | @version: 1.0 26/10/2015 10 | @description: in F77_FFT_DECLARATIONS.h 11 | */ 12 | 13 | #include "MathLibDefinitions.h" 14 | #include "F77_FFT_DECLARATIONS.h" 15 | 16 | namespace mathlib 17 | { 18 | 19 | class RealSinFFT1D 20 | { 21 | 22 | public: 23 | 24 | 25 | /* 26 | @brief wrapper for F77 SINT1I routine. 27 | */ 28 | void real_sinfft_init1D(int, 29 | std::vector &, 30 | int, 31 | int); 32 | 33 | /* 34 | @brief wrapper for F77 SINT1B routine 35 | */ 36 | void real_sinfft_backward1D(int, 37 | int, 38 | std::vector &, 39 | int, 40 | std::vector &, 41 | int, 42 | std::vector &, 43 | int, 44 | int); 45 | 46 | /* 47 | @brief wrapper for F77 SINT1F routine. 48 | */ 49 | void real_sinfft_forward1D(int, 50 | int, 51 | std::vector &, 52 | int, 53 | std::vector &, 54 | int, 55 | std::vector &, 56 | int, 57 | int); 58 | 59 | }; 60 | 61 | #include "Real_SinFFT_1D.inl" 62 | } 63 | #endif /*_REAL_SINE_FFT_1D_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Real_SinFFT_1D.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Real Sine FFT forward/backward Direction 1D class - wrapper implementation. 4 | Wrapper around FFTPACK 5.1 library 5 | @file Real_SinFFT_1D.inl 6 | @author: Bernard Gingold 7 | @version: 1.0 26/10/2015 8 | @description: in F77_FFT_DECLARATIONS.h 9 | */ 10 | 11 | void mathlib::RealSinFFT1D::real_sinfft_init1D(int N, std::vector &WSAVE, 12 | int LENSAV, int IER) 13 | { 14 | // Call Fortran SINT1 routine. 15 | SINT1I(&N, &WSAVE[0], &LENSAV, &IER); 16 | } 17 | 18 | void mathlib::RealSinFFT1D::real_sinfft_backward1D(int N, int INC, std::vector &R, 19 | int LENR, std::vector &WSAVE, int LENSAV, std::vector &WORK, 20 | int LENWRK, int IER) 21 | { 22 | // Call Fortran SINT1B routine. 23 | SINT1B(&N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 24 | } 25 | 26 | void mathlib::RealSinFFT1D::real_sinfft_forward1D(int N, int INC, std::vector &R, 27 | int LENR, std::vector &WSAVE, int LENSAV, std::vector &WORK, 28 | int LENWRK, int IER) 29 | { 30 | // Call Fortran SINT1F routine. 31 | SINT1F(&N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /MathLib/Include/Real_SinFFT_Multiple.h: -------------------------------------------------------------------------------- 1 | #ifndef _REAL_SIN_FFT_MULTIPLE_H_ 2 | #define _REAL_SIN_FFT_MULTIPLE_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Real Sine FFT forward/backward Multiple class - wrapper definition. 6 | Wrapper around FFTPACK 5.1 library 7 | @file Real_SinFFT_Multiple.h 8 | @author: Bernard Gingold 9 | @version: 1.0 26/10/2015 10 | @description: in F77_FFT_DECLARATIONS.h 11 | */ 12 | 13 | #include "MathLibDefinitions.h" 14 | #include "F77_FFT_DECLARATIONS.h" 15 | 16 | namespace mathlib 17 | { 18 | 19 | 20 | class RealSinFFTMultiple 21 | { 22 | 23 | 24 | public: 25 | 26 | 27 | /* 28 | @brief wrapper for F77 SINTMI routine. 29 | */ 30 | void real_sinfft_multiple_init(int, 31 | std::vector &, 32 | int, 33 | int); 34 | 35 | /* 36 | @brief wrapper for F77 SINTMB routine. 37 | */ 38 | void real_sinfft_multiple_backward(int, 39 | int, 40 | int, 41 | int, 42 | std::vector &, 43 | int, 44 | std::vector &, 45 | int, 46 | std::vector &, 47 | int, 48 | int); 49 | 50 | /* 51 | @brief wrapper for F77 SINTMF routine. 52 | */ 53 | void real_sinfft_multiple_forward(int, 54 | int, 55 | int, 56 | int, 57 | std::vector &, 58 | int, 59 | std::vector &, 60 | int, 61 | std::vector &, 62 | int, 63 | int); 64 | }; 65 | 66 | #include "Real_SinFFT_Multiple.inl" 67 | } 68 | #endif /*_REAL_SIN_FFT_MULTIPLE_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Real_SinFFT_Multiple.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | Real Sine FFT forward/backward Multiple class - wrapper implementation. 3 | Wrapper around FFTPACK 5.1 library 4 | @file Real_SinFFT_Multiple.inl 5 | @author: Bernard Gingold 6 | @version: 1.0 26/10/2015 7 | @description: in F77_FFT_DECLARATIONS.h 8 | */ 9 | 10 | void mathlib::RealSinFFTMultiple::real_sinfft_multiple_init(int N, std::vector &WSAVE, 11 | int LENSAV, int IER) 12 | { 13 | // Call Fortran SINTMI subroutine. 14 | SINTMI(&N, &WSAVE[0], &LENSAV, &IER); 15 | } 16 | 17 | void mathlib::RealSinFFTMultiple::real_sinfft_multiple_backward(int LOT, int JUMP, int N, int INC, 18 | std::vector &R, int LENR, std::vector &WSAVE, int LENSAV, 19 | std::vector &WORK, int LENWRK, int IER) 20 | { 21 | // Call Fortran SINTMB subroutine. 22 | SINTMB(&LOT, &JUMP, &N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 23 | } 24 | 25 | void mathlib::RealSinFFTMultiple::real_sinfft_multiple_forward(int LOT, int JUMP, int N, int INC, 26 | std::vector &R, int LENR, std::vector &WSAVE, int LENSAV, 27 | std::vector &WORK, int LENWRK, int IER) 28 | { 29 | // Call Fortran SINTMF subroutine. 30 | SINTMF(&LOT, &JUMP, &N, &INC, &R[0], &LENR, &WSAVE[0], &LENSAV, &WORK[0], &LENWRK, &IER); 31 | } -------------------------------------------------------------------------------- /MathLib/Include/RungeKuttaWrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef _RUNGE_KUTTA_WRAPPER_H_ 2 | #define _RUNGE_KUTTA_WRAPPER_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Runge-Kutta Wrapper class - wrapper definitions. 6 | Wrapper around RKSUITE Library. 7 | @file RungeKuttaWrapper.h 8 | @author: Bernard Gingold 9 | @version: 1.0 26/10/2015 10 | @description: in RungeKutta_F77_Declarations.h 11 | */ 12 | 13 | #include "MathLibDefinitions.h" 14 | #include "RungeKutta_F77_Declarations.h" 15 | 16 | namespace mathlib 17 | { 18 | 19 | class RungeKuttaSolver 20 | { 21 | 22 | public: 23 | 24 | 25 | /* 26 | @brief C++ wrapper for Fortran 77 SUBROUTINE SETUP(NEQ,TSTART,YSTART,TEND,TOL,THRES,METHOD,TASK, 27 | ERRASS,HSTART,WORK,LENWRK,MESAGE) 28 | */ 29 | static void rk_setup(int, double, double *, 30 | double, double, double *, int, 31 | unsigned char *, int, double, double *, 32 | int, int); 33 | 34 | /* 35 | @brief C++ wrapper for Fortran 77 SUBROUTINE UT(F,TWANT,TGOT,YGOT,YPGOT,YMAX,WORK,UFLAG) 36 | */ 37 | static void rk_ut(void(*)(double * , double *, double *), double, double, 38 | double *, double *, double *, double *, int); 39 | 40 | 41 | /* 42 | @brief C++ wrapper for Fortran 77 SUBROUTINE STAT(TOTFCN,STPCST,WASTE,STPSOK,HNEXT) 43 | */ 44 | static void rk_stat(int, int, double, int, double); 45 | 46 | /* 47 | @brief C++ wrapper for Fortran 77 SUBROUTINE GLBERR(RMSERR,ERRMAX,TERRMX,WORK) 48 | 49 | */ 50 | static void rk_glberr(double *, double, double, 51 | double *); 52 | 53 | /* 54 | @brief C++ wrapper for Fortran 77 SUBROUTINE CT(F,TNOW,YNOW,YPNOW,WORK,CFLAG) 55 | */ 56 | static void rk_ct(void(*)(double * , double *, double *), double, 57 | double *, double *, double *, int); 58 | 59 | /* 60 | @brief C++ wrapper for Fortran 77 SUBROUTINE INTRP(TWANT,REQEST,NWANT,YWANT,YPWANT,F,WORK,WRKINT, 61 | LENINT) 62 | */ 63 | static void rk_intrp(double, unsigned char *, int, double *, 64 | double *, void(*)(double * , double *, double *), 65 | double *, double *, int); 66 | 67 | /* 68 | @brief C++ wrapper for Fortran 77 SUBROUTINE RESET(TENDNU) 69 | */ 70 | static void rk_reset(double); 71 | 72 | /* 73 | @brief C++ wrapper for Fortran 77 SUBROUTINE ENVIRN(OUTCH,MCHEPS,DWARF) 74 | */ 75 | static void rk_envirn(int, double, double); 76 | }; 77 | 78 | #include "RungeKuttaWrapper.inl" 79 | } 80 | #endif /*_RUNGE_KUTTA_WRAPPER_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/RungeKuttaWrapper.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | Runge-Kutta Wrapper class - wrapper implementation. 3 | Wrapper around RKSUITE Library. 4 | @file RungeKuttaWrapper.inl 5 | @author: Bernard Gingold 6 | @version: 1.0 26/10/2015 7 | @description: in RungeKutta_F77_Declarations.h 8 | */ 9 | 10 | void mathlib::RungeKuttaSolver::rk_setup(int NEQ, double TSTART,double* YSTART, 11 | double TEND, double TOL, double* THRES, int METHOD, unsigned char* TASK, 12 | int ERRASS, double HSTART, double* WORK, int LENWRK, int MESAGE) 13 | { 14 | // Call F77 SUBROUTINE SETUP. 15 | 16 | SETUP(&NEQ, &TSTART, &YSTART[0], &TEND, &TOL, &THRES[0], &METHOD, &TASK[0], &ERRASS, &HSTART, &WORK[0], &LENWRK, &MESAGE); 17 | 18 | 19 | } 20 | 21 | void mathlib::RungeKuttaSolver::rk_ut(void(*F)(double * , double *, double *), double TWANT, 22 | double TGOT, double* YGOT, double* YPGOT, double* YMAX, double* WORK, int UFLAG) 23 | 24 | { 25 | 26 | // Call F77 SUBROUTINE SETUP. 27 | UT(F, &TWANT, &TGOT, &YGOT[0], &YPGOT[0], &YMAX[0], &WORK[0], &UFLAG); 28 | 29 | } 30 | 31 | void mathlib::RungeKuttaSolver::rk_stat(int TOTFCN, int STPCST, double WASTE, int STPSOK, double HNEXT) 32 | { 33 | // Call F77 SUBROUTINE STAT. 34 | STAT(&TOTFCN, &STPCST, &WASTE, &STPSOK, &HNEXT); 35 | std::printf("Total calls of Derivative:%d\n", TOTFCN); 36 | std::printf("Number of Derivative calls per step:%d\n", STPCST); 37 | std::printf("The fraction od failed steps:%.15f\n", WASTE); 38 | std::printf("Number of useful steps:%d\n", STPSOK); 39 | std::printf("Integrator next step size:%.15f\n", HNEXT); 40 | } 41 | 42 | void mathlib::RungeKuttaSolver::rk_glberr(double* RMSERR, double ERRMAX, double TERRMX, double* WORK) 43 | { 44 | // Call F77 SUBROUTINE GLBERR. 45 | GLBERR(&RMSERR[0], &ERRMAX, &TERRMX, &WORK[0]); 46 | } 47 | 48 | void mathlib::RungeKuttaSolver::rk_ct(void(*F)(double *, double *, double *), double TNOW, double* YNOW, 49 | double* YPNOW, double* WORK, int CFLAG) 50 | { 51 | // Call F77 SUBROUTINE CT. 52 | CT(F, &TNOW, &YNOW[0], &YPNOW[0], &WORK[0], &CFLAG); 53 | 54 | } 55 | 56 | void mathlib::RungeKuttaSolver::rk_intrp(double TWANT, unsigned char* REQUEST, int NWANT, double* YWANT, 57 | double* YPWANT, void(*F)(double *, double *, double *), double* WORK, double* WRKINT, int LENINT) 58 | 59 | { 60 | // Call F77 SUBROUTINE INTRP 61 | INTRP(&TWANT, &REQUEST[0], &NWANT, &YWANT[0], &YPWANT[0], F, &WORK[0], &WRKINT[0], &LENINT); 62 | } 63 | 64 | void mathlib::RungeKuttaSolver::rk_reset(double TENDNU) 65 | { 66 | // Call F77 SUBROUTINE RESET. 67 | RESET(&TENDNU); 68 | } 69 | 70 | void mathlib::RungeKuttaSolver::rk_envirn(int OUTCH, double MCHEPS, double DWARF) 71 | { 72 | // Call F77 SUBROUTINE ENVIRN 73 | ENVIRN(&OUTCH, &MCHEPS, &DWARF); 74 | } 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /MathLib/Include/SinusCFunctions.inl: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 4 | Wrapper Class around boost::math::sinc functions. 5 | @author: Bernard Gingold 6 | @version: 1.0 23/09/2015 7 | */ 8 | 9 | _Maybe_raises_SEH_exception_ __forceinline float mathlib::SinCFunctionsWrapper::sinc_pif(_In_ const float x) 10 | { 11 | return boost::math::sinc_pi(x); 12 | } 13 | 14 | _Raises_SEH_exception_ template __forceinline float mathlib::SinCFunctionsWrapper::sinc_pif(_In_ const float x, _In_ const Policy &pol) 15 | { 16 | return boost::math::sinc_pi(x, pol); 17 | } 18 | 19 | _Maybe_raises_SEH_exception_ __forceinline double mathlib::SinCFunctionsWrapper::sinc_pid(_In_ const double x) 20 | { 21 | return boost::math::sinc_pi(x); 22 | } 23 | 24 | _Raises_SEH_exception_ template __forceinline double mathlib::SinCFunctionsWrapper::sinc_pid(_In_ const double x, _In_ const Policy &pol) 25 | { 26 | return boost::math::sinc_pi(x, pol); 27 | } 28 | 29 | _Maybe_raises_SEH_exception_ __forceinline float mathlib::SinCFunctionsWrapper::sinhc_pif(_In_ const float x) 30 | { 31 | return boost::math::sinhc_pi(x); 32 | } 33 | 34 | _Raises_SEH_exception_ template __forceinline float mathlib::SinCFunctionsWrapper::sinhc_pif(_In_ const float x, _In_ const Policy &pol) 35 | { 36 | return boost::math::sinhc_pi(x, pol); 37 | } 38 | 39 | _Maybe_raises_SEH_exception_ __forceinline double mathlib::SinCFunctionsWrapper::sinhc_pid(_In_ const double x) 40 | { 41 | return boost::math::sinhc_pi(x); 42 | } 43 | 44 | _Raises_SEH_exception_ template __forceinline double mathlib::SinCFunctionsWrapper::sinhc_pid(_In_ const double x, _In_ const Policy &pol) 45 | { 46 | return boost::math::sinhc_pi(x, pol); 47 | } -------------------------------------------------------------------------------- /MathLib/Include/TrapezoidQuadrature.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRAPEZOID_QUADRATURE_H_ 2 | #define _TRAPEZOID_QUADRATURE_H_ 3 | 4 | #include "MathLibDefinitions.h" 5 | #include "Derivative.h" 6 | 7 | namespace mathlib 8 | { 9 | 10 | template class TrapezoidRule 11 | { 12 | 13 | 14 | public: 15 | 16 | template __forceinline static TrapezoidRule integrate(Function, _Ty, _Ty, const int); 17 | 18 | __forceinline const _Ty get_integral() const; 19 | 20 | __forceinline _Ty get_integral(); 21 | 22 | __forceinline const _Ty get_error() const; 23 | 24 | __forceinline _Ty get_error(); 25 | 26 | private: 27 | 28 | _Ty integral; 29 | 30 | _Ty error; 31 | 32 | __forceinline TrapezoidRule(const _Ty, const _Ty); 33 | 34 | template __forceinline static _Ty compute_error(Function, _Ty, _Ty, _Ty); 35 | }; 36 | 37 | // Another implementation of templated Trapezoid Quadrature. 38 | template< typename _Ty> class Trapzd 39 | { 40 | 41 | public: 42 | 43 | __forceinline Trapzd(); 44 | 45 | __forceinline Trapzd(const double, const double, const int,_Ty &functor); 46 | 47 | __forceinline Trapzd(const Trapzd &); 48 | 49 | __forceinline Trapzd & integrate(); 50 | 51 | __forceinline Trapzd & integrate_refined(const double); 52 | 53 | __forceinline double get_integral() const; 54 | 55 | __forceinline double get_a() const; 56 | 57 | __forceinline double get_b() const; 58 | 59 | 60 | 61 | __forceinline double get_error() const; 62 | 63 | __forceinline int get_n() const; 64 | 65 | private: 66 | 67 | __forceinline void compute_error(double); 68 | 69 | double a, b, integral,error; 70 | int n; 71 | _Ty &functor; 72 | }; 73 | 74 | #include "TrapezoidQuadrature.inl" 75 | } 76 | #endif /*_TRAPEZOID_QUADRATURE_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/TrigFuncLUT.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRIG_FUNC_LUT_H_ 2 | #define _TRIG_FUNC_LUT_H_ 3 | 4 | #include "MathLibDefinitions.h" 5 | 6 | 7 | namespace mathlib 8 | { 9 | 10 | template class SinCoeffLUT 11 | { 12 | 13 | public: 14 | 15 | 16 | 17 | /* 18 | @brief static const array of 8*8 Sin(2*Pi*k*i/T) elements where T=8, k=1....8, i=0...7. 19 | */ 20 | static const _Ty m_sSinCoeff8x8[64]; 21 | 22 | 23 | /* 24 | @brief static const array of 8*8 Sin(Pi*k*i/T) of half period elements where, T=8, k=1....8, i=0....7. 25 | */ 26 | static const _Ty m_sSinCoeffH8x8[64]; 27 | 28 | /* 29 | @brief static const array of 16*16 Sin(2*Pi*k*i/T) elements where, T=16, k=1....16, i=0....15. 30 | */ 31 | static const _Ty m_sSinCoeff16x16[256]; 32 | 33 | /* 34 | @brief static const array of 16*16 Sin(Pi*k*i/T) of half period elements where, T=16, k=1....16, i=0....15. 35 | */ 36 | static const _Ty m_sSinCoeffH16x16[256]; 37 | 38 | /* 39 | @brief static const array of 32*32 Sin(2*Pi*k*i/T) elements where, T=16, k=1....32, i=0....31. 40 | */ 41 | static const _Ty m_sSinCoeff32x32[1024]; 42 | 43 | }; 44 | 45 | 46 | template class CosCoeffLUT 47 | { 48 | 49 | public: 50 | 51 | 52 | /* 53 | @brief static constexpr array of 8*8 Cos(2*Pi*k*i/T) where T=8, k=1....8, i=0...7. 54 | */ 55 | static const _Ty m_sCosCoeff8x8[64]; 56 | 57 | /* 58 | @brief static const array of 8*8 Cos(Pi*k*i/T) half period elements where t=8, k=1....8, i=0....7. 59 | */ 60 | static const _Ty m_sCosCoeffH8x8[64]; 61 | 62 | /* 63 | @brief static const array of 16*16 Cos(2*Pi*k*i/T) elements where, T=16, k=1....16, i=0....15. 64 | */ 65 | static const _Ty m_sCosCoeff16x16[256]; 66 | 67 | /* 68 | @brief static const array of 16*16 Cos(Pi*k*i/T) of half period elements where, T=16, k=1....16, i=0....15. 69 | */ 70 | static const _Ty m_sCosCoeffH16x16[256]; 71 | 72 | /* 73 | @brief static const array of 32*32 Sin(2*Pi*k*i/T) elements where, T=16, k=1....32, i=0....31. 74 | */ 75 | static const _Ty m_sCosCoeff32x32[1024]; 76 | }; 77 | 78 | #include "TrigFuncLUT.inl" 79 | } 80 | #endif /*_TRIG_FUNC_LUT_H_*/ -------------------------------------------------------------------------------- /MathLib/Include/Version.inl: -------------------------------------------------------------------------------- 1 | 2 | 3 | inline int mathlib::version_info::CMathlib_Version_Info::getVersion_Major()const{ 4 | return (this->m_VersionMajor); 5 | } 6 | 7 | inline int mathlib::version_info::CMathlib_Version_Info::getVersion_Minor()const{ 8 | return (this->m_VersionMinor); 9 | } 10 | 11 | inline int mathlib::version_info::CMathlib_Version_Info::getPatch_Version()const { 12 | return (this->m_PatchVersion); 13 | } 14 | 15 | inline int mathlib::version_info::CMathlib_Version_Info::getLib_Version()const { 16 | return (this->m_LibVersion); 17 | } -------------------------------------------------------------------------------- /MathLib/Include/functions_scalar.h: -------------------------------------------------------------------------------- 1 | #ifndef _FUNCTIONS_SCALAR_H_ 2 | #define _FUNCTIONS_SCALAR_H_ 3 | 4 | #include 5 | 6 | #include "MathLibDefinitions.h" 7 | #include "MathConstants.h" 8 | 9 | namespace mathlib 10 | { 11 | template class FastScalarFunctions 12 | { 13 | 14 | 15 | public: 16 | 17 | __forceinline static std::enable_if::value, _Ty>::type fastcot(const _Ty&); 18 | 19 | __forceinline static std::enable_if::value, _Ty>::type fastsin(const _Ty&); 20 | 21 | __forceinline static std::enable_if::value, _Ty>::type fastcos(const _Ty&); 22 | 23 | __forceinline static std::enable_if::value, _Ty>::type fasttan(const _Ty&); 24 | 25 | __forceinline static std::enable_if::value, _Ty>::type fastexp(const _Ty&); 26 | 27 | __forceinline static std::enable_if::value, _Ty>::type fastcsc(const _Ty&); 28 | 29 | __forceinline static std::enable_if::value, _Ty>::type fastsec(const _Ty&); 30 | 31 | __forceinline static std::enable_if::value, _Ty>::type fastarcsin(const _Ty&); 32 | 33 | 34 | }; 35 | 36 | 37 | #include "functions_scalar.inl" 38 | 39 | } 40 | 41 | #endif /*_FUNCTIONS_SCALAR_H_*/ -------------------------------------------------------------------------------- /MathLib/MathLib.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /MathLibTest/Include/ConstantsTest.h: -------------------------------------------------------------------------------- 1 | #ifndef _CONSTANTS_TESTS_H_ 2 | #define _CONSTANTS_TESTS_H_ 3 | 4 | #include "../MathLib/MathConstants.h" 5 | 6 | namespace test 7 | { 8 | class ConstantsTestClass 9 | { 10 | 11 | public: 12 | 13 | static double Test_PI_DBL(); 14 | 15 | static double Test_PI_FLT(); 16 | }; 17 | 18 | 19 | } 20 | #endif /*_CONSTANTS_TESTS_H_*/ -------------------------------------------------------------------------------- /MathLibTest/Include/IntegratorGKMultiPoint_TEST.h: -------------------------------------------------------------------------------- 1 | #ifndef _INTEGRATOR_GK_MULTI_POINT_TEST_H_ 2 | #define _INTEGRATOR_GK_MULTI_POINT_TEST_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Integrator Gauss-Kronord Wrapper Test class - definition. 6 | . 7 | @file IntegratorGKMultiPoint_TEST.h 8 | @author: Bernard Gingold 9 | @version: 1.0 26/10/2015 10 | @description: in QUADRATURE_F77_DECLARATIONS.h 11 | */ 12 | 13 | #include "../MathLib/IntegratorGKMultiPoint.h" 14 | 15 | namespace test 16 | { 17 | 18 | 19 | class GaussKronordTests 20 | { 21 | 22 | 23 | public: 24 | 25 | 26 | /* 27 | @brief Test Gaussian-Kronord 15 points Quadrature. 28 | Integrand = e^-px dx. 29 | 30 | */ 31 | void static GK15ExpFunc1(); 32 | 33 | /* 34 | @brief Test of Gaussian-Kronord 15-points Quadrature. 35 | Integrand = dx/1+e^px 36 | */ 37 | void static GK15ExpFunc2(); 38 | 39 | /* 40 | @brief Test of Gaussian-Kronord 15-points Quadrature. 41 | Integrand = e^-ux/1+e-x dx 42 | */ 43 | void static GK15ExpFunc3(); 44 | 45 | /* 46 | @brief Test of Gaussian-Kronrod 15-points Quadrature. 47 | Integrand = (1 - cos(x))^n*sin(n*x)dx 48 | */ 49 | void static GK15TrigFunc1(); 50 | 51 | /* 52 | @brief Test of Gaussian-Kronrod 15-points Quadrature. 53 | Integrand = (sin(nx))/sin(x)dx 54 | */ 55 | void static GK15TrigFunc2(); 56 | 57 | /* 58 | @brief Test runner method. 59 | */ 60 | void static RunGK15ExpFuncTests(); 61 | 62 | /* 63 | @brief Test runner method. 64 | */ 65 | void static RunGK15TrigFuncTests(); 66 | 67 | 68 | private: 69 | 70 | /* 71 | @brief Templated static member integral function(real value of Integral(symbolic)). 72 | */ 73 | template __forceinline static _x Integral(_Fx fx, const _x x) 74 | { 75 | return _Fx(x); 76 | } 77 | 78 | const static double MACHPREC; 79 | }; 80 | } 81 | #endif /*_INTEGRATOR_GK_MULTI_POINT_TEST_H_*/ -------------------------------------------------------------------------------- /MathLibTest/Include/RungeKuttaWraper_TEST.h: -------------------------------------------------------------------------------- 1 | #ifndef _RUNGE_KUTTA_WRAPPER_TEST_H_ 2 | #define _RUNGE_KUTTA_WRAPPER_TEST_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Runge-Kutta Wrapper Test class - definition. 6 | . 7 | @file RungeKuttaWrapper_TEST.h 8 | @author: Bernard Gingold 9 | @version: 1.0 26/10/2015 10 | @description: in RungeKutta_F77_Declarations.h 11 | */ 12 | 13 | //#include "../MathLib/RungeKuttaWrapper.h" 14 | #include 15 | 16 | #include "../MathLib/RungeKutta_F77_Declarations.h" 17 | 18 | namespace test 19 | { 20 | 21 | 22 | struct BPARAM 23 | { 24 | double B; 25 | }; 26 | 27 | class RKWTest 28 | { 29 | 30 | public: 31 | 32 | static void Test1_RungeKutta(); 33 | 34 | static void Test2_RungeKutta(); 35 | 36 | static void Test3_RungeKutta(); 37 | 38 | static void Test4_RungeKutta(); 39 | 40 | static void Run_Tests(); 41 | 42 | 43 | static void DerivY(double *, double *, double *); 44 | 45 | 46 | private: 47 | 48 | static void perf(unsigned long long*, unsigned long long*, int, const char*); 49 | 50 | static void perf(std::vector &, std::vector &, std::string const&); 51 | }; 52 | } 53 | #endif /*_RUNGE_KUTTA_WRAPPER_TEST_H_*/ -------------------------------------------------------------------------------- /MathLibTest/Include/TrapezoidQuadrature_TEST.h: -------------------------------------------------------------------------------- 1 | #ifndef _TRAPEZOID_QUADRATURE_TEST_H_ 2 | #define _TRAPEZOID_QUADRATURE_TEST_H_ 3 | 4 | #include "../MathLib/TrapezoidQuadrature.h" 5 | 6 | namespace test 7 | { 8 | class TrapezoidQuadratureTest 9 | { 10 | 11 | 12 | public: 13 | 14 | template __forceinline static double Integral(Function, const double); 15 | 16 | // Test Quadrature of simple polynomial Integrals: 17 | // x dx, x^2 dx , x3/3 dx , etc.... 18 | void static Test_Trapezoid_Quadrature(); 19 | 20 | // Test Quadrature of simple polynomial Integrals: 21 | // x dx, x^2 dx , x3/3 dx , etc.... 22 | // Varying number of quadrature steps. 23 | void static Test_Trapezoid_Quadrature_Varying_Steps(); 24 | 25 | // Test Quadrature of simple polynomial Integrals: 26 | // x dx, x^2 dx , x3/3 dx , etc.... 27 | // Varying number of quadrature steps and interval ranges. 28 | void static Test_Trapezoid_Quadrature_Varying_Steps(double, double); 29 | 30 | // Test Quadrature of simple polynomial Integrals: 31 | // x dx, x^2 dx , x3/3 dx , etc.... 32 | // Varying number of quadrature steps and abscissa range. 33 | // Should be used only with small step size(overflow!!). 34 | void static Test_Trapezoid_Quadrature_Varying_Abscissa_Steps(); 35 | 36 | // Test Quadrature of simple polynomial Integrals: 37 | // x dx, x^2 dx , x3/3 dx , etc.... 38 | // Varying abscissa range per loop iteration. 39 | void static Test_Trapezoid_Quadrature_Varying_Abscissas(); 40 | 41 | 42 | // Test Quadrature of transcendental function Integrals. 43 | void static Test_Trapezoid_Quadrature_Transc(); 44 | 45 | // Test Quadrature of transcendental function Integrals. 46 | // Varying abscissa range per loop iteration 47 | void static Test_Trapezoid_Quadrature_Transc_Var_Abscissa(); 48 | 49 | // Test Quadrature of transcendental function Integrals. 50 | // Varying number of quadrature steps. 51 | void static Test_Trapezoid_Quadrature_Transc_Var_Steps(); 52 | 53 | 54 | 55 | 56 | 57 | void static Run_Trapezoid_Quadrature_Tests(); 58 | 59 | void static Run_Trapezoid_Varying_Abscissa_Tests(); 60 | 61 | void static Run_Trapezoid_Varying_Step_Tests(); 62 | 63 | void static Run_Trapezoid_Varying_Abscissa_Step_Tests(); 64 | }; 65 | 66 | #include "TrapezoidQuadrature_TEST.inl" 67 | } 68 | #endif /*_TRAPEZOID_QUADRATURE_TEST_H_*/ -------------------------------------------------------------------------------- /MathLibTest/Include/TrapezoidQuadrature_TEST.inl: -------------------------------------------------------------------------------- 1 | 2 | template __forceinline double test::TrapezoidQuadratureTest::Integral(Function integral, const double arg) 3 | { 4 | return integral(arg); 5 | } 6 | 7 | -------------------------------------------------------------------------------- /MathLibTest/MathLibTests.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | Source Files 49 | 50 | 51 | Source Files 52 | 53 | 54 | Source Files 55 | 56 | 57 | Source Files 58 | 59 | 60 | Source Files 61 | 62 | 63 | 64 | 65 | Header Files 66 | 67 | 68 | -------------------------------------------------------------------------------- /MathLibTest/MathLibTests.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MissileSimulation 2 | Air-to-Air Radar Guided Missile Modelling and Simulation Project. 3 | Project's details are located in Wiki page. 4 | Important notice -- This project is no longer developed -- please refer to my 5 | pinned projects 6 | -------------------------------------------------------------------------------- /Radiolocation/Include/CWCosine.inl: -------------------------------------------------------------------------------- 1 | __forceinline std::vector> radiolocation::CWCosineSignal::get_cos_signal() const 2 | { 3 | return this->m_cos_signal; 4 | } 5 | 6 | __forceinline std::vector radiolocation::CWCosineSignal::get_signal_envelope() const 7 | { 8 | return this->m_envelope; 9 | } 10 | 11 | 12 | __forceinline std::vector radiolocation::CWCosineSignal::get_phase() const 13 | { 14 | return this->m_phase; 15 | } 16 | 17 | 18 | __forceinline double radiolocation::CWCosineSignal::get_duration() const 19 | { 20 | return this->m_duration; 21 | } 22 | 23 | __forceinline double radiolocation::CWCosineSignal::get_frequency() const 24 | { 25 | return this->m_frequency; 26 | } 27 | 28 | __forceinline double radiolocation::CWCosineSignal::get_env_frequency() const 29 | { 30 | return this->m_efrequency; 31 | } 32 | 33 | __forceinline double radiolocation::CWCosineSignal::get_init_time() const 34 | { 35 | return this->m_init_time; 36 | } 37 | 38 | __forceinline double radiolocation::CWCosineSignal::get_interval() const 39 | { 40 | return this->m_interval; 41 | } 42 | 43 | 44 | 45 | __forceinline std::size_t radiolocation::CWCosineSignal::get_num_samples() const 46 | { 47 | return this->m_samples; 48 | } 49 | 50 | __forceinline radiolocation::JonesVector radiolocation::CWCosineSignal::polarization() const 51 | { 52 | return this->m_polarization; 53 | } 54 | 55 | // Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 56 | // Cosine Waveform signal class. -------------------------------------------------------------------------------- /Radiolocation/Include/CWSine.inl: -------------------------------------------------------------------------------- 1 | 2 | // Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | // Sine Waveform signal class. 4 | 5 | __forceinline std::vector> radiolocation::CWSineSignal::get_sine_signal() const 6 | { 7 | return this->m_sine_signal; 8 | } 9 | 10 | 11 | __forceinline std::vector radiolocation::CWSineSignal::get_signal_envelope() const 12 | { 13 | return this->m_envelope; 14 | } 15 | 16 | 17 | __forceinline std::vector radiolocation::CWSineSignal::get_phase() const 18 | { 19 | return this->m_phase; 20 | } 21 | 22 | __forceinline double radiolocation::CWSineSignal::get_init_time() const 23 | { 24 | return this->m_init_time; 25 | } 26 | 27 | 28 | __forceinline double radiolocation::CWSineSignal::get_duration() const 29 | { 30 | return this->m_duration; 31 | } 32 | 33 | __forceinline double radiolocation::CWSineSignal::get_frequency() const 34 | { 35 | return this->m_frequency; 36 | } 37 | 38 | __forceinline double radiolocation::CWSineSignal::get_envelop_freq() const 39 | { 40 | return this->m_envelope_freq; 41 | } 42 | 43 | __forceinline double radiolocation::CWSineSignal::get_interval() const 44 | { 45 | return this->m_interval; 46 | } 47 | 48 | __forceinline std::size_t radiolocation::CWSineSignal::get_samples_count() const 49 | { 50 | return this->m_samples; 51 | } 52 | 53 | __forceinline radiolocation::JonesVector radiolocation::CWSineSignal::polarization() const 54 | { 55 | return this->m_polarization; 56 | } -------------------------------------------------------------------------------- /Radiolocation/Include/GaussianNoiseExpChirp.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Exponential Chirp with Additive White Gaussian Noise class - inline functions implementation. 4 | @aulthor: Bernard Gingold 5 | @version: 1.0 10/11/2015 6 | 7 | */ 8 | 9 | __forceinline std::function radiolocation::AWGNExpChirp::WaveformGenerator() const 10 | { 11 | return this->m_oWaveformGenerator; 12 | } 13 | 14 | __forceinline std::vector> radiolocation::AWGNExpChirp::AWGNEChirp() const 15 | { 16 | return this->m_oAWGNEChirp; 17 | } 18 | 19 | __forceinline const double *radiolocation::AWGNExpChirp::AWGNEChirpArray() const 20 | { 21 | const double* pAWGNEChirp = &this->m_oAWGNEChirp.operator[](0).second; 22 | return pAWGNEChirp; 23 | } 24 | 25 | __forceinline std::size_t radiolocation::AWGNExpChirp::SamplesCount() const 26 | { 27 | return this->m_uiSamplesCount; 28 | } 29 | 30 | __forceinline double radiolocation::AWGNExpChirp::Mean() const 31 | { 32 | return this->m_dMean; 33 | } 34 | 35 | __forceinline double radiolocation::AWGNExpChirp::Variance() const 36 | { 37 | return this->m_dVariance; 38 | } -------------------------------------------------------------------------------- /Radiolocation/Include/GaussianNoiseLinChirp.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Linear Chirp with Additive White Gaussian Noise class - inline functions implementation. 4 | @aulthor: Bernard Gingold 5 | @version: 1.0 26/10/2015 6 | 7 | */ 8 | 9 | __forceinline std::function radiolocation::AWGNoiseLinChirp::WaveformGenerator() const 10 | { 11 | return this->m_oWaveformGenerator; 12 | } 13 | 14 | __forceinline std::vector> radiolocation::AWGNoiseLinChirp::AWGNLChirp() const 15 | { 16 | return this->m_oAWGNLChirp; 17 | } 18 | 19 | __forceinline const double *radiolocation::AWGNoiseLinChirp::AWGNLChirpArray() const 20 | { 21 | const double* pAWGNLChirp = &this->m_oAWGNLChirp.operator[](0).second; 22 | return pAWGNLChirp; 23 | } 24 | 25 | __forceinline std::size_t radiolocation::AWGNoiseLinChirp::SamplesCount() const 26 | { 27 | return this->m_uiSamplesCount; 28 | } 29 | 30 | __forceinline double radiolocation::AWGNoiseLinChirp::Mean() const 31 | { 32 | return this->m_dMean; 33 | } 34 | 35 | __forceinline double radiolocation::AWGNoiseLinChirp::Variance() const 36 | { 37 | return this->m_dVariance; 38 | } -------------------------------------------------------------------------------- /Radiolocation/Include/GaussianNoiseModCos.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | Modulated Cosine with Additive White Gaussian Noise class - inline functions definition. 3 | @aulthor: Bernard Gingold 4 | @version: 1.0 26/10/2015 5 | 6 | */ 7 | 8 | __forceinline std::function radiolocation::AWGNoiseModCos::WaveformGenerator() const 9 | { 10 | return this->m_oWaveformGenerator; 11 | } 12 | 13 | __forceinline std::vector> radiolocation::AWGNoiseModCos::AWGNModCos() const 14 | { 15 | return this->m_oAWGNModCos; 16 | } 17 | 18 | __forceinline std::size_t radiolocation::AWGNoiseModCos::SamplesCount() const 19 | { 20 | return this->m_uiSamplesCount; 21 | } 22 | 23 | __forceinline double radiolocation::AWGNoiseModCos::Mean() const 24 | { 25 | return this->m_dMean; 26 | } 27 | 28 | __forceinline double radiolocation::AWGNoiseModCos::Variance() const 29 | { 30 | return this->m_dVariance; 31 | } 32 | 33 | __forceinline const double *radiolocation::AWGNoiseModCos::AWGNModCosArray() const 34 | { 35 | const double* pAWGNMCos = &this->m_oAWGNModCos.operator[](0).second; 36 | return pAWGNMCos; 37 | } -------------------------------------------------------------------------------- /Radiolocation/Include/GaussianNoiseModSawtooth.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | Modulated Sawtooth Wave with Additive White Gaussian Noise class - inline functions definition. 3 | @aulthor: Bernard Gingold 4 | @version: 1.0 10/11/2015 5 | 6 | */ 7 | 8 | __forceinline std::function radiolocation::AWGNMSawtooth::WaveformGenerator() const 9 | { 10 | return this->m_oWaveformGenerator; 11 | } 12 | 13 | __forceinline std::vector> radiolocation::AWGNMSawtooth::AWGNModSawtooth() const 14 | { 15 | return this->m_oAWGNMSawtooth; 16 | } 17 | 18 | __forceinline const double *radiolocation::AWGNMSawtooth::AWGNMSawtoothArray() const 19 | { 20 | const double* pAWGNMSawtooth = nullptr; 21 | pAWGNMSawtooth = &this->m_oAWGNMSawtooth.operator[](0).second; 22 | return pAWGNMSawtooth; 23 | } 24 | 25 | __forceinline std::size_t radiolocation::AWGNMSawtooth::SamplesCount() const 26 | { 27 | return this->m_uiSamplesCount; 28 | } 29 | 30 | __forceinline double radiolocation::AWGNMSawtooth::Mean() const 31 | { 32 | return this->m_dMean; 33 | } 34 | 35 | __forceinline double radiolocation::AWGNMSawtooth::Variance() const 36 | { 37 | return this->m_dVariance; 38 | } 39 | -------------------------------------------------------------------------------- /Radiolocation/Include/GaussianNoiseModSine.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | Modulated Sine with Additive White Gaussian Noise class - inline functions definition. 3 | @aulthor: Bernard Gingold 4 | @version: 1.0 26/10/2015 5 | 6 | */ 7 | 8 | __forceinline std::function radiolocation::AWGNoiseModSine::WaveformGenerator() const 9 | { 10 | return this->m_oWaveformGenerator; 11 | } 12 | 13 | __forceinline std::vector> radiolocation::AWGNoiseModSine::AWGNModSine() const 14 | { 15 | return this->m_oAWGNModSine; 16 | } 17 | 18 | __forceinline std::size_t radiolocation::AWGNoiseModSine::Samples() const 19 | { 20 | return this->m_uiSamples; 21 | } 22 | 23 | __forceinline double radiolocation::AWGNoiseModSine::Mean() const 24 | { 25 | return this->m_dMean; 26 | } 27 | 28 | __forceinline double radiolocation::AWGNoiseModSine::Variance() const 29 | { 30 | return this->m_dVariance; 31 | } 32 | 33 | __forceinline const double *radiolocation::AWGNoiseModSine::AWGNModSineArray() const 34 | { 35 | const double* pAWGNModSine = &this->m_oAWGNModSine[0].second; 36 | return pAWGNModSine; 37 | } -------------------------------------------------------------------------------- /Radiolocation/Include/GaussianNoiseModSquareWave.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | Modulated Square Wave with Additive White Gaussian Noise class - definition. 3 | @aulthor: Bernard Gingold 4 | @version: 1.0 10/11/2015 5 | 6 | */ 7 | 8 | __forceinline std::function radiolocation::AWGNMSquareWave::WaveformGenerator() const 9 | { 10 | return this->m_oWaveformGenerator; 11 | } 12 | 13 | __forceinline std::vector> radiolocation::AWGNMSquareWave::AWGNMSW() const 14 | { 15 | return this->m_oAWGNMSquareWave; 16 | } 17 | 18 | __forceinline const double *radiolocation::AWGNMSquareWave::AWGNMSWArray() const 19 | { 20 | const double* pAWGNMSW = nullptr; 21 | pAWGNMSW = &this->m_oAWGNMSquareWave.operator[](0).second; 22 | return pAWGNMSW; 23 | } 24 | 25 | __forceinline std::size_t radiolocation::AWGNMSquareWave::SamplesCount() const 26 | { 27 | return this->m_uiSamplesCount; 28 | } 29 | 30 | __forceinline double radiolocation::AWGNMSquareWave::Mean() const 31 | { 32 | return this->m_dMean; 33 | } 34 | 35 | __forceinline double radiolocation::AWGNMSquareWave::Variance() const 36 | { 37 | return this->m_dVariance; 38 | } -------------------------------------------------------------------------------- /Radiolocation/Include/GaussianNoiseSawtooth.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Sawtooth Wave with Additive White Gaussian Noise class - inline functions definitions. 4 | @aulthor: Bernard Gingold 5 | @version: 1.0 10/11/2015 6 | 7 | */ 8 | 9 | __forceinline std::function radiolocation::AWGNSawtooth::WaveformGenerator() const 10 | { 11 | return this->m_oWaveformGenerator; 12 | } 13 | 14 | __forceinline std::vector> radiolocation::AWGNSawtooth::AWGNoSawtooth() const 15 | { 16 | return this->m_oAWGNoSawtooth; 17 | } 18 | 19 | __forceinline const double *radiolocation::AWGNSawtooth::AWGNoSawtoothArray() const 20 | { 21 | // Ensure that this is been used in current scope. 22 | const double* pAWGNSawtooth = &this->m_oAWGNoSawtooth.operator[](0).second; 23 | return pAWGNSawtooth; 24 | } 25 | 26 | __forceinline std::size_t radiolocation::AWGNSawtooth::SamplesCount() const 27 | { 28 | return this->m_uiSamplesCount; 29 | } 30 | 31 | __forceinline double radiolocation::AWGNSawtooth::Mean() const 32 | { 33 | return this->m_dMean; 34 | } 35 | 36 | __forceinline double radiolocation::AWGNSawtooth::Variance() const 37 | { 38 | return this->m_dVariance; 39 | } -------------------------------------------------------------------------------- /Radiolocation/Include/GaussianNoiseSine.h: -------------------------------------------------------------------------------- 1 | #ifndef _GAUSSIAN_NOISE_SINE_H_ 2 | #define _GAUSSIAN_NOISE_SINE_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Pure Sine with Additive White Gaussian Noise class - definition. 6 | @aulthor: Bernard Gingold 7 | @version: 1.0 26/10/2015 8 | 9 | */ 10 | 11 | #include "PureSine.h" 12 | #include 13 | 14 | namespace radiolocation 15 | { 16 | 17 | class AWGNoiseSine : public PureSineWave 18 | { 19 | 20 | public: 21 | 22 | _Raises_SEH_exception_ AWGNoiseSine(_In_ struct AWGNSineParams const&); 23 | 24 | _Raises_SEH_exception_ AWGNoiseSine(_In_ struct AWGNSineParams const&, _In_ struct PureSineParams const&); 25 | 26 | AWGNoiseSine(_In_ AWGNoiseSine const&); 27 | 28 | AWGNoiseSine(_In_ AWGNoiseSine &&); 29 | 30 | ~AWGNoiseSine() 31 | { 32 | 33 | } 34 | 35 | AWGNoiseSine & operator=(_In_ AWGNoiseSine const&); 36 | 37 | AWGNoiseSine & operator=(_In_ AWGNoiseSine &&); 38 | 39 | friend std::ostream & operator<<(_In_ std::ostream &, _In_ AWGNoiseSine const&); 40 | 41 | double operator()(_In_ struct AWGNSineParams const&); 42 | 43 | std::pair operator[](_In_ const std::size_t); 44 | 45 | const std::pair operator[](_In_ const std::size_t) const; 46 | 47 | std::vector> operator==(_In_ AWGNoiseSine const&) const; 48 | 49 | std::vector> operator!=(_In_ AWGNoiseSine const&) const; 50 | 51 | 52 | 53 | __forceinline std::function WaveformGenerator() const; 54 | 55 | __forceinline std::vector> AWGNSine() const; 56 | 57 | __forceinline const double *AWGNSinArray() const; 58 | 59 | __forceinline std::size_t Samples() const; 60 | 61 | __forceinline double Mean() const; 62 | 63 | __forceinline double Variance() const; 64 | 65 | 66 | private: 67 | 68 | std::function m_oWaveformGenerator; 69 | 70 | std::vector> m_oAWGNSine; 71 | 72 | std::size_t m_uiSamples; 73 | 74 | double m_dMean; 75 | 76 | double m_dVariance; 77 | }; 78 | 79 | /* 80 | @brief: Aggregated parameters structure for AWGNoiseSine class. 81 | */ 82 | struct AWGNSineParams 83 | { 84 | _In_ std::function WaveformGenerator; 85 | _In_ double Mean; 86 | _In_ double Variance; 87 | _In_ std::size_t Samples; 88 | }; 89 | 90 | #include "GaussianNoiseSine.inl" 91 | } 92 | #endif /*_GAUSSIAN_NOISE_SINE_H_*/ -------------------------------------------------------------------------------- /Radiolocation/Include/GaussianNoiseSine.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Pure Sine with Additive White Gaussian Noise class- inline functions implementation. 4 | @author: Bernard Gingold 5 | @version: 1.0 26/10/2015 6 | 7 | */ 8 | 9 | __forceinline std::function radiolocation::AWGNoiseSine::WaveformGenerator() const 10 | { 11 | return this->m_oWaveformGenerator; 12 | } 13 | 14 | __forceinline std::vector> radiolocation::AWGNoiseSine::AWGNSine() const 15 | { 16 | return this->m_oAWGNSine; 17 | } 18 | 19 | __forceinline const double *radiolocation::AWGNoiseSine::AWGNSinArray() const 20 | { 21 | const double* pAWGNSine = &this->m_oAWGNSine[0].second; //Take precaution because of scope of *this. Do not return AWGNSinArray from the function where 22 | // *this was instantiated. 23 | return pAWGNSine; 24 | } 25 | 26 | __forceinline std::size_t radiolocation::AWGNoiseSine::Samples() const 27 | { 28 | return this->m_uiSamples; 29 | } 30 | 31 | __forceinline double radiolocation::AWGNoiseSine::Mean() const 32 | { 33 | return this->m_dMean; 34 | } 35 | 36 | __forceinline double radiolocation::AWGNoiseSine::Variance() const 37 | { 38 | return this->m_dVariance; 39 | } -------------------------------------------------------------------------------- /Radiolocation/Include/GaussianNoiseSquareWave.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | Square Wave with Additive White Gaussian Noise class - inline functions definition. 3 | @aulthor: Bernard Gingold 4 | @version: 1.0 10/11/2015 5 | 6 | */ 7 | 8 | __forceinline std::function radiolocation::AWGNSquareWave::WaveformGenerator()const 9 | { 10 | return this->m_oWaveformGenerator; 11 | } 12 | 13 | __forceinline std::vector> radiolocation::AWGNSquareWave::AWGNSqWave() const 14 | { 15 | return this->m_oAWGNSquareWave; 16 | } 17 | 18 | __forceinline const double *radiolocation::AWGNSquareWave::AWGNSqWaveArray() const 19 | { 20 | const double* pAWGNSquareWave = nullptr; 21 | pAWGNSquareWave = &this->m_oAWGNSquareWave.operator[](0).second; 22 | return pAWGNSquareWave; 23 | } 24 | 25 | __forceinline std::size_t radiolocation::AWGNSquareWave::SamplesCount() const 26 | { 27 | return this->m_uiSamplesCount; 28 | } 29 | 30 | __forceinline double radiolocation::AWGNSquareWave::Mean() const 31 | { 32 | return this->m_dMean; 33 | } 34 | 35 | __forceinline double radiolocation::AWGNSquareWave::Variance() const 36 | { 37 | return this->m_dVariance; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /Radiolocation/Include/LibExceptions.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIB_EXCEPTIONS_H_ 2 | #define _LIB_EXCEPTIONS_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | namespace radiolocation 21 | { 22 | 23 | struct error : virtual std::exception, virtual boost::exception{}; 24 | 25 | struct file_error : virtual error{}; 26 | 27 | struct file_open_error : virtual file_error{}; 28 | 29 | struct file_read_error : virtual file_error{}; 30 | 31 | struct invalid_value_arg : virtual error{}; 32 | 33 | struct empty_vector : virtual error{}; 34 | 35 | struct invalid_pointer : virtual error{}; 36 | 37 | 38 | 39 | 40 | } 41 | #endif /*_LIB_EXCEPTIONS_H_*/ -------------------------------------------------------------------------------- /Radiolocation/Include/PureCosineAWGNoise.h: -------------------------------------------------------------------------------- 1 | #ifndef _PURE_COSINE_AWG_NOISE_H_ 2 | #define _PURE_COSINE_AWG_NOISE_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Pure Cosine with Additive White Gaussian Noise class- definition 6 | @aulthor: Bernard Gingold 7 | @version: 1.0 26/10/2015 8 | 9 | */ 10 | 11 | #include "PureCosine.h" 12 | #include "WhiteGaussianNoise.h" 13 | 14 | namespace radiolocation 15 | { 16 | 17 | class PureCosAWGNoise 18 | { 19 | 20 | _Raises_SEH_exception_ __thiscall PureCosAWGNoise(_In_ struct PureCosineParams const&, _In_ struct WGNoiseParams const&); 21 | 22 | __thiscall PureCosAWGNoise(_In_ PureCosAWGNoise const&); 23 | 24 | __thiscall PureCosAWGNoise(_In_ PureCosAWGNoise &&); 25 | 26 | __thiscall ~PureCosAWGNoise() = default; 27 | 28 | PureCosAWGNoise & __thiscall operator=(_In_ PureCosAWGNoise const&); 29 | 30 | PureCosAWGNoise & __thiscall operator=(_In_ PureCosAWGNoise &&); 31 | 32 | friend std::ostream & operator<<(_In_ std::ostream&, _In_ PureCosAWGNoise const&); 33 | 34 | __forceinline std::size_t samples() const; 35 | 36 | __forceinline std::vector> CosGaussNoise() const; 37 | 38 | __forceinline PureCosineWave CosPulse() const; 39 | 40 | __forceinline WGaussianNoise GaussNoise() const; 41 | 42 | __forceinline JonesVector Polarization() const; 43 | 44 | 45 | 46 | 47 | 48 | private: 49 | 50 | std::size_t m_samples; 51 | 52 | _Field_size_(m_samples) std::vector> m_vCosGaussNoise; 53 | 54 | radiolocation::PureCosineWave m_oCosPulse; 55 | 56 | radiolocation::WGaussianNoise m_oGaussNoise; 57 | 58 | JonesVector m_oPolarizationVec; 59 | 60 | 61 | }; 62 | 63 | 64 | #include "PureCosineAWGNoise.inl" 65 | } 66 | #endif /*_PURE_COSINE_AWG_NOISE_H_*/ -------------------------------------------------------------------------------- /Radiolocation/Include/PureCosineAWGNoise.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Pure Cosine with Additive White Gaussian Noise class- inline functions definition. 4 | @aulthor: Bernard Gingold 5 | @version: 1.0 26/10/2015 6 | 7 | */ 8 | 9 | __forceinline std::size_t radiolocation::PureCosAWGNoise::samples() const 10 | { 11 | return this->m_samples; 12 | } 13 | 14 | __forceinline std::vector> radiolocation::PureCosAWGNoise::CosGaussNoise() const 15 | { 16 | return this->m_vCosGaussNoise; 17 | } 18 | 19 | __forceinline radiolocation::PureCosineWave radiolocation::PureCosAWGNoise::CosPulse() const 20 | { 21 | return this->m_oCosPulse; 22 | } 23 | 24 | __forceinline radiolocation::WGaussianNoise radiolocation::PureCosAWGNoise::GaussNoise() const 25 | { 26 | return this->m_oGaussNoise; 27 | } 28 | 29 | __forceinline radiolocation::JonesVector radiolocation::PureCosAWGNoise::Polarization() const 30 | { 31 | return this->m_oPolarizationVec; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Radiolocation/Include/PureSine.inl: -------------------------------------------------------------------------------- 1 | 2 | _Field_size_(m_samples) __forceinline std::vector> radiolocation::PureSineWave::get_sine() const 3 | { 4 | return this->m_sine; 5 | } 6 | 7 | _Field_size_(m_samples) __forceinline std::vector radiolocation::PureSineWave::get_phase() const 8 | { 9 | return this->m_phase; 10 | } 11 | 12 | _Outptr_opt_result_buffer_(m_samples) __forceinline const double *radiolocation::PureSineWave::get_phase_ptr() const 13 | { 14 | _Outptr_opt_result_buffer_(m_samples) const double* ptr = &this->m_phase[0]; 15 | return ptr; 16 | } 17 | 18 | __forceinline size_t radiolocation::PureSineWave::get_samples() const 19 | { 20 | return this->m_samples; 21 | } 22 | 23 | __forceinline double radiolocation::PureSineWave::get_init_time() const 24 | { 25 | return this->m_init_time; 26 | } 27 | 28 | __forceinline double radiolocation::PureSineWave::get_frequency() const 29 | { 30 | return this->m_frequency; 31 | } 32 | 33 | __forceinline double radiolocation::PureSineWave::get_interval() const 34 | { 35 | return this->m_interval; 36 | } 37 | 38 | __forceinline double radiolocation::PureSineWave::get_amplitude() const 39 | { 40 | return this->m_amplitude; 41 | } 42 | 43 | __forceinline JonesVector radiolocation::PureSineWave::polarization() const 44 | { 45 | return this->m_polarization; 46 | } 47 | 48 | 49 | template __forceinline radiolocation::PureSineWave& radiolocation::PureSineWave::apply(_In_ _Fx fx, _In_ _Ty&&... ty) 50 | { 51 | for (std::size_t i{ 0 }; i != this->m_samples; ++i) 52 | { 53 | this->m_phase.operator[](i) = fx(std::forward<_Ty>(ty)...); 54 | this->m_sine.operator[](i) = fx(std::forward<_Ty>(ty)...); 55 | } 56 | return *this; 57 | } 58 | -------------------------------------------------------------------------------- /Radiolocation/Include/RadarRangeResolution.h: -------------------------------------------------------------------------------- 1 | #ifndef _RADAR_RANGE_RESOLUTION_H_ 2 | #define _RADAR_RANGE_RESOLUTION_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | Radar Range Resolution class - declaration. 6 | @aulthor: Bernard Gingold 7 | @version: 1.0 10/11/2015 8 | 9 | */ 10 | 11 | #include "RadLibDefs.h" 12 | #include "LibExceptions.h" 13 | 14 | namespace radiolocation 15 | { 16 | 17 | 18 | class RangeResolution 19 | { 20 | 21 | public: 22 | 23 | /* 24 | @brief Constructors and Destructor. 25 | */ 26 | 27 | //Zero-Range. 28 | RangeResolution(); 29 | 30 | RangeResolution(_In_ struct RangeResolutionParams const&); 31 | 32 | RangeResolution(_In_ RangeResolution const&); 33 | 34 | RangeResolution(_In_ RangeResolution &&); 35 | 36 | ~RangeResolution() {} 37 | 38 | /* 39 | @brief Friend and member operators 40 | */ 41 | 42 | RangeResolution & operator=(_In_ RangeResolution const&); 43 | 44 | RangeResolution & operator=(_In_ RangeResolution &&); 45 | 46 | friend std::ostream & operator<<(_In_ std::ostream &, _In_ RangeResolution const&); 47 | 48 | double & operator[](_In_ const std::size_t); 49 | 50 | double const & operator[](_In_ const std::size_t) const; 51 | 52 | bool operator==(_In_ RangeResolution const&) const; 53 | 54 | bool operator!=(_In_ RangeResolution const&) const; 55 | 56 | /* 57 | @brief accessor inline functions. 58 | */ 59 | 60 | __forceinline double RangeGate() const; 61 | 62 | __forceinline double DeltaRange() const; 63 | 64 | __forceinline double Theta() const; 65 | 66 | 67 | private: 68 | 69 | double m_dRangeGate; 70 | 71 | // Max range resolution in meters. 72 | double m_dDeltaRange; 73 | 74 | // Max time resolutions of two echo returns in microseconds. 75 | double m_dTheta; 76 | 77 | 78 | }; 79 | 80 | 81 | struct RangeResolutionParams 82 | { 83 | _In_ double Rmin; 84 | _In_ double Rmax; 85 | _In_ double t1; 86 | _In_ double t2; 87 | _In_ double BW; //BandWidth 88 | }; 89 | #include "RadarRangeResolution.inl" 90 | } 91 | #endif /*_RADAR_RANGE_RESOLUTION_H_*/ -------------------------------------------------------------------------------- /Radiolocation/Include/RadarRangeResolution.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | Radar Range Resolution class - accessors implementation. 3 | @aulthor: Bernard Gingold 4 | @version: 1.0 10/11/2015 5 | 6 | */ 7 | 8 | __forceinline double radiolocation::RangeResolution::DeltaRange() const 9 | { 10 | return this->m_dDeltaRange; 11 | } 12 | 13 | __forceinline double radiolocation::RangeResolution::RangeGate() const 14 | { 15 | return this->m_dRangeGate; 16 | } 17 | 18 | __forceinline double radiolocation::RangeResolution::Theta() const 19 | { 20 | return this->m_dTheta; 21 | } -------------------------------------------------------------------------------- /Radiolocation/Include/RangeMeasurement.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Range measurement class - inline accessors definition. 4 | @aulthor: Bernard Gingold 5 | @version: 1.0 10/11/2015 6 | 7 | */ 8 | 9 | __forceinline double radiolocation::RangeToTarget::DeltaTime() const 10 | { 11 | return this->m_dDeltaTime; 12 | } 13 | 14 | __forceinline double radiolocation::RangeToTarget::Range() const 15 | { 16 | return this->m_dRange; 17 | } -------------------------------------------------------------------------------- /Radiolocation/Include/SurfaceAreaClutterReturn.inl: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 2 | Surface Area Clutter class - accessor function implementation. 3 | @aulthor: Bernard Gingold 4 | @version: 1.0 10/11/2015 5 | 6 | */ 7 | 8 | __forceinline double radiolocation::SurfaceAreaClutter::PhaseDifferential() const 9 | { 10 | return this->m_dPhaseDifferential; 11 | } 12 | 13 | __forceinline double radiolocation::SurfaceAreaClutter::ClutterArea() const 14 | { 15 | return this->m_dClutterArea; 16 | } 17 | 18 | __forceinline double radiolocation::SurfaceAreaClutter::AvrgClutterRCS() const 19 | { 20 | return this->m_dAvrgClutterRCS; 21 | } 22 | 23 | __forceinline double radiolocation::SurfaceAreaClutter::CriticalAngle() const 24 | { 25 | return this->m_dCriticalAngle; 26 | } 27 | 28 | __forceinline double radiolocation::SurfaceAreaClutter::GrazingAngle() const 29 | { 30 | return this->m_dGrazingAngle; 31 | } 32 | 33 | __forceinline double radiolocation::SurfaceAreaClutter::SurfaceHeight() const 34 | { 35 | return this->m_dSurfaceHeight; 36 | } 37 | 38 | __forceinline double radiolocation::SurfaceAreaClutter::Wavelength() const 39 | { 40 | return this->m_dWavelength; 41 | } -------------------------------------------------------------------------------- /Radiolocation/Include/WaveformInterface.h: -------------------------------------------------------------------------------- 1 | #ifndef _WAVEFORM_INTERFACE_H_ 2 | #define _WAVEFORM_INTERFACE_H_ 3 | 4 | #include "RadLibDefs.h" 5 | 6 | namespace radiolocation 7 | { 8 | 9 | // Abstract Waveform class. 10 | class Waveform 11 | { 12 | 13 | public: 14 | 15 | 16 | 17 | virtual void amplitude_modulation(const double, const double, const double) = 0; 18 | 19 | 20 | 21 | virtual void phase_modulation(const double, const double, const double, std::function&) = 0; 22 | 23 | 24 | 25 | virtual void frequency_modulation(double, size_t) = 0; 26 | 27 | 28 | _Raises_SEH_exception_ virtual void quadrature_components_extraction(_Inout_ std::vector> &, _In_ const int) = 0; 29 | 30 | 31 | _Raises_SEH_exception_ virtual void complex_envelope(_In_ std::vector> &, _Out_ std::vector &) = 0; 32 | 33 | 34 | _Raises_SEH_exception_ virtual void analytic_signal(_In_ const std::vector &, _In_ const int) = 0; 35 | 36 | 37 | _Maybe_raises_SEH_exception_ virtual void instantaneous_frequency(_Inout_ std::vector &) = 0; 38 | 39 | 40 | virtual std::vector> pulse_samples() const = 0; 41 | 42 | virtual std::vector pulse_phase() const = 0; 43 | 44 | virtual std::size_t pulse_samples_count() const = 0; 45 | 46 | #if defined _DEBUG 47 | 48 | virtual void debug_print() const = 0; 49 | #endif 50 | 51 | virtual ~Waveform(); 52 | }; 53 | } 54 | 55 | #endif /*_WAVEFORM_INTERFACE_H_*/ -------------------------------------------------------------------------------- /Radiolocation/Include/WhiteGaussianNoise.h: -------------------------------------------------------------------------------- 1 | #ifndef _WHITE_GAUSSIAN_NOISE_H_ 2 | #define _WHITE_GAUSSIAN_NOISE_H_ 3 | 4 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 5 | White Gaussian Noise class- definition 6 | @aulthor: Bernard Gingold 7 | @version: 1.0 26/10/2015 8 | 9 | */ 10 | 11 | #include "RadLibDefs.h" 12 | namespace radiolocation 13 | { 14 | 15 | 16 | class WGaussianNoise 17 | { 18 | 19 | 20 | public: 21 | 22 | /* 23 | @Brief: Constructors. 24 | */ 25 | WGaussianNoise(_In_ struct WGNoiseParams const&); 26 | 27 | WGaussianNoise(_In_ WGaussianNoise const&); 28 | 29 | WGaussianNoise(_In_ WGaussianNoise&&); 30 | 31 | ~WGaussianNoise() = default; 32 | 33 | /* 34 | @Brief: operators 35 | */ 36 | 37 | WGaussianNoise & operator=(_In_ WGaussianNoise const&); 38 | 39 | WGaussianNoise & operator=(_In_ WGaussianNoise &&); 40 | 41 | friend std::ostream& operator<<(_In_ std::ostream&, _In_ WGaussianNoise const&); 42 | 43 | /* 44 | @Brief: Class accessor methods. 45 | */ 46 | 47 | __forceinline std::size_t samples() const; 48 | 49 | __forceinline std::vector> WGNoise() const; 50 | 51 | __forceinline double mean() const; 52 | 53 | __forceinline double variance() const; 54 | 55 | __forceinline std::function WaveformGenerator() const; 56 | 57 | 58 | #if defined _DEBUG 59 | void debug_print() const; 60 | #endif 61 | 62 | private: 63 | 64 | /* 65 | @Brief: Number of noise vector samples. 66 | */ 67 | std::size_t m_samples; 68 | 69 | /* 70 | @Brief: White Gaussian Noise vector. 71 | Contains std::pair.first = normal unit random variables vector, std::pair.second = normal random variables vector. 72 | */ 73 | _Field_size_(m_samples) std::vector> m_oWGNoise; // White Gaussian Noise vector 74 | 75 | /* 76 | @Brief: mean value. 77 | */ 78 | double m_mean; 79 | 80 | /* 81 | @Brief: variance value. 82 | */ 83 | double m_variance; 84 | 85 | /* 86 | @Brief: Noise waveform generator. 87 | */ 88 | std::function m_oWaveformGenerator; 89 | 90 | 91 | 92 | }; 93 | 94 | 95 | struct WGNoiseParams 96 | { 97 | _In_ std::function WaveformGenerator; 98 | _In_ double mean; 99 | _In_ double variance; 100 | _In_ std::size_t n_samples; 101 | }; 102 | 103 | #include "WhiteGaussianNoise.inl" 104 | } 105 | 106 | #endif /*_WHITE_GAUSSIAN_NOISE_H_*/ -------------------------------------------------------------------------------- /Radiolocation/Include/WhiteGaussianNoise.inl: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | White Gaussian Noise class- inline functions implementation. 4 | @aulthor: Bernard Gingold 5 | @version: 1.0 26/10/2015 6 | 7 | */ 8 | 9 | __forceinline std::size_t radiolocation::WGaussianNoise::samples() const 10 | { 11 | return this->m_samples; 12 | } 13 | 14 | __forceinline std::vector> radiolocation::WGaussianNoise::WGNoise() const 15 | { 16 | return this->m_oWGNoise; 17 | } 18 | 19 | __forceinline double radiolocation::WGaussianNoise::mean() const 20 | { 21 | return this->m_mean; 22 | } 23 | 24 | __forceinline double radiolocation::WGaussianNoise::variance() const 25 | { 26 | return this->m_variance; 27 | } 28 | 29 | __forceinline std::function radiolocation::WGaussianNoise::WaveformGenerator() const 30 | { 31 | return this->m_oWaveformGenerator; 32 | } -------------------------------------------------------------------------------- /Radiolocation/Radiolocation.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /Radiolocation/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : Radiolocation Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this Radiolocation library project for you. 6 | 7 | No source files were created as part of your project. 8 | 9 | 10 | Radiolocation.vcxproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | Radiolocation.vcxproj.filters 17 | This is the filters file for VC++ projects generated using an Application Wizard. 18 | It contains information about the association between the files in your project 19 | and the filters. This association is used in the IDE to show grouping of files with 20 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 21 | "Source Files" filter). 22 | 23 | ///////////////////////////////////////////////////////////////////////////// 24 | Other notes: 25 | 26 | AppWizard uses "TODO:" comments to indicate parts of the source code you 27 | should add to or customize. 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /Radiolocation/Source/EnergyOfPulse.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* Copyright (c) 2015, Bernard Gingold. License: MIT License (http://www.opensource.org/licenses/mit-license.php) 3 | Pulse Energy class - declaration. 4 | @aulthor: Bernard Gingold 5 | @version: 1.0 10/11/2015 6 | 7 | */ 8 | 9 | #include "EnergyOfPulse.h" 10 | 11 | radiolocation::PulseEnergy::PulseEnergy() : 12 | m_dPulseEnergy{ 0.0 } 13 | { 14 | 15 | } 16 | 17 | radiolocation::PulseEnergy::PulseEnergy(_In_ struct PulseAvrgdPowParams const& p) : 18 | PulseAvrgPower{ p }, 19 | m_dPulseEnergy{0.0} 20 | { 21 | this->m_dPulseEnergy = this->m_dPulseAveragedPower * this->m_dInterPulsePeriod; 22 | } 23 | 24 | radiolocation::PulseEnergy::PulseEnergy(_In_ PulseEnergy const& other) : 25 | m_dPulseEnergy{other.m_dPulseEnergy} 26 | { 27 | 28 | } 29 | 30 | radiolocation::PulseEnergy::PulseEnergy(_In_ PulseEnergy &&other) : 31 | m_dPulseEnergy{ std::move(other.m_dPulseEnergy) } 32 | { 33 | 34 | } 35 | 36 | radiolocation::PulseEnergy & radiolocation::PulseEnergy::operator=(_In_ PulseEnergy const& other) 37 | { 38 | if (this == &other) return *this; 39 | 40 | this->m_dPulseEnergy = other.m_dPulseEnergy; 41 | return *this; 42 | } 43 | 44 | radiolocation::PulseEnergy & radiolocation::PulseEnergy::operator=(_In_ PulseEnergy &&other) 45 | { 46 | if (this == &other) return *this; 47 | 48 | this->m_dPulseEnergy = std::move(other.m_dPulseEnergy); 49 | return *this; 50 | } 51 | 52 | std::ostream & radiolocation::operator<<(_In_ std::ostream &os, _In_ PulseEnergy const& rhs) 53 | { 54 | os.scientific; 55 | std::setprecision(15); 56 | os << "PulseEnergy=" << rhs.m_dPulseEnergy << std::endl; 57 | return os; 58 | } 59 | 60 | bool radiolocation::PulseEnergy::operator==(_In_ PulseEnergy const& other) const 61 | { 62 | if ((std::fabs(this->m_dPulseEnergy) - std::fabs(other.m_dPulseEnergy)) <= std::numeric_limits::epsilon()) 63 | return true; 64 | else 65 | return false; 66 | } 67 | 68 | bool radiolocation::PulseEnergy::operator!=(_In_ PulseEnergy const& other) const 69 | { 70 | if ((std::fabs(this->m_dPulseEnergy) - std::fabs(other.m_dPulseEnergy)) > std::numeric_limits::epsilon()) 71 | return true; 72 | else 73 | return false; 74 | } 75 | -------------------------------------------------------------------------------- /Radiolocation/Source/WaveformInterface.cpp: -------------------------------------------------------------------------------- 1 | #include "WaveformInterface.h" 2 | 3 | // Virtual Destructor 4 | radiolocation::Waveform::~Waveform() 5 | { 6 | 7 | } -------------------------------------------------------------------------------- /System/TEST_sse_mem_cpy_f32.h: -------------------------------------------------------------------------------- 1 | #ifndef _TEST_SSE_MEM_CPY_F32_H_10_04_16 2 | #define _TEST_SSE_MEM_CPY_F32_H_10_04_16 3 | 4 | #include "../System/MemCopyRoutines.h" 5 | #include "TestUtilities.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | 13 | namespace test_internal_system { 14 | 15 | 16 | /************************************************ 17 | Unit tests of single precision specialization 18 | of FastSSEMemCpy struct. 19 | ************************************************/ 20 | 21 | class TEST_FastSSEMemCpyF32 { 22 | 23 | public: 24 | 25 | /******************************************* 26 | Simple acceptance Test of sse_mem_cpy_f32 27 | routine. 28 | ********************************************/ 29 | static auto test_sse_mem_cpy_f32()->void; 30 | 31 | /******************************************* 32 | Simple acceptance Test of sse_mem_cpy_f324x 33 | routine. 34 | ********************************************/ 35 | static auto test_sse_mem_cpy_f324x()->void; 36 | 37 | /******************************************* 38 | Simple acceptance Test of sse_mem_cpy_f328x 39 | routine. 40 | ********************************************/ 41 | static auto test_sse_mem_cpy_f328x()->void; 42 | }; 43 | 44 | #include "TEST_sse_mem_cpy_f32.inl" 45 | } 46 | #endif /*_TETS_SSE_MEM_CPY_F32_H_10_04_16*/ -------------------------------------------------------------------------------- /System/TestUtilities.h: -------------------------------------------------------------------------------- 1 | #ifndef _TEST_UTILS_H_10_04_16 2 | #define _TEST_UTILS_H_10_04_16 3 | 4 | namespace test_internal_system { 5 | 6 | namespace utilities { 7 | 8 | 9 | /*********************************************** 10 | Prints data array 11 | ************************************************/ 12 | auto printData(_In_ const float*, _In_ const int)->void; 13 | 14 | /*********************************************** 15 | Overloaded templated on type Container 16 | version of printData 17 | ************************************************/ 18 | template void printData(_In_ const Container&); 19 | 20 | 21 | 22 | #include "TestUtilities.inl" 23 | 24 | } 25 | 26 | } 27 | 28 | 29 | 30 | #endif /*_TEST_UTILS_H_10_04_16*/ --------------------------------------------------------------------------------