Exemplo n.º 1
0
            /*************************************************************************
            Serialization: complex value
            *************************************************************************/
            public static void serializerealmatrix(alglib.serializer s,
                double[,] v,
                int n0,
                int n1)
            {
                int i = 0;
                int j = 0;

                if (n0 < 0)
                {
                    n0 = alglib.ap.rows(v);
                }
                if (n1 < 0)
                {
                    n1 = alglib.ap.cols(v);
                }
                s.serialize_int(n0);
                s.serialize_int(n1);
                for (i = 0; i <= n0 - 1; i++)
                {
                    for (j = 0; j <= n1 - 1; j++)
                    {
                        s.serialize_double(v[i, j]);
                    }
                }
            }
Exemplo n.º 2
0
            /*************************************************************************
            Serialization: complex value
            *************************************************************************/
            public static void serializerealarray(alglib.serializer s,
                double[] v,
                int n)
            {
                int i = 0;

                if (n < 0)
                {
                    n = alglib.ap.len(v);
                }
                s.serialize_int(n);
                for (i = 0; i <= n - 1; i++)
                {
                    s.serialize_double(v[i]);
                }
            }
Exemplo n.º 3
0
            /*************************************************************************
            Serializer: serialization

              -- ALGLIB --
                 Copyright 14.03.2011 by Bochkanov Sergey
            *************************************************************************/
            public static void mlpserialize(alglib.serializer s,
                multilayerperceptron network)
            {
                int i = 0;
                int j = 0;
                int k = 0;
                int fkind = 0;
                double threshold = 0;
                double v0 = 0;
                double v1 = 0;
                int nin = 0;
                int nout = 0;

                nin = network.hllayersizes[0];
                nout = network.hllayersizes[alglib.ap.len(network.hllayersizes) - 1];
                s.serialize_int(scodes.getmlpserializationcode());
                s.serialize_int(mlpfirstversion);
                s.serialize_bool(mlpissoftmax(network));
                apserv.serializeintegerarray(s, network.hllayersizes, -1);
                for (i = 1; i <= alglib.ap.len(network.hllayersizes) - 1; i++)
                {
                    for (j = 0; j <= network.hllayersizes[i] - 1; j++)
                    {
                        mlpgetneuroninfo(network, i, j, ref fkind, ref threshold);
                        s.serialize_int(fkind);
                        s.serialize_double(threshold);
                        for (k = 0; k <= network.hllayersizes[i - 1] - 1; k++)
                        {
                            s.serialize_double(mlpgetweight(network, i - 1, k, i, j));
                        }
                    }
                }
                for (j = 0; j <= nin - 1; j++)
                {
                    mlpgetinputscaling(network, j, ref v0, ref v1);
                    s.serialize_double(v0);
                    s.serialize_double(v1);
                }
                for (j = 0; j <= nout - 1; j++)
                {
                    mlpgetoutputscaling(network, j, ref v0, ref v1);
                    s.serialize_double(v0);
                    s.serialize_double(v1);
                }
            }
Exemplo n.º 4
0
 /*************************************************************************
 Serialization: complex value
 *************************************************************************/
 public static void serializecomplex(alglib.serializer s,
     complex v)
 {
     s.serialize_double(v.x);
     s.serialize_double(v.y);
 }
Exemplo n.º 5
0
            /*************************************************************************
            Serializer: serialization

              -- ALGLIB --
                 Copyright 02.02.2012 by Bochkanov Sergey
            *************************************************************************/
            public static void rbfserialize(alglib.serializer s,
                rbfmodel model)
            {

                //
                // Header
                //
                s.serialize_int(scodes.getrbfserializationcode());
                s.serialize_int(rbffirstversion);

                //
                // Data
                //
                s.serialize_int(model.nx);
                s.serialize_int(model.ny);
                s.serialize_int(model.nc);
                s.serialize_int(model.nl);
                nearestneighbor.kdtreeserialize(s, model.tree);
                apserv.serializerealmatrix(s, model.xc, -1, -1);
                apserv.serializerealmatrix(s, model.wr, -1, -1);
                s.serialize_double(model.rmax);
                apserv.serializerealmatrix(s, model.v, -1, -1);
            }