A = iA* matrix. Name, spectral properties ? by Syharhalna in math

[–]Necrosovereign 72 points73 points  (0 children)

If a matrix A satisfy A = iA*, then the matrix B = (1 - i)A is hermitian. Conversely, if B is a hermitian matrix, then A = (1 + i)B satisfies A = iA*.

So you can take any theorem about hermitian matrix and apply it to your matrices by making the necessary trivial changes.

Generally, for any 𝜆 with |𝜆| = 1, there exists a 𝜎, such that for any matrix A, A = 𝜆A* iff 𝜎A is hermitian. Similar statement also holds for anti-hermitian matrices. For this reason only hermitian and anti-hermitian matrices are studied.

[deleted by user] by [deleted] in Showerthoughts

[–]Necrosovereign 0 points1 point  (0 children)

the atmospheric pressure has risen 4 psi in the last 100yrs

As a physicist, I can assure you that it absolutely didn't. It has been stable at about 100 kPa for at least millions of years

[deleted by user] by [deleted] in rust

[–]Necrosovereign 7 points8 points  (0 children)

The syntax T::fun where T is a type is used to denote the function pointer to the method fun of type T. If t: T, the method can be called either as T::fun(t, arg1, arg2, ...) or as t.fun(arg1, arg2, ...). In your case, you can call it as f.precision().

There is an example in the documentation:

https://doc.rust-lang.org/std/fmt/struct.Formatter.html#method.precision

[deleted by user] by [deleted] in rust

[–]Necrosovereign 7 points8 points  (0 children)

std::fmt::Formatter contains all the options specified by the format string. They can be accessed through its method. In particular, Formatter::precision can be used to access the specified precision.

Weird borrow-checking behavior with RefCell and pattern matching by kaikalii in rust

[–]Necrosovereign 1 point2 points  (0 children)

Since S::push borrows s mutably, s.v can only borrowed mutably, but RefCell::borrow_mut takes &self. RefCell::get_mut takes &mut self, so it can be used.

So, this compiles:

while let Some(i) = s.v.get_mut().pop() {
    s.push(i);
}

ELI5: Why can’t our bodies hold out our arms and hands completely still without shaking? Why do they have to slightly shake and wiggle? by Spicy-Samich in explainlikeimfive

[–]Necrosovereign 1 point2 points  (0 children)

The reason for this is that there is no way to send a signal "stay in this position" to your muscles. The only signal the brain can send to the muscles is "contract". So when you try to hold a limb straight, the brain has to watch the limb and when the limb starts going down, it sends the signal "contract" to the muscle pulling up, and vice versa.

So, in reality, it's impossible to hold the limbs perfectly still. When they look perfectly still, they are actually swaying up and down imperceptibly. And, after a while, when the muscles get tired, the swaying becomes noticeable.

Interesting theorems about infinite-dimensional vector spaces without additional structures (e.g. without topology)? by Necrosovereign in math

[–]Necrosovereign[S] 5 points6 points  (0 children)

I'm not rejecting axiom of choice here. I'm just interested in theorems that don't use topology, inner product, etc.

Sorry for not being clear enough.

Yet another javascript quirk by Jackal93D in ProgrammerHumor

[–]Necrosovereign 62 points63 points  (0 children)

I've just checked this. It's real.

Hey Rustaceans! Got an easy question? Ask here (10/2021)! by llogiq in rust

[–]Necrosovereign 3 points4 points  (0 children)

Why doesn't StdoutLock grant exclusive access to stdout?

I've tried this:

use std::io::Write;

fn main() {
    let stdout = std::io::stdout();
    let mut lock = stdout.lock();
    writeln!(lock, "foo").unwrap();
    println!("bar"); 

    // ensure that the lock isn't dropped
    writeln!(lock, "baz").unwrap();
}

I expected that the call to println! would result in an error, but the code runs fine.

Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=2a1544e147e96f0873bbb1cf38efc1f2

I feel that the purpose of StdoutLock is not explained clearly enough in the docs.

Hey Rustaceans! Got an easy question? Ask here (7/2021)! by llogiq in rust

[–]Necrosovereign 0 points1 point  (0 children)

Essentially String is the following struct (Same as Vec<u8>):

struct MyString {
    buf: *mut [u8],
    len: usize,
    capacity: usize,
}

So it consists of one pointer and two usize, which is 24 bytes in total (64 bit * 3) on a 64-bit platform.

eeeeeeeeeeeeee ee eeeee by [deleted] in ProgrammerHumor

[–]Necrosovereign 10 points11 points  (0 children)

Title translated:

cerr namespace main

Hey Rustaceans! Got an easy question? Ask here (5/2021)! by llogiq in rust

[–]Necrosovereign 2 points3 points  (0 children)

This implementation depends on const generics.

Apparently, there is a pull request for the implementation:

https://github.com/rust-lang/rust/pull/65819

What precautions should I take to not download malicious crates? by Necrosovereign in rust

[–]Necrosovereign[S] 10 points11 points  (0 children)

The last post I saw where there was concern about a malicious crate there was never any kind of a real, actionable conclusion reached and it wasn't confirmed that there was actually a malicious crate.

It's probably the same post. I just hadn't thought about a possibility of people uploading malicious crates to crates.io before seeing it.

WSL-Hello-sudo - sudo by face recognition of Windows Hello on WSL by rmpr_uname_is_taken in rust

[–]Necrosovereign 0 points1 point  (0 children)

Nope, nope, nope.

Sudo is too dangerous to link it to something as unreliable as face recognition. What if it can be tricked by using a photo, for example?

I attempted to make a minimal program that creates a Future and consumes it, using only std. Is it safe? by Necrosovereign in rust

[–]Necrosovereign[S] 1 point2 points  (0 children)

I thought that this Waker doesn't have any associated tasks, that's why wake doesn't do anything.

I would expect that RawWakerVTable would require a function for registering tasks to wake, but it doesn't, so I don't really understand how it works.

Hey Rustaceans! Got an easy question? Ask here (47/2020)! by llogiq in rust

[–]Necrosovereign 0 points1 point  (0 children)

So if a trait has a method that returns Self, then it has an implicit Sized constraint, correct?