当前位置: 首页 > news >正文

线性求解器Ax=b的验证

文章目录

    • 前言
    • Matrix Market
    • Matlab IO
      • Read data
      • Write data
      • 测试
    • C++ IO
      • Read and write data
    • Download Matrix
    • IO 代码下载
    • 参考网址

前言

一般情况集成了一个线性求解器(Ax=b),我们需要验证其性能和精度,这时需要大量数据来做验证, 尤其是有不同性质的矩阵 AAA 的数据,例如:稀疏性, 对称性, 正定性, 对角占优等。

Matrix Market

Matrix Market
Matrix Market 网站提供了友好的接口和数据, 方便我们验证求解器的精度和性能,尤其是对各种性质的矩阵 AAA 都有很多数据, 包含不同维数。

Matlab IO

Read data

function  [A,rows,cols,entries,rep,field,symm] = mmread(filename)
%
% function  [A] = mmread(filename)
%
% function  [A,rows,cols,entries,rep,field,symm] = mmread(filename)
%
%      Reads the contents of the Matrix Market file 'filename'
%      into the matrix 'A'.  'A' will be either sparse or full,
%      depending on the Matrix Market format indicated by
%      'coordinate' (coordinate sparse storage), or
%      'array' (dense array storage).  The data will be duplicated
%      as appropriate if symmetry is indicated in the header.
%
%      Optionally, size information about the matrix can be 
%      obtained by using the return values rows, cols, and
%      entries, where entries is the number of nonzero entries
%      in the final matrix. Type information can also be retrieved
%      using the optional return values rep (representation), field,
%      and symm (symmetry).
%mmfile = fopen(filename,'r');
if ( mmfile == -1 )disp(filename);error('File not found');
end;header = fgets(mmfile);
if (header == -1 )error('Empty file.')
end% NOTE: If using a version of Matlab for which strtok is not
%       defined, substitute 'gettok' for 'strtok' in the 
%       following lines, and download gettok.m from the
%       Matrix Market site.    
[head0,header]   = strtok(header);  % see note above
[head1,header]   = strtok(header);
[rep,header]     = strtok(header);
[field,header]   = strtok(header);
[symm,header]    = strtok(header);
head1 = lower(head1);
rep   = lower(rep);
field = lower(field);
symm  = lower(symm);
if ( length(symm) == 0 )disp(['Not enough words in header line of file ',filename]) disp('Recognized format: ')disp('%%MatrixMarket matrix representation field symmetry')error('Check header line.')
end
if ( ~ strcmp(head0,'%%MatrixMarket') )error('Not a valid MatrixMarket header.')
end
if (  ~ strcmp(head1,'matrix') )disp(['This seems to be a MatrixMarket ',head1,' file.']);disp('This function only knows how to read MatrixMarket matrix files.');disp('  ');error('  ');
end% Read through comments, ignoring themcommentline = fgets(mmfile);
while length(commentline) > 0 & commentline(1) == '%',commentline = fgets(mmfile);
end% Read size information, then branch according to
% sparse or dense formatif ( strcmp(rep,'coordinate')) %  read matrix given in sparse %  coordinate matrix format[sizeinfo,count] = sscanf(commentline,'%d%d%d');while ( count == 0 )commentline =  fgets(mmfile);if (commentline == -1 )error('End-of-file reached before size information was found.')end[sizeinfo,count] = sscanf(commentline,'%d%d%d');if ( count > 0 & count ~= 3 )error('Invalid size specification line.')endendrows = sizeinfo(1);cols = sizeinfo(2);entries = sizeinfo(3);if  ( strcmp(field,'real') )               % real valued entries:[T,count] = fscanf(mmfile,'%f',3);T = [T; fscanf(mmfile,'%f')];if ( size(T) ~= 3*entries )message = ...str2mat('Data file does not contain expected amount of data.',...'Check that number of data lines matches nonzero count.');disp(message);error('Invalid data.');endT = reshape(T,3,entries)';A = sparse(T(:,1), T(:,2), T(:,3), rows , cols);elseif   ( strcmp(field,'complex'))            % complex valued entries:T = fscanf(mmfile,'%f',4);T = [T; fscanf(mmfile,'%f')];if ( size(T) ~= 4*entries )message = ...str2mat('Data file does not contain expected amount of data.',...'Check that number of data lines matches nonzero count.');disp(message);error('Invalid data.');endT = reshape(T,4,entries)';A = sparse(T(:,1), T(:,2), T(:,3) + T(:,4)*sqrt(-1), rows , cols);elseif  ( strcmp(field,'pattern'))    % pattern matrix (no values given):T = fscanf(mmfile,'%f',2);T = [T; fscanf(mmfile,'%f')];if ( size(T) ~= 2*entries )message = ...str2mat('Data file does not contain expected amount of data.',...'Check that number of data lines matches nonzero count.');disp(message);error('Invalid data.');endT = reshape(T,2,entries)';A = sparse(T(:,1), T(:,2), ones(entries,1) , rows , cols);endelseif ( strcmp(rep,'array') ) %  read matrix given in dense %  array (column major) format[sizeinfo,count] = sscanf(commentline,'%d%d');while ( count == 0 )commentline =  fgets(mmfile);if (commentline == -1 )error('End-of-file reached before size information was found.')end[sizeinfo,count] = sscanf(commentline,'%d%d');if ( count > 0 & count ~= 2 )error('Invalid size specification line.')endendrows = sizeinfo(1);cols = sizeinfo(2);entries = rows*cols;if  ( strcmp(field,'real') )               % real valued entries:A = fscanf(mmfile,'%f',1);A = [A; fscanf(mmfile,'%f')];if ( strcmp(symm,'symmetric') | strcmp(symm,'hermitian') | strcmp(symm,'skew-symmetric') ) for j=1:cols-1,currenti = j*rows;A = [A(1:currenti); zeros(j,1);A(currenti+1:length(A))];endelseif ( ~ strcmp(symm,'general') )disp('Unrecognized symmetry')disp(symm)disp('Recognized choices:')disp('   symmetric')disp('   hermitian')disp('   skew-symmetric')disp('   general')error('Check symmetry specification in header.');endA = reshape(A,rows,cols);elseif  ( strcmp(field,'complex'))         % complx valued entries:tmpr = fscanf(mmfile,'%f',1);tmpi = fscanf(mmfile,'%f',1);A  = tmpr+tmpi*i;for j=1:entries-1tmpr = fscanf(mmfile,'%f',1);tmpi = fscanf(mmfile,'%f',1);A  = [A; tmpr + tmpi*i];endif ( strcmp(symm,'symmetric') | strcmp(symm,'hermitian') | strcmp(symm,'skew-symmetric') ) for j=1:cols-1,currenti = j*rows;A = [A(1:currenti); zeros(j,1);A(currenti+1:length(A))];endelseif ( ~ strcmp(symm,'general') )disp('Unrecognized symmetry')disp(symm)disp('Recognized choices:')disp('   symmetric')disp('   hermitian')disp('   skew-symmetric')disp('   general')error('Check symmetry specification in header.');endA = reshape(A,rows,cols);elseif  ( strcmp(field,'pattern'))    % pattern (makes no sense for dense)disp('Matrix type:',field)error('Pattern matrix type invalid for array storage format.');else                                 % Unknown matrix typedisp('Matrix type:',field)error('Invalid matrix type specification. Check header against MM documentation.');end
end%
% If symmetric, skew-symmetric or Hermitian, duplicate lower
% triangular part and modify entries as appropriate:
%if ( strcmp(symm,'symmetric') )A = A + A.' - diag(diag(A));entries = nnz(A);
elseif ( strcmp(symm,'hermitian') )A = A + A' - diag(diag(A));entries = nnz(A);
elseif ( strcmp(symm,'skew-symmetric') )A = A - A';entries = nnz(A);
endfclose(mmfile);
% Done.

