【数值特性库】入口文件

数值特性库入口文件为lib.rs。该文件定义一系列数字特性的trait(特征),这些特性可以被不同的数字类型实现,从而提供一套通用的数值操作方法。下面是对代码中关键部分的解释:

一、基础设置

  • #![doc(html_root_url = “https://docs.rs/num-traits/0.2”)]:指定了文档的根URL,用于在线文档生成。
  • #![deny(unconditional_recursion)]:禁止无条件递归,这是一种编译时检查,防止无限递归。
  • #![no_std]:表明这个crate不依赖Rust标准库,使其可以在没有标准库的环境(如裸机或嵌入式系统)中使用。

二、条件编译

  • #[cfg(feature = “std”)]:当启用std特性时,编译这部分代码。这通常用于在有无标准库支持时提供不同的实现。

三、引入依赖

  • 引入了Rust核心库中的一些基本功能,如格式化(fmt)、包装类型(Wrapping)、基本的算术操作(Add, Div, Mul, Rem, Sub等)及其赋值操作(AddAssign, DivAssign, MulAssign, RemAssign, SubAssign)。

四、公开的特性

  • 通过pub use语句,公开了库中定义的一系列特性(traits)和常量,使得外部可以直接通过这些路径访问它们。例如,Bounded用于表示有边界的数字类型,Float和FloatConst提供了浮点数的操作和常量,NumCast用于类型转换等。

五、核心trait定义:

  • Num:定义了数值类型的基础特性,包括比较、基本数值操作、字符串转换等。
  • NumOps:为实现了基本算术运算符(+, -, *, /, %)的类型自动实现。
  • NumRef和RefNum:提供了对引用类型数值操作的支持。
  • NumAssignOps:为实现了赋值运算符(如+=, -=)的类型自动实现。

六、宏和模块:

  • 通过#[macro_use]引入了宏定义(在macros模块中),这些宏可能用于简化代码或提供额外的功能。
  • 定义了多个模块(如bounds, cast, float, identities, int, ops, pow, real, sign),每个模块都负责特定的数值操作或特性。

七、总结及源码

整体而言,这段代码定义了一个丰富的数字特性库,为Rust中的数值类型提供了一套通用的接口和操作方法。通过实现这些trait,不同的数值类型可以享受到这些通用操作带来的便利,同时也为开发者提供了一种灵活的方式来处理不同类型的数值。源码如下:

