C#,数值计算——计算实对称矩阵所有特征值与特征向量的三角分解与QL迭代法源程序

1 文本格式

using System;

namespace Legalsoft.Truffer
{
    /// <summary>
    /// Computes all eigenvalues and eigenvectors of a real symmetric matrix by
    /// reduction to tridiagonal form followed by QL iteration.
    /// </summary>
    public class Symmeig
    {
        public int n { get; set; }
        public double[,] z;
        public double[] d;
        public double[] e;
        public bool yesvecs { get; set; }

        /// <summary>
        /// Computes all eigenvalues and eigenvectors of a real symmetric matrix
        /// a[0..n - 1][0..n - 1] by reduction to tridiagonal form followed by QL
        /// iteration.On output, d[0..n - 1] contains the eigenvalues of a sorted into
        /// descending order, while z[0..n - 1][0..n - 1] is a matrix whose columns contain
        /// the corresponding normalized eigenvectors.If yesvecs is input as true (the
        /// default), then the eigenvectors are computed.If yesvecs is input as false,
        /// only the eigenvalues are computed.
        /// </summary>
        /// <param name="a"></param>
        /// <param name="yesvec"></param>
        public Symmeig(double[,] a, bool yesvec = true)
        {
            this.n = a.GetLength(0);
            this.z = a;
            this.d = new double[n];
            this.e = new double[n];
            this.yesvecs = yesvec;

            tred2();
            tqli();
            sort();
        }

        /// <summary>
        /// Computes all eigenvalues and(optionally) eigenvectors of a real,
        /// symmetric, tridiagonal matrix by QL iteration.On input, dd[0..n - 1]
        /// contains the diagonal elements of the tridi- agonal matrix.The vector
        /// ee[0..n-1] inputs the subdiagonal elements of the tridiagonal matrix, with
        /// ee[0] arbitrary.Output is the same as the constructor above.
        /// </summary>
        /// <param name="dd"></param>
        /// <param name="ee"></param>
        /// <param name="yesvec"></param>
        public Symmeig(double[] dd, double[] ee, bool yesvec = true)
        {
            this.n = dd.Length;
            this.d = dd;
            this.e = ee;
            this.z = new double[n, n];
            this.yesvecs = yesvec;
            for (int i = 0; i < n; i++)
            {
                z[i, i] = 1.0;
            }

            tqli();
            sort();
        }

        public void sort()
        {
            if (yesvecs)
            {
                Jacobi.eigsrt( d,  z);
            }
            else
            {
                Jacobi.eigsrt( d,  z);
            }
        }

        /// <summary>
        /// Householder reduction of a real symmetric matrix z[0..n - 1][0..n-1]. (The
        /// input matrix A to Symmeig is stored in z.) On output, z is replaced by the
        /// orthogonal matrix Q effecting the transformation.d[0..n - 1] contains the
        /// diagonal elements of the tridiagonal matrix and e[0..n - 1] the off-diagonal
        /// elements, with e[0]=0. If yesvecs is false, so that only eigenvalues will
        /// subsequently be determined, several statements are omitted, in which case z
        /// contains no useful information on output.
        /// </summary>
        public void tred2()
        {
            for (int i = n - 1; i > 0; i--)
            {
                int l = i - 1;
                double h = 0.0;
                double scale = 0.0;
                if (l > 0)
                {
                    for (int k = 0; k < i; k++)
                    {
                        scale += Math.Abs(z[i, k]);
                    }
                    //if (scale == 0.0)
                    if (Math.Abs(scale) <= float.Epsilon)
                    {
                        e[i] = z[i, l];
                    }
                    else
                    {
                        for (int k = 0; k < i; k++)
                        {
                            z[i, k] /= scale;
                            h += z[i, k] * z[i, k];
                        }
                        double f = z[i, l];
                        double g = (f >= 0.0 ? -Math.Sqrt(h) : Math.Sqrt(h));
                        e[i] = scale * g;
                        h -= f * g;
                        z[i, l] = f - g;
                        f = 0.0;
                        for (int j = 0; j < i; j++)
                        {
                            if (yesvecs)
                            {
                                z[j, i] = z[i, j] / h;
                            }
                            g = 0.0;
                            for (int k = 0; k < j + 1; k++)
                            {
                                g += z[j, k] * z[i, k];
                            }
                            for (int k = j + 1; k < i; k++)
                            {
                                g += z[k, j] * z[i, k];
                            }
                            e[j] = g / h;
                            f += e[j] * z[i, j];
                        }
                        double hh = f / (h + h);
                        for (int j = 0; j < i; j++)
                        {
                            f = z[i, j];
                            e[j] = g = e[j] - hh * f;
                            for (int k = 0; k < j + 1; k++)
                            {
                                z[j, k] -= (f * e[k] + g * z[i, k]);
                            }
                        }
                    }
                }
                else
                {
                    e[i] = z[i, l];
                }
                d[i] = h;
            }
            if (yesvecs)
            {
                d[0] = 0.0;
            }
            e[0] = 0.0;
            for (int i = 0; i < n; i++)
            {
                if (yesvecs)
                {
                    if (d[i] != 0.0)
                    {
                        for (int j = 0; j < i; j++)
                        {
                            double g = 0.0;
                            for (int k = 0; k < i; k++)
                            {
                                g += z[i, k] * z[k, j];
                            }
                            for (int k = 0; k < i; k++)
                            {
                                z[k, j] -= g * z[k, i];
                            }
                        }
                    }
                    d[i] = z[i, i];
                    z[i, i] = 1.0;
                    for (int j = 0; j < i; j++)
                    {
                        z[j, i] = z[i, j] = 0.0;
                    }
                }
                else
                {
                    d[i] = z[i, i];
                }
            }
        }