Write data

function [ err ] = mmwrite(filename,A,comment,field,precision)
%
% Function: mmwrite(filename,A,comment,field,precision)
%
%    Writes the sparse or dense matrix A to a Matrix Market (MM) 
%    formatted file.
%
% Required arguments: 
%
%                 filename  -  destination file
%
%                 A         -  sparse or full matrix
%
% Optional arguments: 
%
%                 comment   -  matrix of comments to prepend to
%                              the MM file.  To build a comment matrix,
%                              use str2mat. For example:
%
%                              comment = str2mat(' Comment 1' ,...
%                                                ' Comment 2',...
%                                                ' and so on.',...
%                                                ' to attach a date:',...
%                                                [' ',date]);
%                              If ommitted, a single line date stamp comment
%                              will be included.
%
%                 field     -  'real'
%                              'complex'
%                              'integer'
%                              'pattern'
%                              If ommitted, data will determine type.
%
%                 precision -  number of digits to display for real 
%                              or complex values
%                              If ommitted, full working precision is used.
%if ( nargin == 5) precision = 16;
elseif ( nargin == 4) precision = 16;
elseif ( nargin == 3) mattype = 'real'; % placeholder, will check after FIND-ing Aprecision = 16;
elseif ( nargin == 2) comment = '';% Check whether there is an imaginary part:mattype = 'real'; % placeholder, will check after FIND-ing Aprecision = 16;
endmmfile = fopen([filename],'w');
if ( mmfile == -1 )error('Cannot open file for output');
end;[M,N] = size(A);%%%%%%%%%%%%%       This part for sparse matrices     %%%%%%%%%%%%%%%%
if ( issparse(A) )[I,J,V] = find(A);if ( sum(abs(imag(nonzeros(V)))) > 0 )Vreal = 0; else Vreal = 1; endif ( ~ strcmp(mattype,'pattern') & Vreal )mattype = 'real'; elseif ( ~ strcmp(mattype,'pattern') )mattype = 'complex';end
%
% Determine symmetry:
%if ( M ~= N )symm = 'general';issymm = 0;NZ = length(V);elseissymm = 1;NZ = length(V);for i=1:NZif ( A(J(i),I(i)) ~= V(i) )issymm = 0;break;endendif ( issymm )symm = 'symmetric';ATEMP = tril(A);[I,J,V] = find(ATEMP);NZ = nnz(ATEMP);elseisskew = 1;for i=1:NZif ( A(J(i),I(i)) ~= - V(i) )isskew = 0;break;endendif ( isskew )symm = 'skew-symmetric';ATEMP = tril(A);[I,J,V] = find(ATEMP);NZ = nnz(ATEMP);elseif ( strcmp(mattype,'complex') )isherm = 1;for i=1:NZif ( A(J(i),I(i)) ~= conj(V(i)) )isherm = 0;break;endendif ( isherm )symm = 'hermitian';ATEMP = tril(A);[I,J,V] = find(ATEMP);NZ = nnz(ATEMP);else symm = 'general';NZ = nnz(A);endelsesymm = 'general';NZ = nnz(A);endendend% Sparse coordinate format:rep = 'coordinate';fprintf(mmfile,'%%%%MatrixMarket matrix %s %s %s\n',rep,mattype,symm);[MC,NC] = size(comment);if ( MC == 0 )fprintf(mmfile,'%% Generated %s\n',[date]);elsefor i=1:MC,fprintf(mmfile,'%%%s\n',comment(i,:));endendfprintf(mmfile,'%d %d %d\n',M,N,NZ);cplxformat = sprintf('%%d %%d %% .%dg %% .%dg\n',precision,precision);realformat = sprintf('%%d %%d %% .%dg\n',precision);if ( strcmp(mattype,'real') )for i=1:NZfprintf(mmfile,realformat,I(i),J(i),V(i));end;elseif ( strcmp(mattype,'complex') )for i=1:NZfprintf(mmfile,cplxformat,I(i),J(i),real(V(i)),imag(V(i)));end;elseif ( strcmp(mattype,'pattern') )for i=1:NZfprintf(mmfile,'%d %d\n',I(i),J(i));end;else  err = -1;disp('Unsupported mattype:')mattypeend;%%%%%%%%%%%%%       This part for dense matrices      %%%%%%%%%%%%%%%%
elseif ( sum(abs(imag(nonzeros(A)))) > 0 )Areal = 0; else Areal = 1; endif ( ~strcmp(mattype,'pattern') & Areal )mattype = 'real';elseif ( ~strcmp(mattype,'pattern')  )mattype = 'complex';end
%
% Determine symmetry:
%if ( M ~= N )issymm = 0;symm = 'general';elseissymm = 1;for j=1:N for i=j+1:Nif (A(i,j) ~= A(j,i) )issymm = 0;   break; endendif ( ~ issymm ) break; endendif ( issymm )symm = 'symmetric';elseisskew = 1;for j=1:N for i=j+1:Nif (A(i,j) ~= - A(j,i) )isskew = 0;   break; endendif ( ~ isskew ) break; endendif ( isskew )symm = 'skew-symmetric';elseif ( strcmp(mattype,'complex') )isherm = 1;for j=1:N for i=j+1:Nif (A(i,j) ~= conj(A(j,i)) )isherm = 0;   break; endendif ( ~ isherm ) break; endendif ( isherm )symm = 'hermitian';else symm = 'general';endelsesymm = 'general';endendend% Dense array format:rep = 'array';[MC,NC] = size(comment);fprintf(mmfile,'%%%%MatrixMarket matrix %s %s %s\n',rep,mattype,symm);for i=1:MC,fprintf(mmfile,'%%%s\n',comment(i,:));end;fprintf(mmfile,'%d %d\n',M,N);cplxformat = sprintf('%% .%dg %% .%dg\n', precision,precision);realformat = sprintf('%% .%dg\n', precision);if ( ~ strcmp(symm,'general') )rowloop = 'j';else rowloop = '1';endif ( strcmp(mattype,'real') )for j=1:Nfor i=eval(rowloop):Mfprintf(mmfile,realformat,A(i,j));endendelseif ( strcmp(mattype,'complex') )for j=1:Nfor i=eval(rowloop):Mfprintf(mmfile,cplxformat,real(A(i,j)),imag(A(i,j)));endendelseif ( strcmp(mattype,'pattern') )err = -2disp('Pattern type inconsistant with dense matrix')elseerr = -2disp('Unknown matrix type:')mattypeend
endfclose(mmfile);

