Esempio n. 1
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];
        }
Esempio n. 2
0
 public FlexibleGmresSolver(ILogger logger, INativeMemoryProvider memoryProvider, GmresParams parameters) :
     base(logger, memoryProvider, parameters)
 {
     _precondKrylovBasis = new FortranMatrix(memoryProvider, Parameters.LocalDimensionSize, Parameters.BufferSize);
 }