        /// <summary>
        /// QL algorithm with implicit shifts to determine the eigenvalues and
        /// (optionally) the eigenvectors of a real, symmetric, tridiagonal matrix, or
        /// of a real symmetric matrix previously reduced by tred2. On input,
        /// d[0..n-1] contains the diagonal elements of the tridiagonal matrix. On
        /// output, it returns the eigenvalues. The vector e[0..n - 1] inputs the
        /// subdiagonal elements of the tridiagonal matrix, with e[0] arbitrary. On
        /// output e is destroyed.If the eigenvectors of a tridiagonal matrix are
        /// desired, the matrix z[0..n - 1][0..n - 1] is input as the identity matrix.If
        /// the eigenvectors of a matrix that has been reduced by tred2 are required,
        /// then z is input as the matrix output by tred2.In either case, column k of
        /// z returns the normalized eigenvector corresponding to d[k]
        /// </summary>
        /// <exception cref="Exception"></exception>
        public void tqli()
        {
            const double EPS = float.Epsilon;
            for (int i = 1; i < n; i++)
            {
                e[i - 1] = e[i];
            }
            e[n - 1] = 0.0;
            for (int l = 0; l < n; l++)
            {
                int iter = 0;
                int m;
                do
                {
                    for (m = l; m < n - 1; m++)
                    {
                        double dd = Math.Abs(d[m]) + Math.Abs(d[m + 1]);
                        if (Math.Abs(e[m]) <= EPS * dd)
                        {
                            break;
                        }
                    }
                    if (m != l)
                    {
                        if (iter++ == 30)
                        {
                            throw new Exception("Too many iterations in tqli");
                        }
                        double g = (d[l + 1] - d[l]) / (2.0 * e[l]);
                        double r = pythag(g, 1.0);
                        g = d[m] - d[l] + e[l] / (g + Globals.SIGN(r, g));
                        double s = 1.0;
                        double c = 1.0;
                        double p = 0.0;
                        int i = m - 1;
                        for (; i >= l; i--)
                        {
                            double f = s * e[i];
                            double b = c * e[i];
                            e[i + 1] = (r = pythag(f, g));
                            //if (r == 0.0)
                            if (Math.Abs(r) <= float.Epsilon)
                            {
                                d[i + 1] -= p;
                                e[m] = 0.0;
                                break;
                            }
                            s = f / r;
                            c = g / r;
                            g = d[i + 1] - p;
                            r = (d[i] - g) * s + 2.0 * c * b;
                            d[i + 1] = g + (p = s * r);
                            g = c * r - b;
                            if (yesvecs)
                            {
                                for (int k = 0; k < n; k++)
                                {
                                    f = z[k, i + 1];
                                    z[k, i + 1] = s * z[k, i] + c * f;
                                    z[k, i] = c * z[k, i] - s * f;
                                }
                            }
                        }
                        //if (r == 0.0 && i >= l)
                        if (Math.Abs(r) <= float.Epsilon && i >= l)
                        {
                            continue;
                        }
                        d[l] -= p;
                        e[l] = g;
                        e[m] = 0.0;
                    }
                } while (m != l);
            }
        }