测试

% 读取 bcsstk14.mtx 的矩阵信息存储于矩阵 A 中, rows cols 分别是行列
[A,rows,cols,entries,rep,field,symm] = mmread("bcsstk14.mtx");
% 将矩阵 A 写到 data.txt 文件中
mmwrite("data.txt", A, field)
[A2,rows,cols,entries,rep,field,symm] = mmread("data.txt");
error = A - A2;
error_norm = norm(error, 2)

C++ IO

在 网址 C++ IO 下载 mmio.hmmio.c 文件

Read and write data

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <stdlib.h>
#include <string>
#include <map>
#include "mmio.h"
#include <stdio.h>using namespace std;int main(int argc, char *argv[])
{
#if 1// read datastring fileName = "../data/bcsstk14.mtx"; int ret_code;MM_typecode matcode;FILE *f;int M, N, nz;   int i, *I, *J;double *val;map<unsigned int, map<unsigned int, double> > A; // Storage in triplet mode, <row <col val> > ; A's id from zeroif ((f = fopen(fileName.c_str(), "r")) == NULL) {cerr<<"read file error, please check."<<endl;exit(1);}if (mm_read_banner(f, &matcode) != 0){printf("Could not process Matrix Market banner.\n");exit(1);}/*  This is how one can screen matrix types if their application *//*  only supports a subset of the Matrix Market data types.      */if (mm_is_complex(matcode) && mm_is_matrix(matcode) && mm_is_sparse(matcode) ) {printf("Sorry, this application does not support ");printf("Market Market type: [%s]\n", mm_typecode_to_str(matcode));exit(1);}/* find out size of sparse matrix .... */if ((ret_code = mm_read_mtx_crd_size(f, &M, &N, &nz)) !=0) {exit(1);}/* reseve memory for matrices */I = (int *) malloc(nz * sizeof(int));J = (int *) malloc(nz * sizeof(int));val = (double *) malloc(nz * sizeof(double));/* NOTE: when reading in doubles, ANSI C requires the use of the "l"  *//*   specifier as in "%lg", "%lf", "%le", otherwise errors will occur *//*  (ANSI C X3.159-1989, Sec. 4.9.6.2, p. 136 lines 13-15)            */for (i=0; i<nz; i++) {fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i]);I[i]--;  /* adjust from 1-based to 0-based */J[i]--;}if (f != stdin)  {fclose(f);}/************************//* now write out matrix *//************************/mm_write_banner(stdout, matcode);mm_write_mtx_crd_size(stdout, M, N, nz);for (i=0; i<nz; i++) {//fprintf(stdout, "%d %d %20.19g\n", I[i]+1, J[i]+1, val[i]);A[I[i]][J[i]] = val[i];}#endif#if 0// write dataconst int nz = 4;const int M = 10;const int N = 10;MM_typecode matcode;                        int I[nz] = { 0, 4, 2, 8 };int J[nz] = { 3, 8, 7, 5 };double val[nz] = {1.1, 2.2, 3.2, 4.4};int i;mm_initialize_typecode(&matcode);mm_set_matrix(&matcode);mm_set_coordinate(&matcode);mm_set_real(&matcode);mm_write_banner(stdout, matcode); mm_write_mtx_crd_size(stdout, M, N, nz);/* NOTE: matrix market files use 1-based indices, i.e. first elementof a vector has index 1, not 0.  */for (i=0; i<nz; i++) {fprintf(stdout, "%d %d %10.3g\n", I[i]+1, J[i]+1, val[i]);}
#endifreturn 0;
}

