宁波网络公司做网站/营销手段和营销方式
1 文本格式
using System;
using System.Text;
namespace Legalsoft.Truffer
{
public static partial class Globals
{
//const int FLT_RADIX = 2;
//const int DBL_MANT_DIG = 53;
//const int INT_DIGITS = 32;
//const float FLT_EPSILON = 1.19209290E-07F;
//const double DBL_EPSILON = 2.2204460492503131E-16;
public static double SQR(double a)
{
return a * a;
}
/// <summary>
/// 浮点数取余数的函数
/// https://blog.csdn.net/Hanford/article/details/53633937
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
public static double fmod(double x, double y)
{
y = Math.Abs(y);
if (x >= 0.0)
{
y = x - y * Math.Floor(x / y);
}
else
{
y = x - y * Math.Ceiling(x / y);
}
return y;
}
public static double SIGN(double a, double b)
{
return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a);
}
public static void SWAP(ref int a, ref int b)
{
(a, b) = (b, a);
}
public static void SWAP(ref double a, ref double b)
{
(a, b) = (b, a);
}
/// <summary>
/// 数组复制(int)
/// </summary>
/// <param name="b"></param>
/// <returns></returns>
public static int[] CopyFrom(int[] b)
{
int[] v = new int[b.Length];
for (int i = 0; i < v.Length; i++)
{
v[i] = b[i];
}
return v;
}
/// <summary>
/// 数组复制(double)
/// </summary>
/// <param name="b"></param>
/// <returns></returns>
public static double[] CopyFrom(double[] b)
{
double[] v = new double[b.Length];
for (int i = 0; i < v.Length; i++)
{
v[i] = b[i];
}
return v;
}
/// <summary>
/// 数组转(方)矩阵(int)
/// </summary>
/// <param name="b"></param>
/// <returns></returns>
public static double[,] CopyFrom(int row, int col, double[] b)
{
double[,] v = new double[row, col];
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
v[i, j] = b[i * col + j];
}
}
return v;
}
/// <summary>
/// 矩阵复制(double)
/// </summary>
/// <param name="b"></param>
/// <returns></returns>
public static double[,] CopyFrom(double[,] b)
{
int nn = b.GetLength(0);
int mm = b.GetLength(1);
double[,] v = new double[nn, mm];
for (int i = 0; i < nn; i++)
{
for (int j = 0; j < mm; j++)
{
v[i, j] = b[i, j];
}
}
return v;
}
/// <summary>
/// 复制矩阵b的第k行
/// </summary>
/// <param name="k"></param>
/// <param name="b"></param>
/// <returns>数组</returns>
public static double[] CopyFrom(int k, double[,] b)
{
int mm = b.GetLength(1);
double[] v = new double[mm];
for (int j = 0; j < mm; j++)
{
v[j] = b[k, j];
}
return v;
}
/// <summary>
/// 提取三元矩阵的第k层的矩阵
/// </summary>
/// <param name="k"></param>
/// <param name="b"></param>
/// <returns>矩阵</returns>
public static double[,] CopyFrom(int k, double[,,] b)
{
int nn = b.GetLength(1);
int mm = b.GetLength(2);
double[,] v = new double[nn, mm];
for (int i = 0; i < nn; i++)
{
for (int j = 0; j < mm; j++)
{
v[i, j] = b[k, i, j];
}
}
return v;
}
public static double dist(double[] p1, double[] p2)
{
double sum = 0.0;
for (int i = 0; i < p1.Length; i++)
{
sum += Globals.SQR(p1[i] - p2[i]);
}
if (sum <= float.Epsilon)
{
return 0.0;
}
return Math.Sqrt(sum);
}
public static double ldexp(double v, int exp)
{
return v * Math.Pow(2.0, exp);
}
public static double frexp(double x, out int exp)
{
if (Math.Abs(x) <= float.Epsilon)
{
exp = 0;
return 0.0;
}
long bits = BitConverter.DoubleToInt64Bits(x);
ulong u1 = 0x800fffffffffffffL;
ulong u2 = (ulong)bits;
long r = (long)(u1 & u2);
double d = BitConverter.Int64BitsToDouble(r | 0x3fe0000000000000L);
exp = (int)((0x7ff0000000000000L & bits) >> 52) - 1022;
return d;
}
public static double gammln(double xx)
{
double[] cof = { 57.1562356658629235, -59.5979603554754912, 14.1360979747417471, -0.491913816097620199, .339946499848118887e-4, .465236289270485756e-4, -.983744753048795646e-4, .158088703224912494e-3, -.210264441724104883e-3, .217439618115212643e-3, -.164318106536763890e-3, .844182239838527433e-4, -.261908384015814087e-4, .368991826595316234e-5 };
if (xx <= 0)
{
throw new Exception("bad arg in gammln");
}
double x = xx;
double y = xx;
double tmp = x + 5.24218750000000000;
tmp = (x + 0.5) * Math.Log(tmp) - tmp;
double ser = 0.999999999999997092;
for (int j = 0; j < 14; j++)
{
ser += cof[j] / ++y;
}
return tmp + Math.Log(2.5066282746310005 * ser / x);
}
private static double[] factrl_a;
private static bool factrl_init = true;
public static double factrl(int n)
{
if (factrl_init)
{
factrl_init = false;
factrl_a = new double[171];
factrl_a[0] = 1.0;
for (int i = 1; i < 171; i++)
{
factrl_a[i] = i * factrl_a[i - 1];
}
}
if (n < 0 || n > 170)
{
throw new Exception("factrl out of range");
}
return factrl_a[n];
}
private static double[] factln_a = new double[2000];
private static bool factln_init = true;
public static double factln(int n)
{
const int NTOP = 2000;
if (factln_init)
{
factln_init = false;
for (int i = 0; i < NTOP; i++)
{
factln_a[i] = gammln(i + 1.0);
}
}
if (n < 0)
{
throw new Exception("negative arg in factln");
}
if (n < NTOP)
{
return factln_a[n];
}
return gammln(n + 1.0);
}
public static double bico(int n, int k)
{
if (n < 0 || k < 0 || k > n)
{
throw new Exception("bad args in bico");
}
if (n < 171)
{
return Math.Floor(0.5 + factrl(n) / (factrl(k) * factrl(n - k)));
}
return Math.Floor(0.5 + Math.Exp(factln(n) - factln(k) - factln(n - k)));
}
public static double beta(double z, double w)
{
return Math.Exp(gammln(z) + gammln(w) - gammln(z + w));
}
public static string ToString(double[] x)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < x.Length; i++)
{
sb.AppendFormat("{0:F12},", x[i]);
}
sb.AppendLine("<br>");
return sb.ToString();
}
public static string ToString(double[,] x)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("<style>td { padding:5px; } </style>");
sb.AppendLine("<table border=1 bordercolor='#888888' style='border-collapse:collapse;'>");
for (int i = 0; i < x.GetLength(0); i++)
{
sb.AppendLine("<tr>");
for (int j = 0; j < x.GetLength(1); j++)
{
sb.AppendFormat("<td>{0:F12}</td>", x[i, j]);
}
sb.AppendLine("</tr>");
}
sb.AppendLine("</table>");
sb.AppendLine("<br>");
return sb.ToString();
}
}
}
2 代码格式
using System;
using System.Text;namespace Legalsoft.Truffer
{public static partial class Globals{//const int FLT_RADIX = 2;//const int DBL_MANT_DIG = 53;//const int INT_DIGITS = 32;//const float FLT_EPSILON = 1.19209290E-07F;//const double DBL_EPSILON = 2.2204460492503131E-16;public static double SQR(double a){return a * a;}/// <summary>/// 浮点数取余数的函数/// https://blog.csdn.net/Hanford/article/details/53633937/// </summary>/// <param name="x"></param>/// <param name="y"></param>/// <returns></returns>public static double fmod(double x, double y){y = Math.Abs(y);if (x >= 0.0){y = x - y * Math.Floor(x / y);}else{y = x - y * Math.Ceiling(x / y);}return y;}public static double SIGN(double a, double b){return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a);}public static void SWAP(ref int a, ref int b){(a, b) = (b, a);}public static void SWAP(ref double a, ref double b){(a, b) = (b, a);}/// <summary>/// 数组复制(int)/// </summary>/// <param name="b"></param>/// <returns></returns>public static int[] CopyFrom(int[] b){int[] v = new int[b.Length];for (int i = 0; i < v.Length; i++){v[i] = b[i];}return v;}/// <summary>/// 数组复制(double)/// </summary>/// <param name="b"></param>/// <returns></returns>public static double[] CopyFrom(double[] b){double[] v = new double[b.Length];for (int i = 0; i < v.Length; i++){v[i] = b[i];}return v;}/// <summary>/// 数组转(方)矩阵(int)/// </summary>/// <param name="b"></param>/// <returns></returns>public static double[,] CopyFrom(int row, int col, double[] b){double[,] v = new double[row, col];for (int i = 0; i < row; i++){for (int j = 0; j < col; j++){v[i, j] = b[i * col + j];}}return v;}/// <summary>/// 矩阵复制(double)/// </summary>/// <param name="b"></param>/// <returns></returns>public static double[,] CopyFrom(double[,] b){int nn = b.GetLength(0);int mm = b.GetLength(1);double[,] v = new double[nn, mm];for (int i = 0; i < nn; i++){for (int j = 0; j < mm; j++){v[i, j] = b[i, j];}}return v;}/// <summary>/// 复制矩阵b的第k行/// </summary>/// <param name="k"></param>/// <param name="b"></param>/// <returns>数组</returns>public static double[] CopyFrom(int k, double[,] b){int mm = b.GetLength(1);double[] v = new double[mm];for (int j = 0; j < mm; j++){v[j] = b[k, j];}return v;}/// <summary>/// 提取三元矩阵的第k层的矩阵/// </summary>/// <param name="k"></param>/// <param name="b"></param>/// <returns>矩阵</returns>public static double[,] CopyFrom(int k, double[,,] b){int nn = b.GetLength(1);int mm = b.GetLength(2);double[,] v = new double[nn, mm];for (int i = 0; i < nn; i++){for (int j = 0; j < mm; j++){v[i, j] = b[k, i, j];}}return v;}public static double dist(double[] p1, double[] p2){double sum = 0.0;for (int i = 0; i < p1.Length; i++){sum += Globals.SQR(p1[i] - p2[i]);}if (sum <= float.Epsilon){return 0.0;}return Math.Sqrt(sum);}public static double ldexp(double v, int exp){return v * Math.Pow(2.0, exp);}public static double frexp(double x, out int exp){if (Math.Abs(x) <= float.Epsilon){exp = 0;return 0.0;}long bits = BitConverter.DoubleToInt64Bits(x);ulong u1 = 0x800fffffffffffffL;ulong u2 = (ulong)bits;long r = (long)(u1 & u2);double d = BitConverter.Int64BitsToDouble(r | 0x3fe0000000000000L);exp = (int)((0x7ff0000000000000L & bits) >> 52) - 1022;return d;}public static double gammln(double xx){double[] cof = { 57.1562356658629235, -59.5979603554754912, 14.1360979747417471, -0.491913816097620199, .339946499848118887e-4, .465236289270485756e-4, -.983744753048795646e-4, .158088703224912494e-3, -.210264441724104883e-3, .217439618115212643e-3, -.164318106536763890e-3, .844182239838527433e-4, -.261908384015814087e-4, .368991826595316234e-5 };if (xx <= 0){throw new Exception("bad arg in gammln");}double x = xx;double y = xx;double tmp = x + 5.24218750000000000;tmp = (x + 0.5) * Math.Log(tmp) - tmp;double ser = 0.999999999999997092;for (int j = 0; j < 14; j++){ser += cof[j] / ++y;}return tmp + Math.Log(2.5066282746310005 * ser / x);}private static double[] factrl_a;private static bool factrl_init = true;public static double factrl(int n){if (factrl_init){factrl_init = false;factrl_a = new double[171];factrl_a[0] = 1.0;for (int i = 1; i < 171; i++){factrl_a[i] = i * factrl_a[i - 1];}}if (n < 0 || n > 170){throw new Exception("factrl out of range");}return factrl_a[n];}private static double[] factln_a = new double[2000];private static bool factln_init = true;public static double factln(int n){const int NTOP = 2000;if (factln_init){factln_init = false;for (int i = 0; i < NTOP; i++){factln_a[i] = gammln(i + 1.0);}}if (n < 0){throw new Exception("negative arg in factln");}if (n < NTOP){return factln_a[n];}return gammln(n + 1.0);}public static double bico(int n, int k){if (n < 0 || k < 0 || k > n){throw new Exception("bad args in bico");}if (n < 171){return Math.Floor(0.5 + factrl(n) / (factrl(k) * factrl(n - k)));}return Math.Floor(0.5 + Math.Exp(factln(n) - factln(k) - factln(n - k)));}public static double beta(double z, double w){return Math.Exp(gammln(z) + gammln(w) - gammln(z + w));}public static string ToString(double[] x){StringBuilder sb = new StringBuilder();for (int i = 0; i < x.Length; i++){sb.AppendFormat("{0:F12},", x[i]);}sb.AppendLine("<br>");return sb.ToString();}public static string ToString(double[,] x){StringBuilder sb = new StringBuilder();sb.AppendLine("<style>td { padding:5px; } </style>"); sb.AppendLine("<table border=1 bordercolor='#888888' style='border-collapse:collapse;'>");for (int i = 0; i < x.GetLength(0); i++){sb.AppendLine("<tr>");for (int j = 0; j < x.GetLength(1); j++){sb.AppendFormat("<td>{0:F12}</td>", x[i, j]);}sb.AppendLine("</tr>");}sb.AppendLine("</table>");sb.AppendLine("<br>");return sb.ToString();}}
}
相关文章:

C#,数值计算——Globals的计算方法与源程序
1 文本格式 using System; using System.Text; namespace Legalsoft.Truffer { public static partial class Globals { //const int FLT_RADIX 2; //const int DBL_MANT_DIG 53; //const int INT_DIGITS 32; //const float FLT_…...

腾讯云香港服务器轻量24元一个月性能测试
腾讯云香港轻量应用服务器优惠价格24元一个月,一年288元,以前是30M峰值带宽,现在是20M峰值带宽,阿腾云atengyun.com分享腾讯云香港轻量应用服务器性能测评,包括香港轻量服务器配置价格表、CPU性能和CN2网络延迟测试&am…...

深度学习之基于YoloV8的行人跌倒目标检测系统
欢迎大家点赞、收藏、关注、评论啦 ,由于篇幅有限,只展示了部分核心代码。 文章目录 一项目简介 二、功能三、行人跌倒目标检测系统四. 总结 一项目简介 世界老龄化趋势日益严重,现代化的生活习惯又使得大多数老人独居,统计数据表…...

Seata入门系列【16】XA模式入门案例
1 前言 在之前,我们试过了AT、TCC 模式,Seata 还支持XA 模式。 2 XA 协议 XA协议由Tuxedo首先提出的,并交给X/Open组织,作为资源管理器(数据库)与事务管理器的接口标准。Oracle、Informix、DB2和Sybase等…...

高级深入--day44
Scrapy 和 scrapy-redis的区别 Scrapy 是一个通用的爬虫框架,但是不支持分布式,Scrapy-redis是为了更方便地实现Scrapy分布式爬取,而提供了一些以redis为基础的组件(仅有组件)。 pip install scrapy-redis Scrapy-redis提供了下面四种组件&a…...

Apache Doris (四十八): Doris表结构变更-替换表
🏡 个人主页:IT贫道_大数据OLAP体系技术栈,Apache Doris,Clickhouse 技术-CSDN博客 🚩 私聊博主:加入大数据技术讨论群聊,获取更多大数据资料。 🔔 博主个人B栈地址:豹哥教你大数据的个人空间-豹哥教你大数据个人主页-哔哩哔哩视频 目录...

消息认证码--数字签名--证书
6. 消息认证码—>保证数据的完整性 "消息认证码 --- 消息被正确传送了吗?"6.1 什么是消息认证码 Alice 和 Bob 的故事 像以前一样,我们还是从一个Alice和Bob的故事开始讲起。不过,这一次Alice和Bob分别是两家银行,Alice银行通…...

四个制作PPT的小技巧
制作PPT已经很麻烦了,学习一些小技巧可以帮助我们省时省力吧! 技巧一:自动更新日期和时间 当我们给幻灯片添加了页脚并且是时间日期,可以通过设置达到自动更新,这样我们就不需要每次修改的时候都要手动更新日期和时间…...

Echarts饼状图grid设置
饼状图不能设置grid,而是center {type: "pie",radius: ["30%", "70%"],center: ["50%", "25%"], }center 圆心:控制圆的位置 radius 饼图的半径 控制显示尺寸 参考文章 Echarts饼状图设置...

系列三、Spring IOC
一、概述 IOC的中文意思是控制反转,通俗地讲就是把创建对象的控制权交给了Spring去管理,以前是由程序员自己去创建控制对象,现在交由Spring去创建控制。 二、优点 集中管理对象,方便维护,降低耦合度。 三、IOC的底层…...

electron汇总
python3自带了pip pip search已经被禁用,安装pip—— pip install pip-searchpython3.x移除了distutils 管理员权限下运行cmd,运行以下命令 // 修改pip镜像地址 pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ // 安装 Set…...

电脑怎么共享屏幕?电脑屏幕共享软件分享!
如何控制某人的电脑屏幕? 有时我们可能需要远程控制某人的计算机屏幕,例如,为我们的客户提供远程支持,远程帮助朋友或家人解决计算机问题,或在家中与同事完成团队合作。那么,电脑怎么共享屏幕ÿ…...

全新一代数字内容体验云平台
随着AIGC能力的提升,企业接入AIGC后将实现数字内容生产的无限供给,如何管理AIGC数字内容将成为话题。 “Baklib是新⼀代企业数字内容体验云平台,包括数字资产及知识库管理、数字应用构建和客户体验,助力企业数字化体验从 IA 扩展…...

目标检测理论知识
目标检测 1.基本概念 目标检测(Object Detection)的任务是找出图像中所有感兴趣的目标(物体),确定它们的类别和位置,是计算机视觉领域的核心问题之一。由于各类物体有不同的外观、形状和姿态,…...

聚观早报 |蔚来推出婚车服务;长城汽车第三季度财报
【聚观365】10月30日消息 蔚来推出婚车服务 长城汽车第三季度财报 AI汽车机器人极越01上市 谷歌投资初创公司Anthropic 东方财富第三季度营收 蔚来推出婚车服务 据蔚来汽车官方消息,蔚来宣布推出“蔚来用户专享”的婚庆用车定制服务。 据悉,该服务…...

垃圾收费站
使用form-data传递数组和x-www-form-urlencoded传递的区别 项目场景: 我将后端接口的一个接收参数设计成了数组,然后前端使用form-data去传递 问题描述 访问的时候出现了问题,后端接收到的数组多出了一层中括号,也就是被两层中括号…...

ElasticSearch 统计搜索热词
实际开发中,我们会统计某个模块下的搜索热词,这个在elasticsearch中特别好用,也比较简单, 使用可以使用 "terms aggregation" 来统计热词 terms 是代表的elasticSerach中的Term Query,统计的就是Term Query, Term Query是一种最基本的查询方式,它用于在Ela…...

el-table(vue2中)滚动条被固定列盖住
一、项目场景: vue2 el-table 二、问题描述 1、现场图片: 2、全局css环境配置了滚动条高度为6px /* 全局滚动条配置 */ ::-webkit-scrollbar {width: 6px;height: 6px; }::-webkit-scrollbar-track {background-color: #f1f1f1; }::-webkit-scrollbar-…...

两数之和(C++解法)
题目 给你两个 非空 的链表,表示两个非负的整数。它们每位数字都是按照 逆序 的方式存储的,并且每个节点只能存储 一位 数字。 请你将两个数相加,并以相同形式返回一个表示和的链表。 你可以假设除了数字 0 之外,这两个数都不会…...
SCNet:自校正卷积网络(附代码)
论文地址:https://mftp.mmcheng.net/Papers/20cvprSCNet.pdf 代码地址:https://github.com/MCG-NKU/SCNet 1.是什么? SCNet是一种卷积神经网络,它使用自校准卷积(Self-Calibrated Convolutions)来增强子…...

【PG】PostgreSQL客户端认证pg_hba.conf文件
目录 文件格式 连接类型(TYPE) 数据库(database) 用户(user) 连接地址(address) 格式 IPv4 IPv6 字符 主机名 主机名后缀 IP-address/IP-mask auth-method trust reject scram-sha-256 md5 password gss sspi …...

信创优选,国产开源。Solon v2.5.11 发布
Solon 是什么框架? Java 生态级应用开发框架。从零开始构建,有自己的标准规范与开放生态(历时五年,具备全球第二级别的生态规模)。与其他框架相比,解决了两个重要的痛点:启动慢,费内…...

180.188.16.1网站高并发,导致网站卡了,有什么方案处理?
处理网站高并发需要考虑多方面的因素,以下是一些解决方法: 增加服务器硬件:增加服务器内存、CPU、带宽等硬件资源,以提高服务器的处理能力,从而增强网站处理请求的能力。 使用CDN:将网站的静态资源&#x…...

P1077 [NOIP2012 普及组] 摆花 题解
文章目录 题目描述输入格式输出格式样例样例输入样例输出 数据范围与提示思路与部分实现完整代码 题目描述 小明的花店新开张,为了吸引顾客,他想在花店的门口摆上一排花,共 m m m 盆。通过调查顾客的喜好,小明列出了顾客最喜欢的…...

kubernetes源码阅读与实战(3)
kubernetes源码二次开发系列 1、k8s二次开发之kubernetes开发概念 2、k8s二次开发之自定义的example展示 3、k8s二次开发之如何扩展kubernetes系统 4、k8s二次开发之kubernetes控制器的控制循环 5、k8s二次开发之kubernetes控制器的watch事件及event对象 6、k8s二次开发之…...

ESP8266模块常规调试过程讲解
ESP8266-WIFI模块串口调试过程讲解 一、ESP8266介绍 ESP8266是一个高度集成的无线SoC(System on a Chip)模块,基于ESP8266芯片,集成了Wi-Fi功能。具有丰富的特性和功能,广泛应用于各种物联网项目中。 ESP8266模块支持802.11b/g/n无线标准,内置TCP/IP协议栈,可以实现串…...

使用onnxruntime推理Bert模型
Bert模型类别:onnx 输入输出数据格式:.npz import onnxruntime import numpy as np import os# 加载 ONNX 模型 ort_session onnxruntime.InferenceSession(bert-base-uncased_final.onnx)# 指定输入文件夹和输出文件夹 input_folder output_folder …...

SQL group by、where和having语句用法
SQL 语句中的 GROUP BY 子句用于将具有相同值的行分组在一起,通常与聚合函数(如 COUNT、SUM、AVG 等)一起使用。WHERE 子句用于筛选符合条件的行。HAVING 子句则在分组后对分组结果进行进一步筛选。 以下是一个使用 SQL 语句中的 GROUP BY、W…...

贝叶斯变分方法:初学者指南--平均场近似
Eric Jang: A Beginners Guide to Variational Methods: Mean-Field Approximation (evjang.com) 一、说明 变分贝叶斯 (VB) 方法是统计机器学习中非常流行的一系列技术。VB 方法允许我们将 统计推断 问题(即,给定另一个随机变量的值来推断随机变量的值&…...

Node学习笔记之user用户API模块
1、获取用户的基本信息 步骤 获取登录会话存储的session中用户的id判断是否获取到id根据用户id查询数据库中的个人信息检查指定 id 的用户是否存在将密码设置为空将数据返回给前端 // 获取用户信息数据 exports.userinfo (req, res) > {(async function () {// 1. 获取…...