        public double pythag(double a, double b)
        {
            double absa = Math.Abs(a);
            double absb = Math.Abs(b);
            //return (absa > absb ? absa * Math.Sqrt(1.0 + Globals.SQR(absb / absa)) : (absb == 0.0 ? 0.0 : absb * Math.Sqrt(1.0 + Globals.SQR(absa / absb))));
            return (absa > absb ? absa * Math.Sqrt(1.0 + Globals.SQR(absb / absa)) : ((absb <= float.Epsilon) ? 0.0 : absb * Math.Sqrt(1.0 + Globals.SQR(absa / absb))));
        }
    }
}
 

2 代码格式

using System;

namespace Legalsoft.Truffer
{
    /// <summary>
    /// Computes all eigenvalues and eigenvectors of a real symmetric matrix by
    /// reduction to tridiagonal form followed by QL iteration.
    /// </summary>
    public class Symmeig
    {
        public int n { get; set; }
        public double[,] z;
        public double[] d;
        public double[] e;
        public bool yesvecs { get; set; }

        /// <summary>
        /// Computes all eigenvalues and eigenvectors of a real symmetric matrix
        /// a[0..n - 1][0..n - 1] by reduction to tridiagonal form followed by QL
        /// iteration.On output, d[0..n - 1] contains the eigenvalues of a sorted into
        /// descending order, while z[0..n - 1][0..n - 1] is a matrix whose columns contain
        /// the corresponding normalized eigenvectors.If yesvecs is input as true (the
        /// default), then the eigenvectors are computed.If yesvecs is input as false,
        /// only the eigenvalues are computed.
        /// </summary>
        /// <param name="a"></param>
        /// <param name="yesvec"></param>
        public Symmeig(double[,] a, bool yesvec = true)
        {
            this.n = a.GetLength(0);
            this.z = a;
            this.d = new double[n];
            this.e = new double[n];
            this.yesvecs = yesvec;

            tred2();
            tqli();
            sort();
        }

        /// <summary>
        /// Computes all eigenvalues and(optionally) eigenvectors of a real,
        /// symmetric, tridiagonal matrix by QL iteration.On input, dd[0..n - 1]
        /// contains the diagonal elements of the tridi- agonal matrix.The vector
        /// ee[0..n-1] inputs the subdiagonal elements of the tridiagonal matrix, with
        /// ee[0] arbitrary.Output is the same as the constructor above.
        /// </summary>
        /// <param name="dd"></param>
        /// <param name="ee"></param>
        /// <param name="yesvec"></param>
        public Symmeig(double[] dd, double[] ee, bool yesvec = true)
        {
            this.n = dd.Length;
            this.d = dd;
            this.e = ee;
            this.z = new double[n, n];
            this.yesvecs = yesvec;
            for (int i = 0; i < n; i++)
            {
                z[i, i] = 1.0;
            }

            tqli();
            sort();
        }

        public void sort()
        {
            if (yesvecs)
            {
                Jacobi.eigsrt( d,  z);
            }
            else
            {
                Jacobi.eigsrt( d,  z);
            }
        }