Download Matrix

在网址的主页面可以看到 Search by matrix properties

在这里插入图片描述

在之后的红色框中选择所需要的矩阵性质 回车即可。
在这里插入图片描述

最后利用前面介绍的 IO 的代码, 即可把矩阵导入到自己的线性求解器中, 作为验证。

IO 代码下载

以上的所有代码包括一个测试的例子均可以到我的 GitHub 网页下载,其中包含 MakeFile文件。

参考网址

Matrix Market : https://math.nist.gov/MatrixMarket/

相关文章:

线性求解器Ax=b的验证

文章目录前言Matrix MarketMatlab IORead dataWrite data测试C IORead and write dataDownload MatrixIO 代码下载参考网址前言 一般情况集成了一个线性求解器&#xff08;Axb&#xff09;&#xff0c;我们需要验证其性能和精度&#xff0c;这时需要大量数据来做验证&#xff…...

java 事件处理机制 观察者模式

事件处理机制有三个要素事件、事件源、事件监听与java的对应关系如下事件事件源事件监听javaclassjava.util.EventObjectjava.util.EventObject 的 source 属性interfacejava.util.EventListener观察者模式又被称为发布-订阅&#xff08;Publish/Subscribe&#xff09;模式&…...

使用 HTML5 轻松验证表单插件