//!为泛型准备的数字特征库 #![doc(html_root_url = "https://docs.rs/num-traits/0.2")]
#![deny(unconditional_recursion)]
#![no_std]// 需要显式地将crate引入固有的float方法。Need to explicitly bring the crate in for inherent float methods
#[cfg(feature = "std")]
extern crate std;use core::fmt;
use core::num::Wrapping;
use core::ops::{Add, Div, Mul, Rem, Sub};
use core::ops::{AddAssign, DivAssign, MulAssign, RemAssign, SubAssign};pub use crate::bounds::Bounded; // 1 边界特性
#[cfg(any(feature = "std", feature = "libm"))]
pub use crate::float::Float; // 2
pub use crate::float::FloatConst; // 3pub use crate::cast::{cast, AsPrimitive, FromPrimitive, NumCast, ToPrimitive}; // 4
pub use crate::identities::{one, zero, ConstOne, ConstZero, One, Zero}; // 5
pub use crate::int::PrimInt; // 6
pub use crate::ops::bytes::{FromBytes, ToBytes}; // 7
pub use crate::ops::checked::{CheckedAdd, CheckedDiv, CheckedMul, CheckedNeg, CheckedRem, CheckedShl, CheckedShr, CheckedSub,
};               // 8
pub use crate::ops::euclid::{CheckedEuclid, Euclid}; // 9
pub use crate::ops::inv::Inv; // 10
pub use crate::ops::mul_add::{MulAdd, MulAddAssign}; // 11
pub use crate::ops::saturating::{Saturating, SaturatingAdd, SaturatingMul, SaturatingSub}; // 12
pub use crate::ops::wrapping::{WrappingAdd, WrappingMul, WrappingNeg, WrappingShl, WrappingShr, WrappingSub,
};                           // 13
pub use crate::pow::{checked_pow, pow, Pow};  // 14
pub use crate::sign::{abs, abs_sub, signum, Signed, Unsigned};  // 15#[macro_use]
mod macros;pub mod bounds;
pub mod cast;
pub mod float;
pub mod identities;
pub mod int;
pub mod ops;
pub mod pow;
pub mod real;
pub mod sign;/// The base trait for numeric types, covering `0` and `1` values,
/// comparisons, basic numeric operations, and string conversion.
pub trait Num: PartialEq + Zero + One + NumOps {type FromStrRadixErr;/// Convert from a string and radix (typically `2..=36`).////// # Examples////// ```rust/// use num_traits::Num;////// let result = <i32 as Num>::from_str_radix("27", 10);/// assert_eq!(result, Ok(27));////// let result = <i32 as Num>::from_str_radix("foo", 10);/// assert!(result.is_err());/// ```////// # Supported radices////// The exact range of supported radices is at the discretion of each type implementation. For/// primitive integers, this is implemented by the inherent `from_str_radix` methods in the/// standard library, which **panic** if the radix is not in the range from 2 to 36. The/// implementation in this crate for primitive floats is similar.////// For third-party types, it is suggested that implementations should follow suit and at least/// accept `2..=36` without panicking, but an `Err` may be returned for any unsupported radix./// It's possible that a type might not even support the common radix 10, nor any, if string/// parsing doesn't make sense for that type.fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>;
}/// Generic trait for types implementing basic numeric operations
///
/// This is automatically implemented for types which implement the operators.
pub trait NumOps<Rhs = Self, Output = Self>:Add<Rhs, Output = Output>+ Sub<Rhs, Output = Output>+ Mul<Rhs, Output = Output>+ Div<Rhs, Output = Output>+ Rem<Rhs, Output = Output>
{
}impl<T, Rhs, Output> NumOps<Rhs, Output> for T whereT: Add<Rhs, Output = Output>+ Sub<Rhs, Output = Output>+ Mul<Rhs, Output = Output>+ Div<Rhs, Output = Output>+ Rem<Rhs, Output = Output>
{
}/// The trait for `Num` types which also implement numeric operations taking
/// the second operand by reference.
///
/// This is automatically implemented for types which implement the operators.
pub trait NumRef: Num + for<'r> NumOps<&'r Self> {}
impl<T> NumRef for T where T: Num + for<'r> NumOps<&'r T> {}/// The trait for `Num` references which implement numeric operations, taking the
/// second operand either by value or by reference.
///
/// This is automatically implemented for all types which implement the operators. It covers
/// every type implementing the operations though, regardless of it being a reference or
/// related to `Num`.
pub trait RefNum<Base>: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base> {}
impl<T, Base> RefNum<Base> for T where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base> {}/// Generic trait for types implementing numeric assignment operators (like `+=`).
///
/// This is automatically implemented for types which implement the operators.
pub trait NumAssignOps<Rhs = Self>:AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>
{
}impl<T, Rhs> NumAssignOps<Rhs> for T whereT: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>
{
}/// The trait for `Num` types which also implement assignment operators.
///
/// This is automatically implemented for types which implement the operators.
pub trait NumAssign: Num + NumAssignOps {}
impl<T> NumAssign for T where T: Num + NumAssignOps {}/// The trait for `NumAssign` types which also implement assignment operations
/// taking the second operand by reference.
///
/// This is automatically implemented for types which implement the operators.
pub trait NumAssignRef: NumAssign + for<'r> NumAssignOps<&'r Self> {}
impl<T> NumAssignRef for T where T: NumAssign + for<'r> NumAssignOps<&'r T> {}macro_rules! int_trait_impl {($name:ident for $($t:ty)*) => ($(impl $name for $t {type FromStrRadixErr = ::core::num::ParseIntError;#[inline]fn from_str_radix(s: &str, radix: u32)-> Result<Self, ::core::num::ParseIntError>{<$t>::from_str_radix(s, radix)}})*)
}
int_trait_impl!(Num for usize u8 u16 u32 u64 u128);
int_trait_impl!(Num for isize i8 i16 i32 i64 i128);impl<T: Num> Num for Wrapping<T>
whereWrapping<T>: NumOps,
{type FromStrRadixErr = T::FromStrRadixErr;fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr> {T::from_str_radix(str, radix).map(Wrapping)}
}#[derive(Debug)]
pub enum FloatErrorKind {Empty,Invalid,
}
// FIXME: core::num::ParseFloatError is stable in 1.0, but opaque to us,
// so there's not really any way for us to reuse it.
#[derive(Debug)]
pub struct ParseFloatError {pub kind: FloatErrorKind,
}impl fmt::Display for ParseFloatError {fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {let description = match self.kind {FloatErrorKind::Empty => "cannot parse float from empty string",FloatErrorKind::Invalid => "invalid float literal",};description.fmt(f)}
}fn str_to_ascii_lower_eq_str(a: &str, b: &str) -> bool {a.len() == b.len()&& a.bytes().zip(b.bytes()).all(|(a, b)| {let a_to_ascii_lower = a | (((b'A' <= a && a <= b'Z') as u8) << 5);a_to_ascii_lower == b})
}// FIXME: The standard library from_str_radix on floats was deprecated, so we're stuck
// with this implementation ourselves until we want to make a breaking change.
// (would have to drop it from `Num` though)
macro_rules! float_trait_impl {($name:ident for $($t:ident)*) => ($(impl $name for $t {type FromStrRadixErr = ParseFloatError;fn from_str_radix(src: &str, radix: u32)-> Result<Self, Self::FromStrRadixErr>{use self::FloatErrorKind::*;use self::ParseFloatError as PFE;// Special case radix 10 to use more accurate standard library implementationif radix == 10 {return src.parse().map_err(|_| PFE {kind: if src.is_empty() { Empty } else { Invalid },});}// Special valuesif str_to_ascii_lower_eq_str(src, "inf")|| str_to_ascii_lower_eq_str(src, "infinity"){return Ok(core::$t::INFINITY);} else if str_to_ascii_lower_eq_str(src, "-inf")|| str_to_ascii_lower_eq_str(src, "-infinity"){return Ok(core::$t::NEG_INFINITY);} else if str_to_ascii_lower_eq_str(src, "nan") {return Ok(core::$t::NAN);} else if str_to_ascii_lower_eq_str(src, "-nan") {return Ok(-core::$t::NAN);}fn slice_shift_char(src: &str) -> Option<(char, &str)> {let mut chars = src.chars();Some((chars.next()?, chars.as_str()))}let (is_positive, src) =  match slice_shift_char(src) {None             => return Err(PFE { kind: Empty }),Some(('-', ""))  => return Err(PFE { kind: Empty }),Some(('-', src)) => (false, src),Some((_, _))     => (true,  src),};// The significand to accumulatelet mut sig = if is_positive { 0.0 } else { -0.0 };// Necessary to detect overflowlet mut prev_sig = sig;let mut cs = src.chars().enumerate();// Exponent prefix and exponent index offsetlet mut exp_info = None::<(char, usize)>;// Parse the integer part of the significandfor (i, c) in cs.by_ref() {match c.to_digit(radix) {Some(digit) => {// shift significand one digit leftsig *= radix as $t;// add/subtract current digit depending on signif is_positive {sig += (digit as isize) as $t;} else {sig -= (digit as isize) as $t;}// Detect overflow by comparing to last value, except// if we've not seen any non-zero digits.if prev_sig != 0.0 {if is_positive && sig <= prev_sig{ return Ok(core::$t::INFINITY); }if !is_positive && sig >= prev_sig{ return Ok(core::$t::NEG_INFINITY); }// Detect overflow by reversing the shift-and-add processif is_positive && (prev_sig != (sig - digit as $t) / radix as $t){ return Ok(core::$t::INFINITY); }if !is_positive && (prev_sig != (sig + digit as $t) / radix as $t){ return Ok(core::$t::NEG_INFINITY); }}prev_sig = sig;},None => match c {'e' | 'E' | 'p' | 'P' => {exp_info = Some((c, i + 1));break;  // start of exponent},'.' => {break;  // start of fractional part},_ => {return Err(PFE { kind: Invalid });},},}}// If we are not yet at the exponent parse the fractional// part of the significandif exp_info.is_none() {let mut power = 1.0;for (i, c) in cs.by_ref() {match c.to_digit(radix) {Some(digit) => {// Decrease power one order of magnitudepower /= radix as $t;// add/subtract current digit depending on signsig = if is_positive {sig + (digit as $t) * power} else {sig - (digit as $t) * power};// Detect overflow by comparing to last valueif is_positive && sig < prev_sig{ return Ok(core::$t::INFINITY); }if !is_positive && sig > prev_sig{ return Ok(core::$t::NEG_INFINITY); }prev_sig = sig;},None => match c {'e' | 'E' | 'p' | 'P' => {exp_info = Some((c, i + 1));break; // start of exponent},_ => {return Err(PFE { kind: Invalid });},},}}}// Parse and calculate the exponentlet exp = match exp_info {Some((c, offset)) => {let base = match c {'E' | 'e' if radix == 10 => 10.0,'P' | 'p' if radix == 16 => 2.0,_ => return Err(PFE { kind: Invalid }),};// Parse the exponent as decimal integerlet src = &src[offset..];let (is_positive, exp) = match slice_shift_char(src) {Some(('-', src)) => (false, src.parse::<usize>()),Some(('+', src)) => (true,  src.parse::<usize>()),Some((_, _))     => (true,  src.parse::<usize>()),None             => return Err(PFE { kind: Invalid }),};#[cfg(feature = "std")]fn pow(base: $t, exp: usize) -> $t {Float::powi(base, exp as i32)}// otherwise uses the generic `pow` from the rootmatch (is_positive, exp) {(true,  Ok(exp)) => pow(base, exp),(false, Ok(exp)) => 1.0 / pow(base, exp),(_, Err(_))      => return Err(PFE { kind: Invalid }),}},None => 1.0, // no exponent};Ok(sig * exp)}})*)
}
float_trait_impl!(Num for f32 f64);/// A value bounded by a minimum and a maximum
///
///  If input is less than min then this returns min.
///  If input is greater than max then this returns max.
///  Otherwise this returns input.
///
/// **Panics** in debug mode if `!(min <= max)`.
#[inline]
pub fn clamp<T: PartialOrd>(input: T, min: T, max: T) -> T {debug_assert!(min <= max, "min must be less than or equal to max");if input < min {min} else if input > max {max} else {input}
}/// A value bounded by a minimum value
///
///  If input is less than min then this returns min.
///  Otherwise this returns input.
///  `clamp_min(std::f32::NAN, 1.0)` preserves `NAN` different from `f32::min(std::f32::NAN, 1.0)`.
///
/// **Panics** in debug mode if `!(min == min)`. (This occurs if `min` is `NAN`.)
#[inline]
#[allow(clippy::eq_op)]
pub fn clamp_min<T: PartialOrd>(input: T, min: T) -> T {debug_assert!(min == min, "min must not be NAN");if input < min {min} else {input}
}/// A value bounded by a maximum value
///
///  If input is greater than max then this returns max.
///  Otherwise this returns input.
///  `clamp_max(std::f32::NAN, 1.0)` preserves `NAN` different from `f32::max(std::f32::NAN, 1.0)`.
///
/// **Panics** in debug mode if `!(max == max)`. (This occurs if `max` is `NAN`.)
#[inline]
#[allow(clippy::eq_op)]
pub fn clamp_max<T: PartialOrd>(input: T, max: T) -> T {debug_assert!(max == max, "max must not be NAN");if input > max {max} else {input}
}#[test]
fn clamp_test() {// Int testassert_eq!(1, clamp(1, -1, 2));assert_eq!(-1, clamp(-2, -1, 2));assert_eq!(2, clamp(3, -1, 2));assert_eq!(1, clamp_min(1, -1));assert_eq!(-1, clamp_min(-2, -1));assert_eq!(-1, clamp_max(1, -1));assert_eq!(-2, clamp_max(-2, -1));// Float testassert_eq!(1.0, clamp(1.0, -1.0, 2.0));assert_eq!(-1.0, clamp(-2.0, -1.0, 2.0));assert_eq!(2.0, clamp(3.0, -1.0, 2.0));assert_eq!(1.0, clamp_min(1.0, -1.0));assert_eq!(-1.0, clamp_min(-2.0, -1.0));assert_eq!(-1.0, clamp_max(1.0, -1.0));assert_eq!(-2.0, clamp_max(-2.0, -1.0));assert!(clamp(::core::f32::NAN, -1.0, 1.0).is_nan());assert!(clamp_min(::core::f32::NAN, 1.0).is_nan());assert!(clamp_max(::core::f32::NAN, 1.0).is_nan());
}#[test]
#[should_panic]
#[cfg(debug_assertions)]
fn clamp_nan_min() {clamp(0., ::core::f32::NAN, 1.);
}#[test]
#[should_panic]
#[cfg(debug_assertions)]
fn clamp_nan_max() {clamp(0., -1., ::core::f32::NAN);
}#[test]
#[should_panic]
#[cfg(debug_assertions)]
fn clamp_nan_min_max() {clamp(0., ::core::f32::NAN, ::core::f32::NAN);
}#[test]
#[should_panic]
#[cfg(debug_assertions)]
fn clamp_min_nan_min() {clamp_min(0., ::core::f32::NAN);
}#[test]
#[should_panic]
#[cfg(debug_assertions)]
fn clamp_max_nan_max() {clamp_max(0., ::core::f32::NAN);
}#[test]
fn from_str_radix_unwrap() {// The Result error must impl Debug to allow unwrap()let i: i32 = Num::from_str_radix("0", 10).unwrap();assert_eq!(i, 0);let f: f32 = Num::from_str_radix("0.0", 10).unwrap();assert_eq!(f, 0.0);
}#[test]
fn from_str_radix_multi_byte_fail() {// Ensure parsing doesn't panic, even on invalid sign charactersassert!(f32::from_str_radix("™0.2", 10).is_err());// Even when parsing the exponent signassert!(f32::from_str_radix("0.2E™1", 10).is_err());
}#[test]
fn from_str_radix_ignore_case() {assert_eq!(f32::from_str_radix("InF", 16).unwrap(),::core::f32::INFINITY);assert_eq!(f32::from_str_radix("InfinitY", 16).unwrap(),::core::f32::INFINITY);assert_eq!(f32::from_str_radix("-InF", 8).unwrap(),::core::f32::NEG_INFINITY);assert_eq!(f32::from_str_radix("-InfinitY", 8).unwrap(),::core::f32::NEG_INFINITY);assert!(f32::from_str_radix("nAn", 4).unwrap().is_nan());assert!(f32::from_str_radix("-nAn", 4).unwrap().is_nan());
}#[test]
fn wrapping_is_num() {fn require_num<T: Num>(_: &T) {}require_num(&Wrapping(42_u32));require_num(&Wrapping(-42));
}#[test]
fn wrapping_from_str_radix() {macro_rules! test_wrapping_from_str_radix {($($t:ty)+) => {$(for &(s, r) in &[("42", 10), ("42", 2), ("-13.0", 10), ("foo", 10)] {let w = Wrapping::<$t>::from_str_radix(s, r).map(|w| w.0);assert_eq!(w, <$t as Num>::from_str_radix(s, r));})+};}test_wrapping_from_str_radix!(usize u8 u16 u32 u64 isize i8 i16 i32 i64);
}#[test]
fn check_num_ops() {fn compute<T: Num + Copy>(x: T, y: T) -> T {x * y / y % y + y - y}assert_eq!(compute(1, 2), 1)
}#[test]
fn check_numref_ops() {fn compute<T: NumRef>(x: T, y: &T) -> T {x * y / y % y + y - y}assert_eq!(compute(1, &2), 1)
}#[test]
fn check_refnum_ops() {fn compute<T: Copy>(x: &T, y: T) -> Twherefor<'a> &'a T: RefNum<T>,{&(&(&(&(x * y) / y) % y) + y) - y}assert_eq!(compute(&1, 2), 1)
}#[test]
fn check_refref_ops() {fn compute<T>(x: &T, y: &T) -> Twherefor<'a> &'a T: RefNum<T>,{&(&(&(&(x * y) / y) % y) + y) - y}assert_eq!(compute(&1, &2), 1)
}#[test]
fn check_numassign_ops() {fn compute<T: NumAssign + Copy>(mut x: T, y: T) -> T {x *= y;x /= y;x %= y;x += y;x -= y;x}assert_eq!(compute(1, 2), 1)
}#[test]
fn check_numassignref_ops() {fn compute<T: NumAssignRef + Copy>(mut x: T, y: &T) -> T {x *= y;x /= y;x %= y;x += y;x -= y;x}assert_eq!(compute(1, &2), 1)
}

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

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

相关文章

华为数通最新题库 H12-821 HCIP稳定过人中

以下是成绩单和考试人员 HCIP H12-831 HCIP H12-725 安全中级

Facebook 与数字社交的未来走向

随着数字技术的飞速发展&#xff0c;社交平台的角色和形式也在不断演变。作为全球最大社交平台之一&#xff0c;Facebook&#xff08;现Meta&#xff09;在推动数字社交的进程中扮演了至关重要的角色。然而&#xff0c;随着互联网的去中心化趋势和新技术的崛起&#xff0c;Face…

STM32中ADC模数转换器

一、ADC简介 ADC模拟-数字转换器 ADC可以将引脚连续变化的模拟电压转换为内存中存储的数字变量&#xff0c;建立模拟电路到数字电路的桥梁 12位逐次逼近型ADC&#xff0c;1us转换时间 输入电压范围&#xff1a; 0~3.3V&#xff0c;转换结果范围&#xff1a;0~4095 18个输入…

fpga系列 HDL:Quartus II PLL (Phase-Locked Loop) IP核 (Quartus II 18.0)

在 Quartus II 中使用 PLL (Phase-Locked Loop) 模块来将输入时钟分频或倍频&#xff0c;并生成多个相位偏移或频率不同的时钟信号&#xff1a; 1. 生成 PLL 模块 在 Quartus II 中&#xff1a; 打开 IP Components。 file:///C:/intelFPGA_lite/18.0/quartus/common/help/w…

Springboot3.x配置类(Configuration)和单元测试

配置类在Spring Boot框架中扮演着关键角色&#xff0c;它使开发者能够利用Java代码定义Bean、设定属性及调整其他Spring相关设置&#xff0c;取代了早期版本中依赖的XML配置文件。 集中化管理&#xff1a;借助Configuration注解&#xff0c;Spring Boot让用户能在一个或几个配…

【游戏中orika完成一个Entity的复制及其Entity异步落地的实现】 1.ctrl+shift+a是飞书下的截图 2.落地实现

一、orika工具使用 1)工具类 package com.xinyue.game.utils;import ma.glasnost.orika.MapperFactory; import ma.glasnost.orika.impl.DefaultMapperFactory;/*** author 王广帅* since 2022/2/8 22:37*/ public class XyBeanCopyUtil {private static MapperFactory mappe…

Unity 组件学习记录:Aspect Ratio Fitter

概述 Aspect Ratio Fitter是 Unity 中的一个组件&#xff0c;用于控制 UI 元素&#xff08;如Image、RawImage等&#xff09;的宽高比。它在处理不同屏幕分辨率和尺寸时非常有用&#xff0c;可以确保 UI 元素按照预期的比例进行显示。当添加到一个 UI 对象上时&#xff0c;Aspe…

uni-app开发AI康复锻炼小程序,帮助肢体受伤患者康复!

**提要&#xff1a;**近段时间我们收到多个康复机构用户&#xff0c;咨询AI运动识别插件是否可以应用于肢力运动受限患者的康复锻炼中来&#xff0c;插件是可以应用到AI康复锻炼中的&#xff0c;今天小编就为您介绍一下AI运动识别插件在康腹锻炼中的应用场景。 一、康复机构的应…

Elasticsearch:什么是信息检索?

信息检索定义 信息检索 (IR) 是一种有助于从大量非结构化或半结构化数据中有效、高效地检索相关信息的过程。信息&#xff08;IR&#xff09;检索系统有助于搜索、定位和呈现与用户的搜索查询或信息需求相匹配的信息。 作为信息访问的主要形式&#xff0c;信息检索是每天使用…

Pytest-Bdd vs Behave:选择最适合的 Python BDD 框架

Pytest-Bdd vs Behave&#xff1a;选择最适合的 Python BDD 框架 Pytest BDD vs Behave&#xff1a;选择最适合的 Python BDD 框架BDD 介绍Python BDD 框架列表Python BehavePytest BDDPytest BDD vs Behave&#xff1a;关键区别Pytest BDD vs Behave&#xff1a;最佳应用场景结…

【数据集】5种常见人类行为检测数据集3379张YOLO+VOC格式

数据集格式&#xff1a;VOC格式YOLO格式 压缩包内含&#xff1a;3个文件夹&#xff0c;分别存储图片、xml、txt文件 JPEGImages文件夹中jpg图片总计&#xff1a;3379 Annotations文件夹中xml文件总计&#xff1a;3379 labels文件夹中txt文件总计&#xff1a;3379 标签种类数&am…

唯品会Android面试题及参考答案

HTTP 和 HTTPS 的区别是什么?你的项目使用的是 HTTP 还是 HTTPS? HTTP 和 HTTPS 主要有以下区别。 首先是安全性。HTTP 是超文本传输协议,数据传输是明文的,这意味着在数据传输过程中,信息很容易被窃取或者篡改。比如,在一个不安全的网络环境下,黑客可以通过网络嗅探工具…

基于Python+Vue开发的商城管理系统,大四期末作业,实习作品

项目简介 该项目是基于PythonVue开发的商城管理系统&#xff08;前后端分离&#xff09;&#xff0c;这是一项为大学生课程设计作业而开发的项目。该系统旨在帮助大学生学习并掌握Python编程技能&#xff0c;同时锻炼他们的项目设计与开发能力。通过学习基于Python的网上商城管…

在 Solana 上实现 SOL 转账及构建支付分配器

与以太坊不同&#xff0c;在以太坊中&#xff0c;钱包通过 msg.value 指定交易的一部分并“推送” ETH 到合约&#xff0c;而 Solana 程序则是从钱包“拉取” Solana。 因此&#xff0c;没有“可支付”函数或“msg.value”这样的概念。 下面我们创建了一个新的 anchor 项目&a…

WebRTC搭建与应用(一)-ICE服务搭建

WebRTC搭建与应用(一) 近期由于项目需要在研究前端WebGL渲染转为云渲染&#xff0c;借此机会对WebRTC、ICE信令协议等有了初步了解&#xff0c;在此记录一下&#xff0c;以防遗忘。 第一章 ICE服务搭建 文章目录 WebRTC搭建与应用(一)前言一、ICE是什么&#xff1f;二、什么…

Linux高性能服务器编程 | 读书笔记 | 12. 多线程编程

12. 多线程编程 注&#xff1a;博客中有书中没有的内容&#xff0c;均是来自 黑马06-线程概念_哔哩哔哩_bilibili 早期Linux不支持线程&#xff0c;直到1996年&#xff0c;Xavier Leroy等人开发出第一个基本符合POSIX标准的线程库LinuxThreads&#xff0c;但LinuxThreads效率…

查看Mysql数据库引擎以及修改引擎为innoDB

目录 打开Mysql命令行 打开Mysql命令行 SHOW ENGINES;innoDB在事务型数据库中应用最多&#xff0c;其主要支持事务安全表&#xff08;ACID&#xff09;&#xff0c;行锁定和外键。 介绍下InnoDB的主要特性&#xff1a; 1、InnoDB给MySQL提供了具有提交、回滚和崩溃恢复能力的事…

Moretl安全日志采集工具

永久免费: 至Gitee下载 使用教程: Moretl使用说明 使用咨询: 用途 定时全量或增量采集工控机,电脑文件或日志. 优势 开箱即用: 解压直接运行.不需额外下载.管理设备: 后台统一管理客户端.无人值守: 客户端自启动,自更新.稳定安全: 架构简单,兼容性好,通过授权控制访问. 架…

密码学——密码学概述、分类、加密技术(山东省大数据职称考试)

大数据分析应用-初级 第一部分 基础知识 一、大数据法律法规、政策文件、相关标准 二、计算机基础知识 三、信息化基础知识 四、密码学 五、大数据安全 六、数据库系统 七、数据仓库. 第二部分 专业知识 一、大数据技术与应用 二、大数据分析模型 三、数据科学 密码学 大数据…

nodejs搭配express网站开发后端接口设计需要注意事项

nodejs搭配express网站开发后端接口设计需要注意事项&#xff01;为了回避一些常见的误区&#xff0c;今天和大家汇总一下&#xff0c;最近我遇到的一些错误信息&#xff0c;虽然都是小问题&#xff0c;但是还是需要分享一下&#xff0c;以免大家再次犯错。 1&#xff1a;第一个…