        /// <summary>
        /// Householder reduction of a real symmetric matrix z[0..n - 1][0..n-1]. (The
        /// input matrix A to Symmeig is stored in z.) On output, z is replaced by the
        /// orthogonal matrix Q effecting the transformation.d[0..n - 1] contains the
        /// diagonal elements of the tridiagonal matrix and e[0..n - 1] the off-diagonal
        /// elements, with e[0]=0. If yesvecs is false, so that only eigenvalues will
        /// subsequently be determined, several statements are omitted, in which case z
        /// contains no useful information on output.
        /// </summary>
        public void tred2()
        {
            for (int i = n - 1; i > 0; i--)
            {
                int l = i - 1;
                double h = 0.0;
                double scale = 0.0;
                if (l > 0)
                {
                    for (int k = 0; k < i; k++)
                    {
                        scale += Math.Abs(z[i, k]);
                    }
                    //if (scale == 0.0)
                    if (Math.Abs(scale) <= float.Epsilon)
                    {
                        e[i] = z[i, l];
                    }
                    else
                    {
                        for (int k = 0; k < i; k++)
                        {
                            z[i, k] /= scale;
                            h += z[i, k] * z[i, k];
                        }
                        double f = z[i, l];
                        double g = (f >= 0.0 ? -Math.Sqrt(h) : Math.Sqrt(h));
                        e[i] = scale * g;
                        h -= f * g;
                        z[i, l] = f - g;
                        f = 0.0;
                        for (int j = 0; j < i; j++)
                        {
                            if (yesvecs)
                            {
                                z[j, i] = z[i, j] / h;
                            }
                            g = 0.0;
                            for (int k = 0; k < j + 1; k++)
                            {
                                g += z[j, k] * z[i, k];
                            }
                            for (int k = j + 1; k < i; k++)
                            {
                                g += z[k, j] * z[i, k];
                            }
                            e[j] = g / h;
                            f += e[j] * z[i, j];
                        }
                        double hh = f / (h + h);
                        for (int j = 0; j < i; j++)
                        {
                            f = z[i, j];
                            e[j] = g = e[j] - hh * f;
                            for (int k = 0; k < j + 1; k++)
                            {
                                z[j, k] -= (f * e[k] + g * z[i, k]);
                            }
                        }
                    }
                }
                else
                {
                    e[i] = z[i, l];
                }
                d[i] = h;
            }
            if (yesvecs)
            {
                d[0] = 0.0;
            }
            e[0] = 0.0;
            for (int i = 0; i < n; i++)
            {
                if (yesvecs)
                {
                    if (d[i] != 0.0)
                    {
                        for (int j = 0; j < i; j++)
                        {
                            double g = 0.0;
                            for (int k = 0; k < i; k++)
                            {
                                g += z[i, k] * z[k, j];
                            }
                            for (int k = 0; k < i; k++)
                            {
                                z[k, j] -= g * z[k, i];
                            }
                        }
                    }
                    d[i] = z[i, i];
                    z[i, i] = 1.0;
                    for (int j = 0; j < i; j++)
                    {
                        z[j, i] = z[i, j] = 0.0;
                    }
                }
                else
                {
                    d[i] = z[i, i];
                }
            }
        }

        /// <summary>
        /// QL algorithm with implicit shifts to determine the eigenvalues and
        /// (optionally) the eigenvectors of a real, symmetric, tridiagonal matrix, or
        /// of a real symmetric matrix previously reduced by tred2. On input,
        /// d[0..n-1] contains the diagonal elements of the tridiagonal matrix. On
        /// output, it returns the eigenvalues. The vector e[0..n - 1] inputs the
        /// subdiagonal elements of the tridiagonal matrix, with e[0] arbitrary. On
        /// output e is destroyed.If the eigenvectors of a tridiagonal matrix are
        /// desired, the matrix z[0..n - 1][0..n - 1] is input as the identity matrix.If
        /// the eigenvectors of a matrix that has been reduced by tred2 are required,
        /// then z is input as the matrix output by tred2.In either case, column k of
        /// z returns the normalized eigenvector corresponding to d[k]
        /// </summary>
        /// <exception cref="Exception"></exception>
        public void tqli()
        {
            const double EPS = float.Epsilon;
            for (int i = 1; i < n; i++)
            {
                e[i - 1] = e[i];
            }
            e[n - 1] = 0.0;
            for (int l = 0; l < n; l++)
            {
                int iter = 0;
                int m;
                do
                {
                    for (m = l; m < n - 1; m++)
                    {
                        double dd = Math.Abs(d[m]) + Math.Abs(d[m + 1]);
                        if (Math.Abs(e[m]) <= EPS * dd)
                        {
                            break;
                        }
                    }
                    if (m != l)
                    {
                        if (iter++ == 30)
                        {
                            throw new Exception("Too many iterations in tqli");
                        }
                        double g = (d[l + 1] - d[l]) / (2.0 * e[l]);
                        double r = pythag(g, 1.0);
                        g = d[m] - d[l] + e[l] / (g + Globals.SIGN(r, g));
                        double s = 1.0;
                        double c = 1.0;
                        double p = 0.0;
                        int i = m - 1;
                        for (; i >= l; i--)
                        {
                            double f = s * e[i];
                            double b = c * e[i];
                            e[i + 1] = (r = pythag(f, g));
                            //if (r == 0.0)
                            if (Math.Abs(r) <= float.Epsilon)
                            {
                                d[i + 1] -= p;
                                e[m] = 0.0;
                                break;
                            }
                            s = f / r;
                            c = g / r;
                            g = d[i + 1] - p;
                            r = (d[i] - g) * s + 2.0 * c * b;
                            d[i + 1] = g + (p = s * r);
                            g = c * r - b;
                            if (yesvecs)
                            {
                                for (int k = 0; k < n; k++)
                                {
                                    f = z[k, i + 1];
                                    z[k, i + 1] = s * z[k, i] + c * f;
                                    z[k, i] = c * z[k, i] - s * f;
                                }
                            }
                        }
                        //if (r == 0.0 && i >= l)
                        if (Math.Abs(r) <= float.Epsilon && i >= l)
                        {
                            continue;
                        }
                        d[l] -= p;
                        e[l] = g;
                        e[m] = 0.0;
                    }
                } while (m != l);
            }
        }