下载:https://download.csdn.net/download/mo3408/87559594 效果图: 当您通过表单从人们那里收集信息时,必须应用某种验证。如果不这样做,可能会导致客户流失、数据库中的垃圾数据甚至网站的安全漏洞。从历史上看,构建表单验证一直很痛苦。在服务器端,全栈框架会为您处理…...

【Error: ImagePullBackOff】Kubernetes中Nginx服务启动失败排查流程

❌pod节点启动失败&#xff0c;nginx服务无法正常访问&#xff0c;服务状态显示为ImagePullBackOff。 [rootm1 ~]# kubectl get pods NAME READY STATUS RESTARTS AGE nginx-f89759699-cgjgp 0/1 ImagePullBackOff 0 103…...

九龙证券|直逼1.5万亿!A股融资余额创年内新高,青睐这些行业和个股

2023年以来&#xff0c;A股商场震动重复&#xff0c;商场走势整体先扬后抑&#xff0c;各路资金看法纷歧&#xff0c;但数据显现&#xff0c;融资客在此期间整体持续净买入&#xff0c;未受到商场动摇的明显冲击&#xff0c;融资余额日前已迫临1.5万亿元&#xff0c;创出年内新…...

【JavaScript】36_正则表达式

正则表达式 正则表达式 正则表达式用来定义一个规则通过这个规则计算机可以检查一个字符串是否符合规则 或者将字符串中符合规则的内容提取出来 正则表达式也是JS中的一个对象&#xff0c; 所以要使用正则表达式&#xff0c;需要先创建正则表达式的对象 new RegExp() 可以…...

参考 | 辨别真假笔记本三星内存条 (ddr4)

参考 | 辨别真假笔记本三星内存条 (ddr4) 文章目录参考 | 辨别真假笔记本三星内存条 (ddr4)1. 三星内存条标签纸上编码的含义2. 三星内存颗粒上编码的含义3. 辨别内容参考1. 三星内存条标签纸上编码的含义 内存条贴张上面有两串值得注意的编码, 其中编码的具体意义参考三星官方…...

JavaScript Math(算数)对象

Math&#xff08;算数&#xff09;对象的作用是&#xff1a;执行常见的算数任务。在线实例round()如何使用 round()。random()如何使用 random() 来返回 0 到 1 之间的随机数。max()如何使用 max() 来返回两个给定的数中的较大的数。&#xff08;在 ECMASCript v3 之前&#xf…...

MyBatis里面用了多少种设计模式?

在MyBatis的两万多行的框架源码中&#xff0c;使用了大量的设计模式对工程架构中的复杂场景进行解耦&#xff0c;这些设计模式的巧妙使用是整个框架的精华。经过整理&#xff0c;大概有以下设计模式&#xff0c;如图1所示。图101类型&#xff1a;创建型模式▊ 工厂模式SqlSessi…...

第三十二周精华分享(2023.02.27-2023.03.06)

本帖是知识星球各类问答以及文章精华沉淀区&#xff0c;而知识星球相关资源沉淀则在置顶帖的「资源沉淀」中。 学计算机的都应该知道有个局部性原理&#xff0c;其实局部性原理在很多场合都适用&#xff0c;比如80%的圈友的痛点或者疑惑其实都集中在一些固定的方面或者问题上&…...

数学建模资料整理

数学建模中有三类团队&#xff1a; 第一类&#xff1a;拿到题目&#xff0c;讨论&#xff0c;然后建模手开始建模&#xff0c;编程手开始处理数据&#xff0c;写作手开始写作。 第二类&#xff1a;拿到题目&#xff0c;团内大佬&#xff0c;开始建模&#xff0c;然后编程&#…...

设计模式---抽象工厂模式

目录 1 介绍 2 优缺点 3 实现 1 介绍 抽象工厂模式(Abstract Factory Pattern) 是围绕一个超级工厂创建其他工厂。该超级工厂又称为其他工厂的工厂。这种类型的设计模式属于创建型模式&#xff0c;它提供了一种创建对象的最佳方式。 在抽象工厂模式中&#xff0c;接口是负…...

Java Web 实战 07 - 多线程基础之单例模式

大家好 , 这篇文章给大家带来的是单例模式 , 单例模式中分为懒汉模式和饿汉模式 , 懒汉模式是需要用的到的时候才去创建实例 , 而饿汉模式是程序一启动就立刻创建实例 , 在这其中还有很多其他问题需要我们去研究 推荐大家跳转到这里 , 观看效果更加 上一篇文章的链接我也贴在这…...

uniapp上实现左右关联滚动

先看效果&#xff1a; 代码&#xff1a; <template><view class"container"><!-- 左侧fixed导航区域 --><view class"left"><viewv-for"item in leftList":key"item.id"class"left_item":class…...

Docker Remote API未授权访问

