当前位置: 首页 > 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…...

Python|GIF 解析与构建(5):手搓截屏和帧率控制

目录 Python&#xff5c;GIF 解析与构建&#xff08;5&#xff09;&#xff1a;手搓截屏和帧率控制 一、引言 二、技术实现&#xff1a;手搓截屏模块 2.1 核心原理 2.2 代码解析&#xff1a;ScreenshotData类 2.2.1 截图函数&#xff1a;capture_screen 三、技术实现&…...

零门槛NAS搭建:WinNAS如何让普通电脑秒变私有云?

一、核心优势&#xff1a;专为Windows用户设计的极简NAS WinNAS由深圳耘想存储科技开发&#xff0c;是一款收费低廉但功能全面的Windows NAS工具&#xff0c;主打“无学习成本部署” 。与其他NAS软件相比&#xff0c;其优势在于&#xff1a; 无需硬件改造&#xff1a;将任意W…...

Appium+python自动化(十六)- ADB命令

简介 Android 调试桥(adb)是多种用途的工具&#xff0c;该工具可以帮助你你管理设备或模拟器 的状态。 adb ( Android Debug Bridge)是一个通用命令行工具&#xff0c;其允许您与模拟器实例或连接的 Android 设备进行通信。它可为各种设备操作提供便利&#xff0c;如安装和调试…...

【Oracle】分区表

个人主页&#xff1a;Guiat 归属专栏&#xff1a;Oracle 文章目录 1. 分区表基础概述1.1 分区表的概念与优势1.2 分区类型概览1.3 分区表的工作原理 2. 范围分区 (RANGE Partitioning)2.1 基础范围分区2.1.1 按日期范围分区2.1.2 按数值范围分区 2.2 间隔分区 (INTERVAL Partit…...

AI,如何重构理解、匹配与决策?

AI 时代&#xff0c;我们如何理解消费&#xff1f; 作者&#xff5c;王彬 封面&#xff5c;Unplash 人们通过信息理解世界。 曾几何时&#xff0c;PC 与移动互联网重塑了人们的购物路径&#xff1a;信息变得唾手可得&#xff0c;商品决策变得高度依赖内容。 但 AI 时代的来…...

【7色560页】职场可视化逻辑图高级数据分析PPT模版

7种色调职场工作汇报PPT&#xff0c;橙蓝、黑红、红蓝、蓝橙灰、浅蓝、浅绿、深蓝七种色调模版 【7色560页】职场可视化逻辑图高级数据分析PPT模版&#xff1a;职场可视化逻辑图分析PPT模版https://pan.quark.cn/s/78aeabbd92d1...

return this;返回的是谁

一个审批系统的示例来演示责任链模式的实现。假设公司需要处理不同金额的采购申请&#xff0c;不同级别的经理有不同的审批权限&#xff1a; // 抽象处理者&#xff1a;审批者 abstract class Approver {protected Approver successor; // 下一个处理者// 设置下一个处理者pub…...

【Linux】Linux 系统默认的目录及作用说明

博主介绍&#xff1a;✌全网粉丝23W&#xff0c;CSDN博客专家、Java领域优质创作者&#xff0c;掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域✌ 技术范围&#xff1a;SpringBoot、SpringCloud、Vue、SSM、HTML、Nodejs、Python、MySQL、PostgreSQL、大数据、物…...

MySQL 索引底层结构揭秘:B-Tree 与 B+Tree 的区别与应用

文章目录 一、背景知识&#xff1a;什么是 B-Tree 和 BTree&#xff1f; B-Tree&#xff08;平衡多路查找树&#xff09; BTree&#xff08;B-Tree 的变种&#xff09; 二、结构对比&#xff1a;一张图看懂 三、为什么 MySQL InnoDB 选择 BTree&#xff1f; 1. 范围查询更快 2…...

Spring AI Chat Memory 实战指南:Local 与 JDBC 存储集成

一个面向 Java 开发者的 Sring-Ai 示例工程项目&#xff0c;该项目是一个 Spring AI 快速入门的样例工程项目&#xff0c;旨在通过一些小的案例展示 Spring AI 框架的核心功能和使用方法。 项目采用模块化设计&#xff0c;每个模块都专注于特定的功能领域&#xff0c;便于学习和…...