Ejemplo n.º 1
0
        private PartialDerivatives createPartialDerivatives(string fullOutputPath, IEnumerable <string> parameterNames, double[][] derivatives)
        {
            var partialDerivatives = new PartialDerivatives(fullOutputPath, parameterNames);

            derivatives.Each(x => partialDerivatives.AddPartialDerivative(x));
            return(partialDerivatives);
        }
Ejemplo n.º 2
0
        private PartialDerivatives partialDerivativesFrom(string fullOutputPath, DataColumn outputResult, IReadOnlyList <IdentificationParameter> allIdentificationParameters, OutputMapping outputMapping, ISimModelBatch simModelBatch)
        {
            var partialDerivatives = new PartialDerivatives(fullOutputPath, allIdentificationParameters.AllNames());

            outputResult.Values.Each((outputValue, index) =>
            {
                var derivativeValues = retrievePartialDerivativeFor(allIdentificationParameters, x => retrievePartialDerivativeForOutputs(x, outputMapping, simModelBatch, index));
                partialDerivatives.AddPartialDerivative(derivativeValues);
            });

            return(partialDerivatives);
        }
        public void TestSerialization()
        {
            var x1 = new JacobianMatrix(new[] { "P1", "P2" });
            var partialDerivatives = new PartialDerivatives("O1", x1.ParameterNames);

            partialDerivatives.AddPartialDerivative(new[] { 1d, 2d });
            partialDerivatives.AddPartialDerivative(new[] { 3d, 4d });
            x1.AddPartialDerivatives(partialDerivatives);

            var x2 = SerializeAndDeserialize(x1);

            AssertForSpecs.AreEqualJacobianMatrix(x1, x2);
        }