目录Docker简述Docker 2375端口安全风险Docker命令连接利用声明&#xff1a;本文仅供学习参考&#xff0c;其中涉及的一切资源均来源于网络&#xff0c;请勿用于任何非法行为&#xff0c;否则您将自行承担相应后果&#xff0c;本人不承担任何法律及连带责任。Docker简述 Docke…...

【蓝桥杯】第十四届蓝桥杯模拟赛(第三期)C++ (弱go的记录,有问题的话求指点)

博主是菜鸡啦&#xff0c;代码仅供参考&#xff0c;只确定能过样例&#xff0c;嘻嘻~第一题&#xff0c;填空题问题描述请找到一个大于 2022 的最小数&#xff0c;这个数转换成十六进制之后&#xff0c;所有的数位&#xff08;不含前导 0&#xff09;都为字母&#xff08;A 到 …...

算法24:LeetCode_并查集相关算法

目录 题目一&#xff1a;力扣547题&#xff0c;求省份数量 题目二&#xff1a;岛屿数量 题目三&#xff1a;岛屿数量拓展 什么是并查集&#xff0c;举个简单的例子。学生考试通常会以60分为及格分数&#xff0c;我们将60分及以上的人归类为及格学生&#xff0c;而60分以下归…...

TypeScript核心知识点

TypeScript 核心 类型注解 知道&#xff1a;TypeScript 类型注解 示例代码&#xff1a; // 约定变量 age 的类型为 number 类型 let age: number 18 age 19: number 就是类型注解&#xff0c;它为变量提供类型约束。约定了什么类型&#xff0c;就只能给该变量赋值什么类型的…...

基于“遥感+”融合技术在碳储量、碳收支、碳循环等多领域监测与模拟实践

以全球变暖为主要特征的气候变化已成为全球性环境问题&#xff0c;对全球可持续发展带来严峻挑战。2015年多国在《巴黎协定》上明确提出缔约方应尽快实现碳达峰和碳中和目标。2019年第49届 IPCC全会明确增加了基于卫星遥感的排放清单校验方法。随着碳中和目标以及全球碳盘点的现…...

外卖点餐系统小程序 PHP+UniAPP

一、介绍 本项目是给某大学餐厅开发的外面点餐系统&#xff0c;该项目针对校内的学生&#xff0c;配送由学校的学生负责配送。因此&#xff0c;该项目不同于互联网的外卖点餐系统。 该系统支持属于 Saas 系统&#xff0c;由平台端、商家端、用户端、以及配送端组成。 其中&a…...

vuex3的介绍与state、actions和mutations的使用

一、定义官网&#xff1a;Vuex 是什么&#xff1f; | Vuex (vuejs.org)Vuex 是一个专为 Vue.js 应用程序开发的状态管理模式。它采用集中式存储管理应用的所有组件的状态&#xff0c;并以相应的规则保证状态以一种可预测的方式发生变化。二、安装cdn<script src"/path/…...

windows 自带端口转发

使用Portproxy模式下的Netsh命令即能实现Windows系统中的端口转发&#xff0c;转发命令如下: netsh interface portproxy add v4tov4 listenaddress[localaddress] listenport[localport] connectaddress[destaddress]listenaddress – 等待连接的本地ip地址 listenport – 本…...

【算法】算法基础入门详解:轻松理解和运用基础算法

&#x1f600;大家好&#xff0c;我是白晨&#xff0c;一个不是很能熬夜&#x1f62b;&#xff0c;但是也想日更的人✈。如果喜欢这篇文章&#xff0c;点个赞&#x1f44d;&#xff0c;关注一下&#x1f440;白晨吧&#xff01;你的支持就是我最大的动力&#xff01;&#x1f4…...

2.9.1 Packet Tracer - Basic Switch and End Device Configuration(作业)

Packet Tracer - 交换机和终端设备的基本 配置地址分配表目标使用命令行界面 (CLI)&#xff0c;在两台思科互联网络 操作系统 (IOS) 交换机上配置主机名和 IP 地址。使用思科 IOS 命令指定或限制对设备 配置的访问。使用 IOS 命令来保存当前的运行配置。配置两台主机设备的 IP …...

AtCoder Beginner Contest 216(F)

F - Max Sum Counting 链接&#xff1a; F - Max Sum Counting 题意 两个 大小为 nnn 的序列 aiaiai 和 bibibi&#xff0c;任意选取一些下标 iii&#xff0c;求 max⁡(ai)>∑bi\max(ai) > \sum{bi}max(ai)>∑bi的方案数。 解析 首先考虑状态 一是和&#xff0c;…...

每天学一点之Stream流相关操作

StreamAPI 一、Stream特点 Stream是数据渠道&#xff0c;用于操作数据源&#xff08;集合、数组等&#xff09;所生成的元素序列。“集合讲的是数据&#xff0c;负责存储数据&#xff0c;Stream流讲的是计算&#xff0c;负责处理数据&#xff01;” 注意&#xff1a; ①Str…...

