C#,数值计算——完全VEGAS编码的蒙特·卡洛计算方法与源程序

1 文本格式

using System;

namespace Legalsoft.Truffer
{
    /// <summary>
    /// Complete VEGAS Code
    /// adaptive/recursive Monte Carlo
    /// </summary>
    public abstract class VEGAS
    {
        const int NDMX = 50;
        const int MXDIM = 10;
        const int RANSEED = 5330;
        const double ALPH = 1.5;
        const double TINY = 1.0e-30;
        private Ran ran_vegas = new Ran(RANSEED);

        //public static delegateFuncVectorDouble func_v_d { get; set; } = null;
        public VEGAS()
        {
        }

        public abstract double fxn(double[] x, double wgt);

        public static void rebin(double rc, int nd, double[] r, double[] xin, double[,] xi, int j)
        {
            //int i;
            int k = 0;
            double dr = 0.0;
            //double xn = 0.0;
            double xo = 0.0;

            for (int i = 0; i < nd - 1; i++)
            {
                while (rc > dr)
                {
                    dr += r[(++k) - 1];
                }
                if (k > 1)
                {
                    xo = xi[j, k - 2];
                }
                double xn = xi[j, k - 1];
                dr -= rc;
                xin[i] = xn - (xn - xo) * dr / r[k - 1];
            }
            for (int i = 0; i < nd - 1; i++)
            {
                xi[j, i] = xin[i];
            }
            xi[j, nd - 1] = 1.0;
        }

