Live data from Hacker News

Wave Function Collapse library in pure C

github.com

61–70 of 87 posts

Re: Wave Function Collapse library in pure C

#61

I've never heard this referred to as "Wave Function Collapse" before. Isn't this just constraint satisfaction being solved via backtracking? Like this is the standard way of solving the N-queens problem. Make a random choice, propagate the constraints, and repeat, backtracking if you reach a contradiction. https://en.wikipedia.org/wiki/Backtracking

I think the statistical aspect is an important part of the algorithm; it's trying to match the statistics of the input data. I guess you can think of it as an approximate sampler for Markov Random Fields.

Re: Wave Function Collapse library in pure C

#62
post #45

Earlier quoted context omitted.

Any build tool can do whatever they feel like. Blindly trusting it will lead to the same outcome, regardless of the programming language ecosytem.

Sure, but should it? Do you really want nasal demons from your build tool?

Due to the success of build tools like Gradle, build.rs or any other one that packages a Turing complete language to steer a build, apparently many want such daemons on their homedir.

Re: Wave Function Collapse library in pure C

#63
post #19
post #3

Earlier quoted context omitted.

This is a typical idiom frequently seen in modern C and C++ codes. As https://github.com/krychu/wfc#how-to-use-the-library says, you need to define a macro in a C file in order to "expand" the actual code there. Having the code in the header gives a bit more flexibility considering the file layout. IMHO this is an awkward consequence of the missing de-facto-standard in C/C++ build systems.

This is a sad idom followed in C and C++ libraries that cannot be bothered to learn build tools, dealing with C and C++ as if they were scripting languages.

It's a completely valid and useful idiom. Whatever build system you use, it's trivial to add these kind of libraries to the project.

The fact that one has to learn complex build tools (and often multiple ones), is the sad thing here. Luckily there are also unity builds, which are extremely handy in many contexts, because they are so fast and easy to use between different platforms without having to deal with annoying external tools.

Re: Wave Function Collapse library in pure C

#64
post #36
post #25

Earlier quoted context omitted.

Have you ever tried using a unity build?

Another nonsense, no I haven't ever bothered with it. A hack designed by those that cannot be bothered to modularize a build with binary libraries.

Not entirely. If you think about it, a resulting C binary is just data and text - it’s all compiled into a single unit of globals and functions, much like a unity build layout. Regarding optimization it allows for LTO without the need for a link time optimizer. Regarding convenience, it spares one from function prototypes and using Make or CMake. Should one use Make to speed up build times it’s as simple as tossing the unity code you’re not working on into a precompiled header; this primes the compiler for a quick compilation of the newly written code. As for design, I find unity builds resemble the design mind of a mechanical, civil, or electrical engineer - a single assembly (main.c) incorporates sub assemblies (*.c) like a CAD designer would design SolidWorks parts for a vehicle or spacecraft

Re: Wave Function Collapse library in pure C

#66
post #31

Earlier quoted context omitted.

In which case, where does the Born rule come from?

https://en.wikipedia.org/wiki/Gleason%27s_theorem

As far as I can tell, that is just explaining the numeric value of the Born rule, not the wave function collapse/update. I have not found any claims that Gleason's theorem (which I was unaware of, so thank you for pointing it out!) solves the measurement problem.

Re: Wave Function Collapse library in pure C

#67
post #50
post #44

Earlier quoted context omitted.

All code in the header leads to a lot of duplicated work for the compiler, which means slow build times. You should avoid this unless it is absolutely necessary for performance to inline methods.

That work will be done by the preprocessor and should be fairly quick given it doesn't compile the duplicated code and only removes it.

It may still generate code for function definitions, which are deduped by the linker, so a lot of the code can still go through the whole compiler.

Re: Wave Function Collapse library in pure C

#68
post #24

Earlier quoted context omitted.

> btw. Wave function collapse in quantum physics is completely speculative phenomenon. There is only apparent wave function collapse. To be more precise, the Born rule non-linear adjustment of the wave function to a single real value after a measurement is strictly necessary for QM to match experiments. Whether this should be interpreted as a physical phenomenon of wave function collapse, or as entanglement with the…

Adjustment is just cutting interference terms from equation. Mathematically apparent wave function collapse is caused by quantum decoherence. Wave-function collapse as a priori process is just speculation. Finding that it actually happens would be new physics.

However you put it, [to a classical observer] the wave function still "collapses" after a measurement. This is most famously seen by adding a detector inside one of the slits for the double-slit experiment: the original wave function is not consistent with the experiment, you have to update the wave function after the interaction (or lack of interaction) with the detector.

Sure, in MWI the wave function of the universe never collapses, but something similar still happens for "parts" of the universal wave function.

Re: Wave Function Collapse library in pure C

#69
post #3

Earlier quoted context omitted.

This is a typical idiom frequently seen in modern C and C++ codes. As https://github.com/krychu/wfc#how-to-use-the-library says, you need to define a macro in a C file in order to "expand" the actual code there. Having the code in the header gives a bit more flexibility considering the file layout. IMHO this is an awkward consequence of the missing de-facto-standard in C/C++ build systems.

How is it more flexible exactly? I hate this idiom every time I come across it. I like to look at the header file to see the interface and important documentation, and this just obscures it. Depending on your compiler it can make debugging a huge pain as well.

Its a slow to compile idiom. The only reason to use it is if you expect people to download the header and plop it in. Basically its an end-run around build systems.

Re: Wave Function Collapse library in pure C

#70
post #59

Earlier quoted context omitted.

Huh. I can't believe I missed this. Thanks.

In quantum computing the consequence of the theorem (as I understand it) is that once you have asked every yes/no question there is to ask about the state, the state has collapsed.

I didn't think you needed the theorem for that; quantum entanglement behaves very similarly to information theory (specifically, information provenance).
Post reply on HN