MatCap模拟光照效果实现

大家好&#xff0c;我是阿赵 之前介绍过各种光照模型的实现方法。那些光照模型的实现虽然有算法上的不同&#xff0c;但基本上都是灯光方向和法线方向的计算得出的明暗结果。 下面介绍一种叫做MatCap的模拟光照效果&#xff0c;这种方式计算非常简单&#xff0c;脱离灯光的计算…...

二十一、PG管理

一、 PG异常状态说明 1、 PG状态介绍 可以通过ceph pg stat命令查看PG当前状态&#xff0c;健康状态为“active clean” [rootrbd01 ~]# ceph pg stat 192 pgs: 192 activeclean; 1.3 KiB data, 64 MiB used, 114 GiB / 120 GiB avail; 85 B/s rd, 0 op/s2、pg常见状态 状…...

SAPUI5开发01_01-Installing Eclipse

1.0 简要要求概述: 本节您将安装SAPUI 5,以及如何在Eclipse Juno中集成SAPUI 5工具。 1.1 安装JDK JDK 是一种用于构建在 Java 平台上发布的应用程序、Applet 和组件的开发环境,即编写 Java 程序必须使用 JDK,它提供了编译和运行 Java 程序的环境。 在安装 JDK 之前,首…...

Qt之高仿QQ系统设置界面

QQ或360安全卫士的设置界面都是非常有特点的,所有的配置项都在一个垂直的ScrollArea中,但是又能通过左侧的导航栏点击定位。这样做的好处是既方便查看指定配置项,又方便查看所有配置项。 一.效果 下面左边是当前最新版QQ的系统设置界面,右边是我的高仿版本,几乎一毛一样…...

JVM概览:内存空间与数据存储

核心的五个部分虚拟机栈&#xff1a;局部变量中基础类型数据、对象的引用存储的位置&#xff0c;线程独立的。堆&#xff1a;大量运行时对象都在这个区域存储&#xff0c;线程共享的。方法区&#xff1a;存储运行时代码、类变量、常量池、构造器等信息&#xff0c;线程共享。程…...

固态存储设备固件升级方案

1. 前言 随着数字化时代的发展&#xff0c;数字数据的量越来越大&#xff0c;相应的数据存储的需求也越来越大&#xff0c;存储设备产业也是蓬勃发展。存储设备产业中&#xff0c;发展最为迅猛的则是固态存储(Solid State Storage&#xff0c;SSS)。数字化时代&#xff0c;海量…...

Python交通标志识别基于卷积神经网络的保姆级教程(Tensorflow)

项目介绍 TensorFlow2.X 搭建卷积神经网络&#xff08;CNN&#xff09;&#xff0c;实现交通标志识别。搭建的卷积神经网络是类似VGG的结构(卷积层与池化层反复堆叠&#xff0c;然后经过全连接层&#xff0c;最后用softmax映射为每个类别的概率&#xff0c;概率最大的即为识别…...

基于Selenium+Python的web自动化测试框架(附框架源码+项目实战)

目录 一、什么是Selenium&#xff1f; 二、自动化测试框架 三、自动化框架的设计和实现 四、需要改进的模块 五、总结 总结感谢每一个认真阅读我文章的人&#xff01;&#xff01;&#xff01; 重点&#xff1a;配套学习资料和视频教学 一、什么是Selenium&#xff1f; …...

Python进阶-----高阶函数zip() 函数

目录 前言&#xff1a; zip() 函数简介 运作过程&#xff1a; 应用实例 1.有序序列结合 2.无序序列结合 3.长度不统一的情况 前言&#xff1a; 家人们&#xff0c;看到标题应该都不陌生了吧&#xff0c;我们都知道压缩包文件的后缀就是zip的&#xff0c;当然还有r…...

win10打印机拒绝访问解决方法

一直以来,在安装使用共享打印机打印一些文件的时候&#xff0c;会遇到错误提示&#xff1a;“无法访问.你可能没有权限使用网络资源。请与这台服务器的管理员联系”的问题&#xff0c;那为什么共享打印机拒绝访问呢&#xff1f;别着急&#xff0c;下面为大家带来相关的解决方法…...

深度学习训练营之数据增强

深度学习训练营学习内容原文链接环境介绍前置工作设置GPU加载数据创建测试集数据类型查看以及数据归一化数据增强操作使用嵌入model的方法进行数据增强模型训练结果可视化自定义数据增强查看数据增强后的图片学习内容 在深度学习当中,由于准备数据集本身是一件十分复杂的过程,…...

Tomcat安装及启动

日升时奋斗&#xff0c;日落时自省 目录 1、Tomcat下载 2、JDK安装及配置环境 3、Tomcat配置环境 4、启动Tomcat 5、部署演示 1、Tomcat下载 直接入主题&#xff0c;下载Tomcat 首先就是别下错了&#xff0c;直接找官方如何看是不是广告&#xff0c;或者造假 搜索Tomc…...