        /// <summary>
        /// Performs Monte Carlo integration of a user-supplied ndim-dimensional
        /// function fxn over a rectangular volume specified by regn[0..2 * ndim - 1], a
        /// vector consisting of ndim "lower left" coordinates of the region followed
        /// by ndim "upper right" coordinates.The integration consists of itmx
        /// iterations, each with approximately ncall calls to the function.After each
        /// iteration the grid is refined; more than 5 or 10 iterations are rarely
        /// useful.The input flag init signals whether this call is a new start or a
        /// subsequent call for additional iterations(see comments in the code). The
        /// input flag nprn(normally 0) controls the amount of diagnostic output.
        /// Returned answers are tgral (the best estimate of the integral), sd(its
        /// standard deviation), and chi2a(X^2 per degree of freedom, an indicator of
        /// whether consistent results are being obtained).
        /// </summary>
        /// <param name="regn"></param>
        /// <param name="init"></param>
        /// <param name="ncall"></param>
        /// <param name="itmx"></param>
        /// <param name="nprn"></param>
        /// <param name="tgral"></param>
        /// <param name="sd"></param>
        /// <param name="chi2a"></param>
        public void vegas(double[] regn, int init, int ncall, int itmx, int nprn, ref double tgral, ref double sd, ref double chi2a)
        {
            int mds = 0;
            int ndo = 0;
            double schi = 0.0;
            double si = 0.0;
            double swgt = 0.0;
            int[] ia = new int[MXDIM];
            int[] kg = new int[MXDIM];
            double[] dt = new double[MXDIM];
            double[] dx = new double[MXDIM];
            double[] r = new double[NDMX];
            double[] x = new double[MXDIM];
            double[] xin = new double[NDMX];
            double[,] d = new double[NDMX, MXDIM];
            double[,] di = new double[NDMX, MXDIM];
            double[,] xi = new double[MXDIM, NDMX];

            //Ran ran_vegas = new Ran(RANSEED);

            int ndim = regn.Length / 2;
            if (init <= 0)
            {
                mds = ndo = 1;
                for (int j = 0; j < ndim; j++)
                {
                    xi[j, 0] = 1.0;
                }
            }
            if (init <= 1)
            {
                si = swgt = schi = 0.0;
            }
            if (init <= 2)
            {
                int nd = NDMX;
                int ng = 1;
                if (mds != 0)
                {
                    ng = (int)Math.Pow(ncall / 2.0 + 0.25, 1.0 / ndim);
                    mds = 1;
                    if ((2 * ng - NDMX) >= 0)
                    {
                        mds = -1;
                        int n1pg = ng / NDMX + 1;
                        nd = ng / n1pg;
                        ng = n1pg * nd;
                    }
                }
                int k = 1;
                for (int i = 0; i < ndim; i++)
                {
                    k *= ng;
                }
                int npg = Math.Max((int)(ncall / k), 2);
                double calls = (double)npg * (double)k;
                double dxg = 1.0 / ng;
                double dv2g = 1.0;
                for (int i = 0; i < ndim; i++)
                {
                    dv2g *= dxg;
                }
                dv2g = Globals.SQR(calls * dv2g) / npg / npg / (npg - 1.0);
                int xnd = nd;
                dxg *= xnd;
                double xjac = 1.0 / calls;
                for (int j = 0; j < ndim; j++)
                {
                    dx[j] = regn[j + ndim] - regn[j];
                    xjac *= dx[j];
                }
                if (nd != ndo)
                {
                    for (int i = 0; i < Math.Max(nd, ndo); i++)
                    {
                        r[i] = 1.0;
                    }
                    for (int j = 0; j < ndim; j++)
                    {
                        rebin(ndo / xnd, nd, r, xin, xi, j);
                    }
                    ndo = nd;
                }
                if (nprn >= 0)
                {
                    /*
                    Console.Write(" Input parameters for vegas");
                    Console.Write("  ndim= ");
                    Console.Write("{0,4}", ndim);
                    Console.Write("{0,4}", "  ncall= ");
                    Console.Write("{0,8}", calls);
                    Console.Write("{0}", "\n");
                    Console.Write("{0,34}", "  it=");
                    Console.Write("{0,5}", it);
                    Console.Write("{0,5}", "  itmx=");
                    Console.Write("{0,5}", itmx);
                    Console.Write("{0}", "\n");
                    Console.Write("{0,34}", "  nprn=");
                    Console.Write("{0,5}", nprn);
                    Console.Write("{0,5}", "  ALPH=");
                    Console.Write("{0,9}", ALPH);
                    Console.Write("{0}", "\n");
                    Console.Write("{0,34}", "  mds=");
                    Console.Write("{0,5}", mds);
                    Console.Write("{0,5}", "  nd=");
                    Console.Write("{0,5}", nd);
                    Console.Write("{0}", "\n");
                    for (j = 0; j < ndim; j++)
                    {
                        Console.Write("{0,30}", " x1[");
                        Console.Write("{0,2}", j);
                        Console.Write("{0,2}", "]= ");
                        Console.Write("{0,11}", regn[j]);
                        Console.Write("{0}", " xu[");
                        Console.Write("{0,2}", j);
                        Console.Write("{0}", "]= ");
                        Console.Write("{0,11}", regn[j + ndim]);
                        Console.Write("{0}", "\n");
                    }
                    */
                    for (int it = 0; it < itmx; it++)
                    {
                        double ti = 0.0;
                        double tsi = 0.0;
                        for (int j = 0; j < ndim; j++)
                        {
                            kg[j] = 1;
                            for (int i = 0; i < nd; i++)
                            {
                                d[i, j] = di[i, j] = 0.0;
                            }
                        }
                        for (; ; )
                        {
                            double fb = 0.0;
                            double f2b = 0.0;
                            for (k = 0; k < npg; k++)
                            {
                                double w1gt = xjac;
                                for (int j = 0; j < ndim; j++)
                                {
                                    double xn = (kg[j] - ran_vegas.doub()) * dxg + 1.0;
                                    ia[j] = Math.Max(Math.Min((int)xn, NDMX), 1);
                                    double xo;
                                    double rc;
                                    if (ia[j] > 1)
                                    {
                                        xo = xi[j, ia[j] - 1] - xi[j, ia[j] - 2];
                                        rc = xi[j, ia[j] - 2] + (xn - ia[j]) * xo;
                                    }
                                    else
                                    {
                                        xo = xi[j, ia[j] - 1];
                                        rc = (xn - ia[j]) * xo;
                                    }
                                    x[j] = regn[j] + rc * dx[j];
                                    w1gt *= xo * xnd;
                                }
                                double f = w1gt * fxn(x, w1gt);
                                double f2 = f * f;
                                fb += f;
                                f2b += f2;
                                for (int j = 0; j < ndim; j++)
                                {
                                    di[ia[j] - 1, j] += f;
                                    if (mds >= 0)
                                    {
                                        d[ia[j] - 1, j] += f2;
                                    }
                                }
                            }
                            f2b = Math.Sqrt(f2b * npg);
                            f2b = (f2b - fb) * (f2b + fb);
                            if (f2b <= 0.0)
                            {
                                f2b = TINY;
                            }
                            ti += fb;
                            tsi += f2b;
                            if (mds < 0)
                            {
                                for (int j = 0; j < ndim; j++)
                                {
                                    d[ia[j] - 1, j] += f2b;
                                }
                            }
                            for (k = ndim - 1; k >= 0; k--)
                            {
                                kg[k] %= ng;
                                if (++kg[k] != 1)
                                {
                                    break;
                                }
                            }
                            if (k < 0)
                            {
                                break;
                            }
                        }
                        tsi *= dv2g;
                        double wgt = 1.0 / tsi;
                        si += wgt * ti;
                        schi += wgt * ti * ti;
                        swgt += wgt;
                        tgral = si / swgt;
                        chi2a = (schi - si * tgral) / (it + 0.0001);
                        if (chi2a < 0.0)
                        {
                            chi2a = 0.0;
                        }
                        sd = Math.Sqrt(1.0 / swgt);
                        tsi = Math.Sqrt(tsi);
                    }

                    if (nprn >= 0)
                    {
                        /*
                        Console.Write(" iteration no. ");
                        Console.Write("{0,3}", (it + 1));
                        Console.Write("{0,3}", " : integral = ");
                        Console.Write("{0,14}", ti);
                        Console.Write("{0,14}", " +/- ");
                        Console.Write("{0,9}", tsi);
                        Console.Write("{0}", "\n");
                        Console.Write("{0}", " all iterations:  ");
                        Console.Write("{0}", " integral =");
                        Console.Write("{0,14}", tgral);
                        Console.Write("{0}", "+-");
                        Console.Write("{0,9}", sd);
                        Console.Write("{0,9}", " chi**2/IT n =");
                        Console.Write("{0,9}", chi2a);
                        Console.Write("{0}", "\n");
                        if (nprn != 0)
                        {
                            for (j = 0; j < ndim; j++)
                            {
                                Console.Write("{0}", " DATA FOR axis  ");
                                Console.Write("{0,2}", j);
                                Console.Write("{0}", "\n");
                                Console.Write("{0}", "     X      delta i          X      delta i");
                                Console.Write("{0}", "          X       deltai");
                                Console.Write("{0}", "\n");
                                for (i = nprn / 2; i < nd - 2; i += nprn + 2)
                                {
                                    Console.Write("{0,8}", xi[j, i]);
                                    Console.Write("{0,12}", di[i, j]);
                                    Console.Write("{0,12}", xi[j, i + 1]);
                                    Console.Write("{0,12}", di[i + 1, j]);
                                    Console.Write("{0,12}", xi[j, i + 2]);
                                    Console.Write("{0,12}", di[i + 2, j]);
                                    Console.Write("{0,12}", "\n");
                                }
                            }
                        }
                        */
                    }
                    for (int j = 0; j < ndim; j++)
                    {
                        double xo = d[0, j];
                        double xn = d[1, j];
                        d[0, j] = (xo + xn) / 2.0;
                        dt[j] = d[0, j];
                        for (int i = 2; i < nd; i++)
                        {
                            double rc = xo + xn;
                            xo = xn;
                            xn = d[i, j];
                            d[i - 1, j] = (rc + xn) / 3.0;
                            dt[j] += d[i - 1, j];
                        }
                        d[nd - 1, j] = (xo + xn) / 2.0;
                        dt[j] += d[nd - 1, j];
                    }
                    for (int j = 0; j < ndim; j++)
                    {
                        double rc = 0.0;
                        for (int i = 0; i < nd; i++)
                        {
                            if (d[i, j] < TINY)
                            {
                                d[i, j] = TINY;
                            }
                            r[i] = Math.Pow((1.0 - d[i, j] / dt[j]) / (Math.Log(dt[j]) - Math.Log(d[i, j])), ALPH);
                            rc += r[i];
                        }
                        rebin(rc / xnd, nd, r, xin, xi, j);
                    }
                }
            }
        }
    }
}
 