        public double pythag(double a, double b)
        {
            double absa = Math.Abs(a);
            double absb = Math.Abs(b);
            //return (absa > absb ? absa * Math.Sqrt(1.0 + Globals.SQR(absb / absa)) : (absb == 0.0 ? 0.0 : absb * Math.Sqrt(1.0 + Globals.SQR(absa / absb))));
            return (absa > absb ? absa * Math.Sqrt(1.0 + Globals.SQR(absb / absa)) : ((absb <= float.Epsilon) ? 0.0 : absb * Math.Sqrt(1.0 + Globals.SQR(absa / absb))));
        }
    }
}

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Qlik 成为网络犯罪的焦点

研究人员警告说&#xff0c;Cactus 勒索软件组织正在利用 Qlik Sense 数据可视化、探索和监控解决方案中的关键漏洞来获得对企业网络的初始访问权限。 今年八月下旬&#xff0c;Qlik Sense 开发人员 针对影响 Windows 版本平台的两个关键漏洞发布了补丁 。 其中一个漏洞 CVE-…

【高效开发工具系列】云服务器+Nginx自定义图床

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…

Oracle-数据库连接数异常上涨问题分析

问题&#xff1a; 用户的数据库在某个时间段出现连接数异常上涨问题&#xff0c;时间持续5分钟左右&#xff0c;并且问题期间应用无法正常连接请求数据库 从连接数的监控上可以看到数据库平常峰值不到100个连接&#xff0c;在问题时间段突然上涨到400以上 问题分析&#xff1a;…

6页手写笔记总结信号与系统常考知识大题知识点

题型一 判断系统特性题型二 求系统卷积题型三 求三大变换正反变换题型四 求全响应题型五 已知微分方程求系统传递函数题型六 已知系统的传递函数求微分方程题型七 画出系统的零极点图&#xff0c;并判断系统的因果性和稳定性 &#xff08;笔记适合快速复习&#xff0c;可能会有…

Spring-AOP

目录 一、引入AOP 二、核心AOP概念和术语 三、切点表达式 四、Spring实现AOP &#xff08;一&#xff09;AspectJ的支持 1 、基于注解开发 1.1 引入依赖 1.2 实现目标类 1.3 定义切面类&#xff08;日志管理&#xff09; 1.4 将目标类和切面类纳入Spring容器 1.5 开…

分布式搜索引擎(Elastic Search)+消息队列(RabbitMQ)部署

一、分布式搜索引擎&#xff1a;Elastic Search Elastic Search的目标就是实现搜索。是一款非常强大的开源搜索引擎&#xff0c;可以帮助我们从海量数据中快速找到需要的内容。在数据量少的时候&#xff0c;我们可以通过索引去搜索关系型数据库中的数据&#xff0c;但是如果数…

MySQL-含json字段表和与不含json字段表查询性能对比

含json字段表和与不含json字段表查询性能对比 说明: EP_USER_PICTURE_INFO_2:不含json字段表 20200729json_test:含有json字段表 其中20200729json_test 标准ID、MANAGER_NO、PHONE_NO 为非json字段 data为json字段 2个表中MANAGER_NO、PHONE_NO都创建了各自的索引 测试…

iphone/安卓手机如何使用burp抓包

iphone 1. 电脑 ipconfig /all 获取电脑网卡ip&#xff1a; 192.168.31.10 2. 电脑burp上面打开设置&#xff0c;proxy&#xff0c;增加一条 192.168.31.10:8080 3. 4. 手机进入设置 -> Wi-Fi -> 找到HTTP代理选项&#xff0c;选择手动&#xff0c;192.168.31.10:8080 …

gitlab注册无中国区电话验证问题