【专项训练】排序算法

排序算法 非比较类的排序,基本上就是放在一个数组里面,统计每个数出现的次序 最重要的排序是比较类排序! O(nlogn)的3个排序,必须要会!即:堆排序、快速排序、归并排序! 快速排序:分治 经典快排 def quickSort1(arr...

Android压测测试事件行为参数对照表

执行参数参数说明颗粒度指标基础参数--throttle <ms> 用于指定用户操作间的时延。 -s 随机数种子&#xff0c;用于指定伪随机数生成器的seed值&#xff0c;如果seed值相同&#xff0c;则产生的时间序列也相同。多用于重测、复现问题。 -v 指定输出日志的级别&#xff0c;…...

【观察】亚信科技:“飞轮效应”背后的数智化创新“延长线”

著名管理学家吉姆柯林斯在《从优秀到卓越》一书中提出“飞轮效应”&#xff0c;它指的是为了使静止的飞轮转动起来&#xff0c;一开始必须使很大的力气&#xff0c;每转一圈都很费力&#xff0c;但达到某一临界点后&#xff0c;飞轮的重力和冲力就会成为推动力的一部分&#xf…...

QT编程从入门到精通之十四:“第五章:Qt GUI应用程序设计”之“5.1 UI文件设计与运行机制”之“5.1.1 项目文件组成”

目录 第五章:Qt GUI应用程序设计 5.1 UI文件设计与运行机制 5.1.1 项目文件组成 第五章:Qt GUI应用程序设计...

(二分)730. 机器人跳跃问题

目录 题目链接 一些话 切入点 流程 套路 ac代码 题目链接 AcWing 730. 机器人跳跃问题 - AcWing 一些话 // 向上取整 mid的表示要写成l r 1 >> 1即可&#xff0c;向下取整 mid l r >> 1 // 这里我用了浮点二分&#xff0c;mid (l r) / 2&#xff0c;最…...

vue3使用nextTick

发现nextTick必须放在修改一个响应式数据之后&#xff0c;才会在onUpdated之后被调用&#xff0c;如果nextTick是放在所有对响应式数据修改之前&#xff0c;则nextTick里面的回调函数会在onBeforeUpdate方法执行前就被调用了。可是nextTick必须等到onUpdated执行完成之后执行&a…...

传统图像处理之颜色特征

博主简介 博主是一名大二学生&#xff0c;主攻人工智能研究。感谢让我们在CSDN相遇&#xff0c;博主致力于在这里分享关于人工智能&#xff0c;c&#xff0c;Python&#xff0c;爬虫等方面知识的分享。 如果有需要的小伙伴可以关注博主&#xff0c;博主会继续更新的&#xff0c…...

GPS问题调试—MobileLog中有关GPS关键LOG的释义

GPS问题调试—MobileLog中有关GPS关键LOG的释义 [DESCRIPTION] 在mobile log中,有很多GPS相关的log出现在main log和kernel log、properties文件中,他们的意思是什么,通过这篇文档进行总结,以便在处理GPS 问题时,能够根据这些log快速的收敛问题。 [SOLUTION] 特别先提醒…...

【企业管理】你真的理解向下管理吗?

导读&#xff1a;拜读陈老师一篇文章《不会向下负责&#xff0c;你凭什么做管理者&#xff1f;》&#xff0c;引发不少共鸣&#xff0c;“很多管理者有一种错误的观念&#xff0c;认为管理是向下管理&#xff0c;向上负责。其实应该反过来&#xff0c;是向上管理&#xff0c;向…...

Centos7 硬盘挂载流程

1、添加硬盘到Linux&#xff0c;添加后重启系统2、查看添加的硬盘&#xff0c;lsblksdb 8:16020G 0disk3、分区fdisk /dev/sdbmnw其余默认&#xff0c;直接回车再次查看分区情况&#xff0c;lsblksdb1 8:17 0 20G 0 part4、格式化mkfs -t ext4 /dev/sdb15、挂载mkdir /home/new…...

认识vite_vue3 初始化项目到打包

从0到1创建vite_vue3的项目背景效果vite介绍&#xff08;对比和vuecli的区别&#xff09;使用npm创建vitevitevuie3创建安装antdesignvite自动按需引入&#xff08;vite亮点&#xff09;请求代理proxy打包背景 vue2在使用过程中对象的响应式不好用新增属性的使用$set才能实现效…...

【Go】cron时间格式

【Go】cron时间格式 Minutes&#xff1a;分钟&#xff0c;取值范围[0-59]&#xff0c;支持特殊字符* / , -&#xff1b;Hours&#xff1a;小时&#xff0c;取值范围[0-23]&#xff0c;支持特殊字符* / , -&#xff1b;Day of month&#xff1a;每月的第几天&#xff0c;取值范…...