#[repr(C)]pub struct Scalar(_);Expand description
Implementations§
source§impl Scalar
impl Scalar
sourcepub fn from_f64(scalar: f64) -> Self
pub fn from_f64(scalar: f64) -> Self
Examples found in repository?
src/scalar.rs (line 55)
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561
pub fn from_u64(scalar: u64) -> Self {
Self::from_f64(scalar as f64)
}
/// Convert the scalar into an `f32`
pub fn into_f32(self) -> f32 {
self.0 as f32
}
/// Convert the scalar into an `f64`
pub fn into_f64(self) -> f64 {
self.0
}
/// Convert the scalar into a `u64`
pub fn into_u64(self) -> u64 {
self.0 as u64
}
/// Indicate whether the scalar is negative
pub fn is_negative(self) -> bool {
self < Self::ZERO
}
/// Indicate whether the scalar is positive
pub fn is_positive(self) -> bool {
self > Self::ZERO
}
/// Indicate whether the scalar is zero
pub fn is_zero(self) -> bool {
self == Self::ZERO
}
/// The sign of the scalar
///
/// Return `Scalar::ZERO`, if the scalar is zero, `Scalar::ONE`, if it is
/// positive, `-Scalar::ONE`, if it is negative.
pub fn sign(self) -> Sign {
if self.is_negative() {
return Sign::Negative;
}
if self.is_positive() {
return Sign::Positive;
}
if self.is_zero() {
return Sign::Zero;
}
unreachable!("Sign is neither negative, nor positive, nor zero.")
}
/// Compute the absolute value of the scalar
pub fn abs(self) -> Self {
self.0.abs().into()
}
/// Compute the maximum of this and another scalar
pub fn max(self, other: impl Into<Self>) -> Self {
self.0.max(other.into().0).into()
}
/// Compute the largest integer smaller than or equal to this scalar
pub fn floor(self) -> Self {
self.0.floor().into()
}
/// Compute the smallest integer larger than or equal to this scalar
pub fn ceil(self) -> Self {
self.0.ceil().into()
}
/// Round the scalar
pub fn round(self) -> Self {
self.0.round().into()
}
/// Compute the cosine
pub fn cos(self) -> Self {
self.0.cos().into()
}
/// Compute sine and cosine
pub fn sin_cos(self) -> (Self, Self) {
let (sin, cos) = self.0.sin_cos();
(sin.into(), cos.into())
}
/// Compute the arccosine
pub fn acos(self) -> Self {
self.0.acos().into()
}
/// Compute the four-quadrant arctangent
pub fn atan2(self, other: Self) -> Self {
self.0.atan2(other.0).into()
}
}
impl PartialEq for Scalar {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
impl Eq for Scalar {}
impl PartialOrd for Scalar {
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
self.0.partial_cmp(&other.0)
}
}
impl Ord for Scalar {
fn cmp(&self, other: &Self) -> cmp::Ordering {
// Should never panic, as `from_f64` checks that the wrapped value is
// finite.
self.partial_cmp(other).expect("Invalid `Scalar`")
}
}
impl Hash for Scalar {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
// To the best of my knowledge, this matches the `PartialEq`
// implementation.
R64::from_inner(self.0).hash(state);
}
}
impl From<f32> for Scalar {
fn from(scalar: f32) -> Self {
Self::from_f64(scalar.into())
}
}
impl From<f64> for Scalar {
fn from(scalar: f64) -> Self {
Self::from_f64(scalar)
}
}
impl From<Scalar> for f64 {
fn from(scalar: Scalar) -> Self {
scalar.into_f64()
}
}
impl ops::Neg for Scalar {
type Output = Self;
fn neg(self) -> Self::Output {
self.0.neg().into()
}
}
impl<T: Into<Self>> ops::Add<T> for Scalar {
type Output = Self;
fn add(self, rhs: T) -> Self::Output {
self.0.add(rhs.into().0).into()
}
}
impl<T: Into<Self>> ops::Sub<T> for Scalar {
type Output = Self;
fn sub(self, rhs: T) -> Self::Output {
self.0.sub(rhs.into().0).into()
}
}
impl<T: Into<Self>> ops::Mul<T> for Scalar {
type Output = Self;
fn mul(self, rhs: T) -> Self::Output {
self.0.mul(rhs.into().0).into()
}
}
impl<T: Into<Self>> ops::Div<T> for Scalar {
type Output = Self;
fn div(self, rhs: T) -> Self::Output {
self.0.div(rhs.into().0).into()
}
}
impl<T: Into<Self>> ops::Rem<T> for Scalar {
type Output = Self;
fn rem(self, rhs: T) -> Self::Output {
self.0.rem(rhs.into().0).into()
}
}
impl<T: Into<Self>> ops::AddAssign<T> for Scalar {
fn add_assign(&mut self, rhs: T) {
self.0.add_assign(rhs.into().0);
*self = self.0.into();
}
}
impl<T: Into<Self>> ops::SubAssign<T> for Scalar {
fn sub_assign(&mut self, rhs: T) {
self.0.sub_assign(rhs.into().0);
*self = self.0.into();
}
}
impl<T: Into<Self>> ops::MulAssign<T> for Scalar {
fn mul_assign(&mut self, rhs: T) {
self.0.mul_assign(rhs.into().0);
*self = self.0.into();
}
}
impl<T: Into<Self>> ops::DivAssign<T> for Scalar {
fn div_assign(&mut self, rhs: T) {
self.0.div_assign(rhs.into().0);
*self = self.0.into();
}
}
impl<T: Into<Self>> ops::RemAssign<T> for Scalar {
fn rem_assign(&mut self, rhs: T) {
self.0.rem_assign(rhs.into().0);
*self = self.0.into();
}
}
impl num_traits::Zero for Scalar {
fn zero() -> Self {
Self::ZERO
}
fn is_zero(&self) -> bool {
self.0.is_zero()
}
}
impl num_traits::One for Scalar {
fn one() -> Self {
Self::ONE
}
}
impl num_traits::Num for Scalar {
type FromStrRadixErr = <f64 as num_traits::Num>::FromStrRadixErr;
fn from_str_radix(
str: &str,
radix: u32,
) -> Result<Self, Self::FromStrRadixErr> {
f64::from_str_radix(str, radix).map(Self::from_f64)
}
}
impl num_traits::NumCast for Scalar {
fn from<T: num_traits::ToPrimitive>(n: T) -> Option<Self> {
Some(Self::from_f64(<f64 as num_traits::NumCast>::from(n)?))
}
}
impl num_traits::Signed for Scalar {
fn abs(&self) -> Self {
self.0.abs().into()
}
fn abs_sub(&self, other: &Self) -> Self {
<f64 as num_traits::Signed>::abs_sub(&self.0, &other.0).into()
}
fn signum(&self) -> Self {
<f64 as num_traits::Signed>::signum(&self.0).into()
}
fn is_positive(&self) -> bool {
<f64 as num_traits::Signed>::is_positive(&self.0)
}
fn is_negative(&self) -> bool {
<f64 as num_traits::Signed>::is_negative(&self.0)
}
}
impl num_traits::ToPrimitive for Scalar {
fn to_i64(&self) -> Option<i64> {
self.0.to_i64()
}
fn to_u64(&self) -> Option<u64> {
self.0.to_u64()
}
}
impl num_traits::Float for Scalar {
fn nan() -> Self {
panic!("`Scalar` can not represent NaN")
}
fn infinity() -> Self {
Self::from_f64(f64::infinity())
}
fn neg_infinity() -> Self {
Self::from_f64(f64::neg_infinity())
}
fn neg_zero() -> Self {
Self::from_f64(f64::neg_zero())
}
fn min_value() -> Self {
Self::from_f64(f64::min_value())
}
fn min_positive_value() -> Self {
Self::from_f64(f64::min_positive_value())
}
fn max_value() -> Self {
Self::from_f64(f64::max_value())
}
fn is_nan(self) -> bool {
self.0.is_nan()
}
fn is_infinite(self) -> bool {
self.0.is_infinite()
}
fn is_finite(self) -> bool {
self.0.is_finite()
}
fn is_normal(self) -> bool {
self.0.is_normal()
}
fn classify(self) -> std::num::FpCategory {
self.0.classify()
}
fn floor(self) -> Self {
Self::from_f64(self.0.floor())
}
fn ceil(self) -> Self {
Self::from_f64(self.0.ceil())
}
fn round(self) -> Self {
Self::from_f64(self.0.round())
}
fn trunc(self) -> Self {
Self::from_f64(self.0.trunc())
}
fn fract(self) -> Self {
Self::from_f64(self.0.fract())
}
fn abs(self) -> Self {
Self::from_f64(self.0.abs())
}
fn signum(self) -> Self {
Self::from_f64(self.0.signum())
}
fn is_sign_positive(self) -> bool {
self.0.is_sign_positive()
}
fn is_sign_negative(self) -> bool {
self.0.is_sign_negative()
}
fn mul_add(self, a: Self, b: Self) -> Self {
Self::from_f64(self.0.mul_add(a.0, b.0))
}
fn recip(self) -> Self {
Self::from_f64(self.0.recip())
}
fn powi(self, n: i32) -> Self {
Self::from_f64(self.0.powi(n))
}
fn powf(self, n: Self) -> Self {
Self::from_f64(self.0.powf(n.0))
}
fn sqrt(self) -> Self {
Self::from_f64(self.0.sqrt())
}
fn exp(self) -> Self {
Self::from_f64(self.0.exp())
}
fn exp2(self) -> Self {
Self::from_f64(self.0.exp2())
}
fn ln(self) -> Self {
Self::from_f64(self.0.ln())
}
fn log(self, base: Self) -> Self {
Self::from_f64(self.0.log(base.0))
}
fn log2(self) -> Self {
Self::from_f64(self.0.log2())
}
fn log10(self) -> Self {
Self::from_f64(self.0.log10())
}
fn max(self, other: Self) -> Self {
Self::from_f64(self.0.max(other.0))
}
fn min(self, other: Self) -> Self {
Self::from_f64(self.0.min(other.0))
}
fn abs_sub(self, other: Self) -> Self {
(self - other).abs()
}
fn cbrt(self) -> Self {
Self::from_f64(self.0.cbrt())
}
fn hypot(self, other: Self) -> Self {
Self::from_f64(self.0.hypot(other.0))
}
fn sin(self) -> Self {
Self::from_f64(self.0.sin())
}
fn cos(self) -> Self {
Self::from_f64(self.0.cos())
}
fn tan(self) -> Self {
Self::from_f64(self.0.tan())
}
fn asin(self) -> Self {
Self::from_f64(self.0.asin())
}
fn acos(self) -> Self {
Self::from_f64(self.0.acos())
}
fn atan(self) -> Self {
Self::from_f64(self.0.atan())
}
fn atan2(self, other: Self) -> Self {
Self::from_f64(self.0.atan2(other.0))
}
fn sin_cos(self) -> (Self, Self) {
let (sin, cos) = self.0.sin_cos();
(Self::from_f64(sin), Self::from_f64(cos))
}
fn exp_m1(self) -> Self {
Self::from_f64(self.0.exp_m1())
}
fn ln_1p(self) -> Self {
Self::from_f64(self.0.ln_1p())
}
fn sinh(self) -> Self {
Self::from_f64(self.0.sinh())
}
fn cosh(self) -> Self {
Self::from_f64(self.0.cosh())
}
fn tanh(self) -> Self {
Self::from_f64(self.0.tanh())
}
fn asinh(self) -> Self {
Self::from_f64(self.0.asinh())
}
fn acosh(self) -> Self {
Self::from_f64(self.0.acosh())
}
fn atanh(self) -> Self {
Self::from_f64(self.0.atanh())
}sourcepub fn into_f64(self) -> f64
pub fn into_f64(self) -> f64
Convert the scalar into an f64
Examples found in repository?
More examples
src/vector.rs (line 269)
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
fn from(vector: Vector<D>) -> Self {
vector.components.map(|scalar| scalar.into_f64())
}
}
impl<const D: usize> From<Vector<D>> for [Scalar; D] {
fn from(vector: Vector<D>) -> Self {
vector.components
}
}
impl<const D: usize> From<Vector<D>> for nalgebra::SVector<f64, D> {
fn from(vector: Vector<D>) -> Self {
vector.to_na()
}
}
impl<const D: usize> ops::Neg for Vector<D> {
type Output = Self;
fn neg(self) -> Self::Output {
self.to_na().neg().into()
}
}
impl<V, const D: usize> ops::Add<V> for Vector<D>
where
V: Into<Self>,
{
type Output = Self;
fn add(self, rhs: V) -> Self::Output {
self.to_na().add(rhs.into().to_na()).into()
}
}
impl<V, const D: usize> ops::Sub<V> for Vector<D>
where
V: Into<Self>,
{
type Output = Self;
fn sub(self, rhs: V) -> Self::Output {
self.to_na().sub(rhs.into().to_na()).into()
}
}
impl<S, const D: usize> ops::Mul<S> for Vector<D>
where
S: Into<Scalar>,
{
type Output = Self;
fn mul(self, rhs: S) -> Self::Output {
self.to_na().mul(rhs.into().into_f64()).into()
}
}
impl<S, const D: usize> ops::Div<S> for Vector<D>
where
S: Into<Scalar>,
{
type Output = Self;
fn div(self, rhs: S) -> Self::Output {
self.to_na().div(rhs.into().into_f64()).into()
}sourcepub fn is_negative(self) -> bool
pub fn is_negative(self) -> bool
Indicate whether the scalar is negative
Examples found in repository?
src/scalar.rs (line 93)
92 93 94 95 96 97 98 99 100 101 102 103 104
pub fn sign(self) -> Sign {
if self.is_negative() {
return Sign::Negative;
}
if self.is_positive() {
return Sign::Positive;
}
if self.is_zero() {
return Sign::Zero;
}
unreachable!("Sign is neither negative, nor positive, nor zero.")
}sourcepub fn is_positive(self) -> bool
pub fn is_positive(self) -> bool
Indicate whether the scalar is positive
Examples found in repository?
src/scalar.rs (line 96)
92 93 94 95 96 97 98 99 100 101 102 103 104
pub fn sign(self) -> Sign {
if self.is_negative() {
return Sign::Negative;
}
if self.is_positive() {
return Sign::Positive;
}
if self.is_zero() {
return Sign::Zero;
}
unreachable!("Sign is neither negative, nor positive, nor zero.")
}sourcepub fn is_zero(self) -> bool
pub fn is_zero(self) -> bool
Indicate whether the scalar is zero
Examples found in repository?
src/scalar.rs (line 99)
92 93 94 95 96 97 98 99 100 101 102 103 104
pub fn sign(self) -> Sign {
if self.is_negative() {
return Sign::Negative;
}
if self.is_positive() {
return Sign::Positive;
}
if self.is_zero() {
return Sign::Zero;
}
unreachable!("Sign is neither negative, nor positive, nor zero.")
}sourcepub fn sign(self) -> Sign
pub fn sign(self) -> Sign
The sign of the scalar
Return Scalar::ZERO, if the scalar is zero, Scalar::ONE, if it is
positive, -Scalar::ONE, if it is negative.
sourcepub fn max(self, other: impl Into<Self>) -> Self
pub fn max(self, other: impl Into<Self>) -> Self
Compute the maximum of this and another scalar
sourcepub fn atan2(self, other: Self) -> Self
pub fn atan2(self, other: Self) -> Self
Compute the four-quadrant arctangent
Examples found in repository?
src/circle.rs (line 127)
122 123 124 125 126 127 128 129 130 131 132 133 134
pub fn point_to_circle_coords(
&self,
point: impl Into<Point<D>>,
) -> Point<1> {
let vector = (point.into() - self.center).to_uv();
let atan = Scalar::atan2(vector.v, vector.u);
let coord = if atan >= Scalar::ZERO {
atan
} else {
atan + Scalar::TAU
};
Point::from([coord])
}Trait Implementations§
source§impl AbsDiffEq<Scalar> for Scalar
impl AbsDiffEq<Scalar> for Scalar
source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate
equality of two numbers.
source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of
AbsDiffEq::abs_diff_eq.source§impl<T: Into<Self>> AddAssign<T> for Scalar
impl<T: Into<Self>> AddAssign<T> for Scalar
source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+= operation. Read moresource§impl<T: Into<Self>> DivAssign<T> for Scalar
impl<T: Into<Self>> DivAssign<T> for Scalar
source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/= operation. Read moresource§impl Float for Scalar
impl Float for Scalar
source§fn neg_infinity() -> Self
fn neg_infinity() -> Self
Returns the negative infinite value. Read more
source§fn min_value() -> Self
fn min_value() -> Self
Returns the smallest finite value that this type can represent. Read more
source§fn min_positive_value() -> Self
fn min_positive_value() -> Self
Returns the smallest positive, normalized value that this type can represent. Read more
source§fn max_value() -> Self
fn max_value() -> Self
Returns the largest finite value that this type can represent. Read more
source§fn is_infinite(self) -> bool
fn is_infinite(self) -> bool
Returns
true if this value is positive infinity or negative infinity and
false otherwise. Read moresource§fn classify(self) -> FpCategory
fn classify(self) -> FpCategory
Returns the floating point category of the number. If only one property
is going to be tested, it is generally faster to use the specific
predicate instead. Read more
source§fn ceil(self) -> Self
fn ceil(self) -> Self
Returns the smallest integer greater than or equal to a number. Read more
source§fn round(self) -> Self
fn round(self) -> Self
Returns the nearest integer to a number. Round half-way cases away from
0.0. Read moresource§fn is_sign_positive(self) -> bool
fn is_sign_positive(self) -> bool
Returns
true if self is positive, including +0.0,
Float::infinity(), and since Rust 1.20 also Float::nan(). Read moresource§fn is_sign_negative(self) -> bool
fn is_sign_negative(self) -> bool
Returns
true if self is negative, including -0.0,
Float::neg_infinity(), and since Rust 1.20 also -Float::nan(). Read moresource§fn mul_add(self, a: Self, b: Self) -> Self
fn mul_add(self, a: Self, b: Self) -> Self
Fused multiply-add. Computes
(self * a) + b with only one rounding
error, yielding a more accurate result than an unfused multiply-add. Read moresource§fn log(self, base: Self) -> Self
fn log(self, base: Self) -> Self
Returns the logarithm of the number with respect to an arbitrary base. Read more
source§fn hypot(self, other: Self) -> Self
fn hypot(self, other: Self) -> Self
Calculate the length of the hypotenuse of a right-angle triangle given
legs of length
x and y. Read moresource§fn asin(self) -> Self
fn asin(self) -> Self
Computes the arcsine of a number. Return value is in radians in
the range [-pi/2, pi/2] or NaN if the number is outside the range
[-1, 1]. Read more
source§fn acos(self) -> Self
fn acos(self) -> Self
Computes the arccosine of a number. Return value is in radians in
the range [0, pi] or NaN if the number is outside the range
[-1, 1]. Read more
source§fn atan(self) -> Self
fn atan(self) -> Self
Computes the arctangent of a number. Return value is in radians in the
range [-pi/2, pi/2]; Read more
source§fn sin_cos(self) -> (Self, Self)
fn sin_cos(self) -> (Self, Self)
source§fn exp_m1(self) -> Self
fn exp_m1(self) -> Self
Returns
e^(self) - 1 in a way that is accurate even if the
number is close to zero. Read moresource§fn ln_1p(self) -> Self
fn ln_1p(self) -> Self
Returns
ln(1+n) (natural logarithm) more accurately than if
the operations were performed separately. Read moresource§fn integer_decode(self) -> (u64, i16, i8)
fn integer_decode(self) -> (u64, i16, i8)
Returns the mantissa, base 2 exponent, and sign as integers, respectively.
The original number can be recovered by
sign * mantissa * 2 ^ exponent. Read moresource§fn to_degrees(self) -> Self
fn to_degrees(self) -> Self
Converts radians to degrees. Read more
source§fn to_radians(self) -> Self
fn to_radians(self) -> Self
Converts degrees to radians. Read more
source§impl<T: Into<Self>> MulAssign<T> for Scalar
impl<T: Into<Self>> MulAssign<T> for Scalar
source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*= operation. Read moresource§impl Num for Scalar
impl Num for Scalar
type FromStrRadixErr = <f64 as Num>::FromStrRadixErr
source§fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
Convert from a string and radix (typically
2..=36). Read moresource§impl Ord for Scalar
impl Ord for Scalar
source§impl PartialEq<Scalar> for Scalar
impl PartialEq<Scalar> for Scalar
source§impl PartialOrd<Scalar> for Scalar
impl PartialOrd<Scalar> for Scalar
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl<T: Into<Self>> RemAssign<T> for Scalar
impl<T: Into<Self>> RemAssign<T> for Scalar
source§fn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
Performs the
%= operation. Read moresource§impl Signed for Scalar
impl Signed for Scalar
source§fn is_positive(&self) -> bool
fn is_positive(&self) -> bool
Returns true if the number is positive and false if the number is zero or negative.
source§fn is_negative(&self) -> bool
fn is_negative(&self) -> bool
Returns true if the number is negative and false if the number is zero or positive.
source§impl<T: Into<Self>> SubAssign<T> for Scalar
impl<T: Into<Self>> SubAssign<T> for Scalar
source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the
-= operation. Read moresource§impl ToPrimitive for Scalar
impl ToPrimitive for Scalar
source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
Converts the value of
self to an i64. If the value cannot be
represented by an i64, then None is returned.source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
Converts the value of
self to a u64. If the value cannot be
represented by a u64, then None is returned.source§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
Converts the value of
self to an isize. If the value cannot be
represented by an isize, then None is returned.source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
Converts the value of
self to an i8. If the value cannot be
represented by an i8, then None is returned.source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
Converts the value of
self to an i16. If the value cannot be
represented by an i16, then None is returned.source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
Converts the value of
self to an i32. If the value cannot be
represented by an i32, then None is returned.source§fn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
Converts the value of
self to an i128. If the value cannot be
represented by an i128 (i64 under the default implementation), then
None is returned. Read moresource§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
Converts the value of
self to a usize. If the value cannot be
represented by a usize, then None is returned.source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
Converts the value of
self to a u8. If the value cannot be
represented by a u8, then None is returned.source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
Converts the value of
self to a u16. If the value cannot be
represented by a u16, then None is returned.source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
Converts the value of
self to a u32. If the value cannot be
represented by a u32, then None is returned.source§fn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
Converts the value of
self to a u128. If the value cannot be
represented by a u128 (u64 under the default implementation), then
None is returned. Read moreimpl Copy for Scalar
impl Eq for Scalar
Auto Trait Implementations§
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnwindSafe for Scalar
Blanket Implementations§
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.source§impl<T> Real for Twhere
T: Float,
impl<T> Real for Twhere
T: Float,
source§fn min_positive_value() -> T
fn min_positive_value() -> T
Returns the smallest positive, normalized value that this type can represent. Read more
source§fn round(self) -> T
fn round(self) -> T
Returns the nearest integer to a number. Round half-way cases away from
0.0. Read moresource§fn is_sign_positive(self) -> bool
fn is_sign_positive(self) -> bool
Returns
true if self is positive, including +0.0,
Float::infinity(), and with newer versions of Rust f64::NAN. Read moresource§fn is_sign_negative(self) -> bool
fn is_sign_negative(self) -> bool
Returns
true if self is negative, including -0.0,
Float::neg_infinity(), and with newer versions of Rust -f64::NAN. Read moresource§fn mul_add(self, a: T, b: T) -> T
fn mul_add(self, a: T, b: T) -> T
Fused multiply-add. Computes
(self * a) + b with only one rounding
error, yielding a more accurate result than an unfused multiply-add. Read moresource§fn log(self, base: T) -> T
fn log(self, base: T) -> T
Returns the logarithm of the number with respect to an arbitrary base. Read more
source§fn to_degrees(self) -> T
fn to_degrees(self) -> T
Converts radians to degrees. Read more
source§fn to_radians(self) -> T
fn to_radians(self) -> T
Converts degrees to radians. Read more
source§fn hypot(self, other: T) -> T
fn hypot(self, other: T) -> T
Calculate the length of the hypotenuse of a right-angle triangle given
legs of length
x and y. Read moresource§fn asin(self) -> T
fn asin(self) -> T
Computes the arcsine of a number. Return value is in radians in
the range [-pi/2, pi/2] or NaN if the number is outside the range
[-1, 1]. Read more
source§fn acos(self) -> T
fn acos(self) -> T
Computes the arccosine of a number. Return value is in radians in
the range [0, pi] or NaN if the number is outside the range
[-1, 1]. Read more
source§fn atan(self) -> T
fn atan(self) -> T
Computes the arctangent of a number. Return value is in radians in the
range [-pi/2, pi/2]; Read more
source§fn exp_m1(self) -> T
fn exp_m1(self) -> T
Returns
e^(self) - 1 in a way that is accurate even if the
number is close to zero. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.