コード例 #1
0
        public FlexibleGmresWithGmresPreconditioner(
            ILogger logger,
            INativeMemoryProvider memoryProvider,
            GmresParams fgmresParams,
            int innerBufferLength)
        {
            var innerParams = new GmresParams(fgmresParams.LocalDimensionSize, innerBufferLength)
            {
                Tolerance             = fgmresParams.Tolerance,
                MaxRepeatNumber       = 1,
                ResidualAtRestart     = fgmresParams.ResidualAtRestart,
                GramSchmidtType       = fgmresParams.GramSchmidtType,
                InitialGuess          = InitialGuess.UserSupplied,
                Preconditioning       = Preconditioning.None,
                BackwardErrorChecking = BackwardErrorChecking.CheckArnoldiOnly
            };

            _classicGmres  = new ClassicGmresSolver(logger, memoryProvider, innerParams);
            _flexibleGmres = new FlexibleGmresSolver(logger, memoryProvider, fgmresParams);

            _classicGmres.DotProductRequest        += (s, a) => OnDotProductRequest(a);
            _flexibleGmres.DotProductRequest       += (s, a) => OnDotProductRequest(a);
            _classicGmres.MatrixVectorMultRequest  += (s, a) => OnMatrixVectorMultRequest(a);
            _flexibleGmres.MatrixVectorMultRequest += (s, a) => OnMatrixVectorMultRequest(a);

            _classicGmres.IterationComplete  += (s, a) => OnInnerIterationComplete(a);
            _flexibleGmres.IterationComplete += (s, a) => OnIterationComplete(a);

            _flexibleGmres.RightPreconditionerRequest += (s, a) => _classicGmres.Solve(a.Src, a.Src, a.Dst);
        }
コード例 #2
0
        protected GmresSolver(ILogger logger, INativeMemoryProvider memoryProvider, GmresParams parameters)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (memoryProvider == null)
            {
                throw new ArgumentNullException(nameof(memoryProvider));
            }

            Logger     = logger;
            Parameters = parameters;
            _nloc      = Parameters.LocalDimensionSize;
            _m         = Parameters.BufferSize;

            _dotProducts = Parameters.GramSchmidtType == GramSchmidtType.IterativeClassical ?
                           new NativeVector(memoryProvider, _m) :
                           new NativeVector(memoryProvider, 1);

            var krylovSize = Parameters.ResidualAtRestart == ResidualAtRestart.ComputeTheTrue ? _m : _m + 1;

            _krylovBasis = new FortranMatrix(memoryProvider, _nloc, krylovSize);
            _hessenberg  = new FortranMatrix(memoryProvider, _m + 1, _m + 1);

            _w        = new NativeVector(memoryProvider, _nloc);
            _r0       = new NativeVector(memoryProvider, _nloc);
            _xCurrent = new NativeVector(memoryProvider, _nloc);
            _yCurrent = new NativeVector(memoryProvider, _m);

            _givensRotSin = new Complex[_m];
            _givensRotCos = new double[_m];
        }
コード例 #3
0
ファイル: ClassicGmresSolver.cs プロジェクト: prisae/extreme
 public ClassicGmresSolver(ILogger logger, INativeMemoryProvider memoryProvider, GmresParams parameters) :
     base(logger, memoryProvider, parameters)
 {
 }
コード例 #4
0
ファイル: FlexibleGmresSolver.cs プロジェクト: prisae/extreme
 public FlexibleGmresSolver(ILogger logger, INativeMemoryProvider memoryProvider, GmresParams parameters) :
     base(logger, memoryProvider, parameters)
 {
     _precondKrylovBasis = new FortranMatrix(memoryProvider, Parameters.LocalDimensionSize, Parameters.BufferSize);
 }