2 代码格式

using System;namespace Legalsoft.Truffer
{/// <summary>/// Complete VEGAS Code/// adaptive/recursive Monte Carlo/// </summary>public abstract class VEGAS{const int NDMX = 50;const int MXDIM = 10;const int RANSEED = 5330;const double ALPH = 1.5;const double TINY = 1.0e-30;private Ran ran_vegas = new Ran(RANSEED);//public static delegateFuncVectorDouble func_v_d { get; set; } = null;public VEGAS(){}public abstract double fxn(double[] x, double wgt);public static void rebin(double rc, int nd, double[] r, double[] xin, double[,] xi, int j){//int i;int k = 0;double dr = 0.0;//double xn = 0.0;double xo = 0.0;for (int i = 0; i < nd - 1; i++){while (rc > dr){dr += r[(++k) - 1];}if (k > 1){xo = xi[j, k - 2];}double xn = xi[j, k - 1];dr -= rc;xin[i] = xn - (xn - xo) * dr / r[k - 1];}for (int i = 0; i < nd - 1; i++){xi[j, i] = xin[i];}xi[j, nd - 1] = 1.0;}/// <summary>/// Performs Monte Carlo integration of a user-supplied ndim-dimensional/// function fxn over a rectangular volume specified by regn[0..2 * ndim - 1], a/// vector consisting of ndim "lower left" coordinates of the region followed/// by ndim "upper right" coordinates.The integration consists of itmx/// iterations, each with approximately ncall calls to the function.After each/// iteration the grid is refined; more than 5 or 10 iterations are rarely/// useful.The input flag init signals whether this call is a new start or a/// subsequent call for additional iterations(see comments in the code). The/// input flag nprn(normally 0) controls the amount of diagnostic output./// Returned answers are tgral (the best estimate of the integral), sd(its/// standard deviation), and chi2a(X^2 per degree of freedom, an indicator of/// whether consistent results are being obtained)./// </summary>/// <param name="regn"></param>/// <param name="init"></param>/// <param name="ncall"></param>/// <param name="itmx"></param>/// <param name="nprn"></param>/// <param name="tgral"></param>/// <param name="sd"></param>/// <param name="chi2a"></param>public void vegas(double[] regn, int init, int ncall, int itmx, int nprn, ref double tgral, ref double sd, ref double chi2a){int mds = 0;int ndo = 0;double schi = 0.0;double si = 0.0;double swgt = 0.0;int[] ia = new int[MXDIM];int[] kg = new int[MXDIM];double[] dt = new double[MXDIM];double[] dx = new double[MXDIM];double[] r = new double[NDMX];double[] x = new double[MXDIM];double[] xin = new double[NDMX];double[,] d = new double[NDMX, MXDIM];double[,] di = new double[NDMX, MXDIM];double[,] xi = new double[MXDIM, NDMX];//Ran ran_vegas = new Ran(RANSEED);int ndim = regn.Length / 2;if (init <= 0){mds = ndo = 1;for (int j = 0; j < ndim; j++){xi[j, 0] = 1.0;}}if (init <= 1){si = swgt = schi = 0.0;}if (init <= 2){int nd = NDMX;int ng = 1;if (mds != 0){ng = (int)Math.Pow(ncall / 2.0 + 0.25, 1.0 / ndim);mds = 1;if ((2 * ng - NDMX) >= 0){mds = -1;int n1pg = ng / NDMX + 1;nd = ng / n1pg;ng = n1pg * nd;}}int k = 1;for (int i = 0; i < ndim; i++){k *= ng;}int npg = Math.Max((int)(ncall / k), 2);double calls = (double)npg * (double)k;double dxg = 1.0 / ng;double dv2g = 1.0;for (int i = 0; i < ndim; i++){dv2g *= dxg;}dv2g = Globals.SQR(calls * dv2g) / npg / npg / (npg - 1.0);int xnd = nd;dxg *= xnd;double xjac = 1.0 / calls;for (int j = 0; j < ndim; j++){dx[j] = regn[j + ndim] - regn[j];xjac *= dx[j];}if (nd != ndo){for (int i = 0; i < Math.Max(nd, ndo); i++){r[i] = 1.0;}for (int j = 0; j < ndim; j++){rebin(ndo / xnd, nd, r, xin, xi, j);}ndo = nd;}if (nprn >= 0){/*Console.Write(" Input parameters for vegas");Console.Write("  ndim= ");Console.Write("{0,4}", ndim);Console.Write("{0,4}", "  ncall= ");Console.Write("{0,8}", calls);Console.Write("{0}", "\n");Console.Write("{0,34}", "  it=");Console.Write("{0,5}", it);Console.Write("{0,5}", "  itmx=");Console.Write("{0,5}", itmx);Console.Write("{0}", "\n");Console.Write("{0,34}", "  nprn=");Console.Write("{0,5}", nprn);Console.Write("{0,5}", "  ALPH=");Console.Write("{0,9}", ALPH);Console.Write("{0}", "\n");Console.Write("{0,34}", "  mds=");Console.Write("{0,5}", mds);Console.Write("{0,5}", "  nd=");Console.Write("{0,5}", nd);Console.Write("{0}", "\n");for (j = 0; j < ndim; j++){Console.Write("{0,30}", " x1[");Console.Write("{0,2}", j);Console.Write("{0,2}", "]= ");Console.Write("{0,11}", regn[j]);Console.Write("{0}", " xu[");Console.Write("{0,2}", j);Console.Write("{0}", "]= ");Console.Write("{0,11}", regn[j + ndim]);Console.Write("{0}", "\n");}*/for (int it = 0; it < itmx; it++){double ti = 0.0;double tsi = 0.0;for (int j = 0; j < ndim; j++){kg[j] = 1;for (int i = 0; i < nd; i++){d[i, j] = di[i, j] = 0.0;}}for (; ; ){double fb = 0.0;double f2b = 0.0;for (k = 0; k < npg; k++){double w1gt = xjac;for (int j = 0; j < ndim; j++){double xn = (kg[j] - ran_vegas.doub()) * dxg + 1.0;ia[j] = Math.Max(Math.Min((int)xn, NDMX), 1);double xo;double rc;if (ia[j] > 1){xo = xi[j, ia[j] - 1] - xi[j, ia[j] - 2];rc = xi[j, ia[j] - 2] + (xn - ia[j]) * xo;}else{xo = xi[j, ia[j] - 1];rc = (xn - ia[j]) * xo;}x[j] = regn[j] + rc * dx[j];w1gt *= xo * xnd;}double f = w1gt * fxn(x, w1gt);double f2 = f * f;fb += f;f2b += f2;for (int j = 0; j < ndim; j++){di[ia[j] - 1, j] += f;if (mds >= 0){d[ia[j] - 1, j] += f2;}}}f2b = Math.Sqrt(f2b * npg);f2b = (f2b - fb) * (f2b + fb);if (f2b <= 0.0){f2b = TINY;}ti += fb;tsi += f2b;if (mds < 0){for (int j = 0; j < ndim; j++){d[ia[j] - 1, j] += f2b;}}for (k = ndim - 1; k >= 0; k--){kg[k] %= ng;if (++kg[k] != 1){break;}}if (k < 0){break;}}tsi *= dv2g;double wgt = 1.0 / tsi;si += wgt * ti;schi += wgt * ti * ti;swgt += wgt;tgral = si / swgt;chi2a = (schi - si * tgral) / (it + 0.0001);if (chi2a < 0.0){chi2a = 0.0;}sd = Math.Sqrt(1.0 / swgt);tsi = Math.Sqrt(tsi);}if (nprn >= 0){/*Console.Write(" iteration no. ");Console.Write("{0,3}", (it + 1));Console.Write("{0,3}", " : integral = ");Console.Write("{0,14}", ti);Console.Write("{0,14}", " +/- ");Console.Write("{0,9}", tsi);Console.Write("{0}", "\n");Console.Write("{0}", " all iterations:  ");Console.Write("{0}", " integral =");Console.Write("{0,14}", tgral);Console.Write("{0}", "+-");Console.Write("{0,9}", sd);Console.Write("{0,9}", " chi**2/IT n =");Console.Write("{0,9}", chi2a);Console.Write("{0}", "\n");if (nprn != 0){for (j = 0; j < ndim; j++){Console.Write("{0}", " DATA FOR axis  ");Console.Write("{0,2}", j);Console.Write("{0}", "\n");Console.Write("{0}", "     X      delta i          X      delta i");Console.Write("{0}", "          X       deltai");Console.Write("{0}", "\n");for (i = nprn / 2; i < nd - 2; i += nprn + 2){Console.Write("{0,8}", xi[j, i]);Console.Write("{0,12}", di[i, j]);Console.Write("{0,12}", xi[j, i + 1]);Console.Write("{0,12}", di[i + 1, j]);Console.Write("{0,12}", xi[j, i + 2]);Console.Write("{0,12}", di[i + 2, j]);Console.Write("{0,12}", "\n");}}}*/}for (int j = 0; j < ndim; j++){double xo = d[0, j];double xn = d[1, j];d[0, j] = (xo + xn) / 2.0;dt[j] = d[0, j];for (int i = 2; i < nd; i++){double rc = xo + xn;xo = xn;xn = d[i, j];d[i - 1, j] = (rc + xn) / 3.0;dt[j] += d[i - 1, j];}d[nd - 1, j] = (xo + xn) / 2.0;dt[j] += d[nd - 1, j];}for (int j = 0; j < ndim; j++){double rc = 0.0;for (int i = 0; i < nd; i++){if (d[i, j] < TINY){d[i, j] = TINY;}r[i] = Math.Pow((1.0 - d[i, j] / dt[j]) / (Math.Log(dt[j]) - Math.Log(d[i, j])), ALPH);rc += r[i];}rebin(rc / xnd, nd, r, xin, xi, j);}}}}}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/95650.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Linux CentOS7 vim寄存器

计算机中通常所说的寄存器Register一般指的是CPU中的寄存器&#xff0c;用来暂存CPU处理所需要的指令、数据等。 vim中同样也有寄存器&#xff0c;使用的方式和CPU非常类似。 vim中的寄存器(register)作用和windows中的剪切板类似&#xff0c;不过vim中的寄存器不止一个&…

解决WPF+Avalonia在openKylin系统下默认字体问题

一、openKylin简介 openKylin&#xff08;开放麒麟&#xff09; 社区是在开源、自愿、平等和协作的基础上&#xff0c;由基础软硬件企业、非营利性组织、社团组织、高等院校、科研机构和个人开发者共同创立的一个开源社区&#xff0c;致力于通过开源、开放的社区合作&#xff…

IEEE802系列协议知识点总结

IEEE 802 协议包含了以下多种子协议。把这些协议汇集在一起就叫IEEE 802 协议集。 (1)IEEE802.1 IEEE 802.1协议提供高层标准的框架&#xff0c;包括端到端协议、网络互连、网络管理、路由选择、桥接和性能测量。 •IEEE 802.1d:生成树协议(Spanning Tree Protocol&#xff0c…

计算机专业毕业设计项目推荐12-志愿者管理系统(Spring+Js+Mysql)

志愿者管理系统&#xff08;SpringJsMysql&#xff09; **介绍****各部分模块实现** 介绍 本系列(后期可能博主会统一为专栏)博文献给即将毕业的计算机专业同学们,因为博主自身本科和硕士也是科班出生,所以也比较了解计算机专业的毕业设计流程以及模式&#xff0c;在编写的过程…

QT:鼠标画线(双画布)

widget.h #ifndef WIDGET_H #define WIDGET_H#include <QWidget> #include <QPoint> //点 #include <QMouseEvent> //鼠标事件 #include <QPaintEvent> //绘图事件class Widget : public QWidget {Q_OBJECTpublic:Widget(QWidget *parent 0);~Wi…

汽车网络安全--安全芯片应用场景解析

​在聊汽车网络安全时,最先想到的就是使用芯片内置HSM,比如说英飞凌TC2xx系列的HSM、瑞萨RH850的ICU、NXP的HSE等等;实际上除了内置HSM,还有外置HSM(通过UART、SPI等通信)、安全存储芯片等等。而这些芯片统称为安全芯片。 安全芯片的主要作用是为整个系统建立起一个可信的…

IIS Application Pool

在连接字符串Connection string中&#xff0c;Pooling为是否启用连接池&#xff0c;默认值为Poolingtrue&#xff0c;表示启用。与连接池相关的两个重要参数是 Min Pool Size(默认值是0) 和 Max Pool Size (默認值為100&#xff0c;最大值为32767)&#xff0c;分别指池中的最小…

通过融合UGV的地图信息和IMU的惯性测量数据,实现对车辆精确位置和运动状态的估计和跟踪研究(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…

543. 二叉树的直径

题目描述 给你一棵二叉树的根节点&#xff0c;返回该树的 直径 。 二叉树的 直径 是指树中任意两个节点之间最长路径的 长度 。这条路径可能经过也可能不经过根节点 root 。 两节点之间路径的 长度 由它们之间边数表示。 示例 1&#xff1a; 输入&#xff1a;root [1,2,3,…

ChatGPT基础使用总结

文章目录 一、ChatGPT基础概念大型语言模型LLMs---一种能够以类似人类语言的方式“说话”的软件ChatGPT定义---OpenAI 研发的一款聊天机器人程序&#xff08;2022年GPT-3.5&#xff0c;属于大型语言模型&#xff09;ChatGPT4.0---OpenAI推出了GPT系列的最新模型ChatGPT典型使用…

FusionCharts Suite XT v3.21 Crack

FusionCharts Suite XT v3.21 在圆环图和饼图上将图例和数据值显示为百分比或绝对值。 2023 年 10 月 4 日 - 15:15新版本 特征 通过允许用户将图例和数据值显示为百分比或绝对值&#xff0c;改进了圆环图和饼图。 添加了一个新功能&#xff0c;可以删除任何可能导致代码错误的…

电脑数据恢复怎么操作?电脑数据恢复难点是什么

随着电脑在我们日常生活中的普及&#xff0c;数据的重要性不言而喻。然而&#xff0c;在某些情况下&#xff0c;我们可能会不小心删除或因其他原因导致丢失了重要的电脑数据&#xff0c;这时候就需要进行数据恢复操作。下面我们一起来了解下电脑数据恢复的操作方法&#xff0c;…

多媒体应用设计师

1.多媒体技术基础 1.1.媒体与技术 1.1.媒体 维基百科&#xff1a;传播信息载体 国际电信联盟&#xff08;ITU-T&#xff09;&#xff1a;感知、表示、存储和传输的手段和方法。 两层含义&#xff1a;存储信息的实体&#xff0c;媒质。传递信息载体&#xff0c;媒介。 1.2.国…

游戏设计模式专栏(五):三步学会原型模式

引言 大家好&#xff0c;我是亿元程序员&#xff0c;一位有着8年游戏行业经验的主程。 本系列是《和8年游戏主程一起学习设计模式》&#xff0c;让糟糕的代码在潜移默化中升华&#xff0c;欢迎大家关注分享收藏订阅。 原型模式在游戏开发中是一种重要的设计模式&#xff0c;…

节日灯饰灯串灯出口欧洲CE认证办理

灯串&#xff08;灯带&#xff09;&#xff0c;这个产品的形状就象一根带子一样&#xff0c;再加上产品的主要原件就是LED&#xff0c;因此叫做灯串或者灯带。2022年&#xff0c;我国灯具及相关配件产品出口总额超过460亿美元。其中北美是最大的出口市场。其次是欧洲市场&#…

Spring的AOP开发-注解方式开发AOP

基于注解配置的AOP 注解方式AOP的基本使用 Spring的AOP也提供了注解方式配置&#xff0c;使用相应的注解替代之前的xml配置&#xff0c;xml配置AOP时&#xff0c;我们主要配置了三部分&#xff1a;目标类被Spring容器管理&#xff08;注解使用Service&#xff09;、通知类被S…

全网唯一!Matlab王者荣耀配色包MHonor

前些日子在家整理文档&#xff0c;偶然发现自己一年前建的一个工程&#xff0c;其大概内容是从王者荣耀一些角色皮肤的原画中提取配色方案&#xff0c;从而用于PPT制作、论文插图绘制等&#xff0c;为枯燥的科研生活增添点儿乐趣。 但是&#xff0c;由于自己当时的技术力还不够…

Android Studio实现简易计算器(带横竖屏,深色浅色模式,更该按钮颜色,selector,style的使用)

目录 前言 运行结果&#xff1a; 运行截屏&#xff08;p50e&#xff09; apk文件 源码文件 项目结构 总览 MainActivity.java drawable 更改图标的方法&#xff1a; blackbutton.xml bluebuttons.xml greybutton.xml orangebuttons.xml whitebutton.xml layout 布…

关联规则挖掘(上):数据分析 | 数据挖掘 | 十大算法之一

⭐️⭐️⭐️⭐️⭐️欢迎来到我的博客⭐️⭐️⭐️⭐️⭐️ &#x1f434;作者&#xff1a;秋无之地 &#x1f434;简介&#xff1a;CSDN爬虫、后端、大数据领域创作者。目前从事python爬虫、后端和大数据等相关工作&#xff0c;主要擅长领域有&#xff1a;爬虫、后端、大数据…

复习 --- QT服务器客户端

服务器&#xff1a; 头文件&#xff1a; #ifndef WIDGET_H #define WIDGET_H#include <QWidget> #include<QTcpServer> #include<QTcpSocket> #include<QMessageBox> #include<QDebug> #include<QList> #include<QListWidget> #in…