众所周知gitlab对中国区不友好&#xff0c;无法直接注册&#xff0c;页面无法选择86的手机号进行验证码发送。 Google上众多的方案是修改dom&#xff0c;而且时间大约是21年以前。 修改dom&#xff0c;对于现在的VUE、React框架来说是没有用的&#xff0c;所以不用尝试。 直接看…

the name of a constructor must match the name of the enclosing class

构造器名匹配封闭类名 命令码的位置关系不对 解决&#xff1a;调整 命令码所在层级

pandas详细笔记

一&#xff1a;什么是Pandas from matplotlib import pyplot import numpy as np import pandas as pdarange np.arange(1, 10, 2) series pd.Series(arange,indexlist("ABCDE")) print(series)二&#xff1a;索引 三&#xff1a;切片 位置索引切片&#xff08;左闭…

排序的概念及其运用

1.排序的概念 排序&#xff1a;所谓排序&#xff0c;就是使一串记录&#xff0c;按照其中的某个或某些关键字的大小&#xff0c;递增或递减的排列起来的操作。 稳定性&#xff1a;假定在待排序的记录序列中&#xff0c;存在多个具有相同的关键字的记录&#xff0c;若经过排序…

华清远见嵌入式学习——C++——作业6

作业要求&#xff1a; 代码&#xff1a; #include <iostream>using namespace std;class Animal { public:virtual void perform() 0;};class Lion:public Animal { private:string foods;string feature; public:Lion(){}Lion(string foods,string feature):foods(foo…

SpringBoot_02

Web后端开发_07 SpringBoot_02 SpringBoot原理 1.配置优先级 1.1配置 SpringBoot中支持三种格式的配置文件&#xff1a; application.propertiesapplication.ymlapplication.yaml properties、yaml、yml三种配置文件&#xff0c;优先级最高的是properties 配置文件优先级…

PET(Point-Query Quadtree for Crowd Counting, Localization, and More)

PET&#xff08;Point-Query Quadtree for Crowd Counting, Localization, and More&#xff09; 介绍实验记录训练阶段推断阶段 介绍 论文&#xff1a;Point-Query Quadtree for Crowd Counting, Localization, and More 实验记录 训练阶段 TODO 推断阶段 下面是以一张输…

图解Spark Graphx实现顶点关联邻接顶点的collectNeighbors函数原理

一、场景案例 在一张社区网络里&#xff0c;可能需要查询出各个顶点邻接关联的顶点集合&#xff0c;类似查询某个人关系比较近的都有哪些人的场景。 在用Spark graphx中&#xff0c;通过函数collectNeighbors便可以获取到源顶点邻接顶点的数据。 下面以一个例子来说明&#…

C语言之程序的组成和元素格式

目录 关键字 运算符 标识符 姓名和标识符 分隔符 常量和字符串常量 自由的书写格式 书写限制 连接相邻的字符串常量 缩进 本节我们来学习程序的各组成元素&#xff08;关键字、运算符等&#xff09;和格式相关的内容。 关键字 在C语言中&#xff0c;相if和else这样的标识…

Arduino学习笔记2023年11月30日

目录 1 编程软件下载2 代码结构3 IO引脚控制3.1 引脚初始化3.2 引脚使用数字量输出数字量输入模拟量输出模拟量输入 4 串口串口初始化串口输出串口输入 5 外部中断6 函数6.1 映射区间函数6.2 延时函数 总结 1 编程软件下载 官网链接&#xff1a;https://www.arduino.cc/ 下载链…

python学习:opencv+用鼠标画矩形和圆形

目录 步骤 定义数据 新建一个窗口黑色画布 显示黑色画布 添加鼠标回调函数 循环 一直显示图片 一直判断有没有按下字母 m 关闭所有窗口 鼠标回调函数 步骤 当鼠标按下记录坐标并记录鼠标标记位为true&#xff0c;移动的时候就会不断的画矩形或者圆&#xff0c;松下的时候就再…

Apache Doris 在某工商信息商业查询平台的湖仓一体建设实践

本文导读&#xff1a; 信息服务行业可以提供多样化、便捷、高效、安全的信息化服务&#xff0c;为个人及商业决策提供了重要支撑与参考。本文以某工商信息商业查询平台为例&#xff0c;介绍其从传统 Lambda 架构到基于 Doris Multi-Catalog 的湖仓一体架构演进历程。同时通过一…