frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: Usul – Express neural networks as raw math in C++23

https://github.com/crushr3sist/Usul-cpp
2•ronny2fresh•7m ago
SO, Usul-cpp is a library I've written in C++, it is based around allowing data scientists to create their models without heavy libraries such as tensorflow, and just express their models using maths, and Usul will handle the rest. There is builtin tensor support, auto-grad, back-prop and its quite fast.

I wrote it because, it seemed less mystifying to read maths instead of a random class that supposedly does something. I wrote it from scratch in cpp (23) due to the fact that I wanted to emphasise on precision, however it's subtly built on top of xtensor.

check it out in action #include <usul.hpp> using namespace std;

  int main() {
    double LR = 0.1;
    int EPOCH = 5000;
    // lets write the forward pass
    Tensor X = {
        {0.0, 0.0}, // this is what we're feeding it
        {0.0, 1.0},
        {1.0, 0.0},
        {1.0, 1.0},
    };

    // this is what we're after
    Tensor Y_true = {
        0.0, // xor{0.0, 0.0} = 0.0
        1.0, // xor{0.0, 1.0} = 1.0
        1.0, // xor{1.0, 0.0} = 1.0
        0.0  // xor{1.0, 1.0} = 0.0
    };

    Y_true.reshape({4, 1});

    // we are now going to create a single layer, double neuron network
    // each layer will have a bias and weights tensor.
    auto W1 = generate_random_matrix({2, 4}, -1.0, 1.0);
    auto B1 = generate_random_matrix({1, 4}, -1.0, 1.0);
    auto W2 = generate_random_matrix({4, 1}, -1.0, 1.0);
    auto B2 = generate_random_matrix({1, 1}, -1.0, 1.0);

    // this is the training loop
    for (int i = 0; i < EPOCH; i++) {
      // so lets do one forward pass
      // first layer
      auto Z1 = X % W1 + B1;
      auto A = Z1.ReLU();
      // second layer
      auto Z2 = A % W2 + B2;

      // activation
      // should be - auto S = Z2.activate(Activate::Sigmoid);
      auto S = Z2.Sigmoid();
      // Loss
      // should be - auto Loss = S.loss(Loss::MSE);

      auto loss = (S - Y_true) * (S - Y_true);
      loss = loss.mean();

      cout << "Loss: " << loss << "\n";
      cout << "guesses: " << "\n"
           << S << "\n";
      cout << "should be: " << Y_true << "\n";

      loss.backwards();

      W1.step(LR);
      B1.step(LR);
      W2.step(LR);
      B2.step(LR);
    }
  }
which will output

  Guesses: 
  Tensor({{ 0.027546},
   { 0.963592},
   { 0.964138},
   { 0.038964}}, shape=(4,1))

  should be: Tensor({{ 0.},
   { 1.},
   { 1.},
   { 0.}}, shape=(4,1))

  Loss: Tensor( 0.001222, shape=())


Just write the maths, and Usul-cpp will handle the rest, it is extremely lightweight, and the entire library is memory safe. And its called Usul, because I'm a huge dune fan.

You can view the project at [https://github.com/crushr3sist/Usul-cpp](https://github.com/crushr3sist/Usul-cpp)

Any ideas for what to do next are all welcome, you can also pull and implement features that you think could improve this project. (no vibecoded prs please, this project is not vibe-coded)

Comments

ronny2fresh•7m ago
BACKGROUND INFO BELOW

i'd like to share a bit of a background. maths has always stood in the way between me and finally learning how to write neural networks, I've always been fascinated by them ever since i saw that diagram of a deep neural network with all the node edges interconnecting with others.

Well I stopped letting highschool math class trauma stop me from understanding these concepts, i took a pen and paper out, taught myself numerical descent, analytical descent, backwards propagation, what a compute graph is, all of these subjects, taught myself, until I was manually backwards propagating the loss between a few arithmetics, until that moved into scalar level neural networks and doing simple calculus and being able to do xor gate problem with scalar, and then I taught myself matrix calculus, and well...

I taught myself neural networks, taught myself the maths, until I hand written the xor gate problem in matrix syntax using xtensor, and manually, by hand, no AI, did the xor gate problem manually backwards propagating error, automatically differentiating. This was also a kind of detox from LLM dependency, I don't tend to use it for code, but because its so central in my daily life and a migration from google to gemini, using LLMs for immediate information access had started to affect my mind and my ability to intake information. I really hope some of you find this library useful, as i did spend a pretty decent amount of time on it, and I would love it if any of you had any ideas on what to do next with this library.

Thank you for reading, I really appreciate it.

Show HN: RemoteCrab – an iPhone as your computer's camera, mic and screen

https://vgoapp.com/remotecrab/
1•edwinhao88•20s ago•0 comments

Show HN: Relinos – A Hacker's Web Browser – Any Site to API (Open-Source)

https://github.com/realsirjoe/relinos
1•realsirjoe•2m ago•0 comments

Cyberattack hits French blood bank freezer – thwarted by failsafes

https://apnews.com/article/france-plasma-blood-bank-cyberattack-temperature-fridge-12b80bcf93b840...
1•quaffcode•2m ago•1 comments

We made the first 1 PFLOP/s FlashAttention on a single H100 GPU

https://streamhpc.com/blog/2026-11-09/we-made-the-worlds-first-1-pflops-flash-attention-on-a-sing...
1•ibobev•2m ago•0 comments

Claude Code token cost explorer

https://entropicthoughts.com/claude-code-token-cost-explorer
1•ibobev•3m ago•0 comments

Old Vintage Computing Research

http://oldvcr.blogspot.com/2026/11/the-classic-console-corners-crt.html
1•dverlaeckt80•6m ago•0 comments

Show HN: Pentimento – status and lineage for your coding agent's plan files

https://github.com/kjiwa/pentimento
2•kjiwa•7m ago•1 comments

Show HN: Usul – Express neural networks as raw math in C++23

https://github.com/crushr3sist/Usul-cpp
2•ronny2fresh•7m ago•1 comments

Why Morningstar Thinks Anthropic Is Worth $1.7T

https://www.morningstar.com/stocks/why-morningstar-thinks-anthropic-is-worth-17-trillion
1•RickJWagner•8m ago•1 comments

Don't Lie to Us, Finland: The Happiness Report Has a Problem

https://mikesbalance.com/lie-to-me-world-happiness-report/
1•speckx•9m ago•1 comments

$3B to 0: Blur, once the top NFT marketplace, is shutting down. I designed it

https://sortino.co/writing/from-0-to-3-billion-to-zero
1•joshuasortino•10m ago•0 comments

Show HN: Turnus – find cron, launchd and systemd jobs that won't run, and why

https://github.com/sanifhimani/turnus
1•sanifhimani•11m ago•0 comments

Woodpecker

https://woodpecker.everydaymactools.com/
1•bookofjoe•12m ago•0 comments

UniXNU – Run iOS and macOS on Non-Apple ARM64 Hardware Through UEFI

https://github.com/UniXNU/UniXNU
1•reimertz•12m ago•0 comments

Show HN: Skyloons – a balloon-popping Android game, 1,000 levels, works offline

https://play.google.com/store/apps/details?id=com.maniar.balloonpopquest&hl=en_US
1•connectmaniar•12m ago•0 comments

Show HN: Nekolike – a coin pusher roguelike you rebuild between floors

https://pickthewheel.com/nekolike-coin-pusher/
2•gigipandora•14m ago•0 comments

CAP theorem explained using Desi Metaphors

https://abhishekco.de/posts/cap-theorem-explained-bollywood-cricket-examples
1•fantasticwaddle•16m ago•0 comments

Sydney researchers uncover a hidden limit to AI predictability

https://www.sydney.edu.au/news-opinion/news/2026/11/06/sydney-researchers-uncover-a-hidden-limit-...
3•wjSgoWPm5bWAhXB•16m ago•0 comments

Product managers are (expensive) search functions with taste

https://www.theycallmesam.com/p/product-managers-were-expensive-search
1•01sadrasam•17m ago•0 comments

Ukraine's Fiber-Optic Drones Compete with Data Centers for Optical Fiber Supply

https://epyhia.com/ukraine-s-fiber-optic-drones-compete-with-ai-data-centers-for-china-s
1•arbuge•17m ago•0 comments

Show HN: pvewarden – let an AI agent patch Proxmox VMs without giving it a shell

https://github.com/matousfiser/pvewarden
1•mattyhunter•18m ago•0 comments

The natural alliance of everyone else

https://nonzerosum.games/naturalalliance.html
2•marjancek•18m ago•1 comments

Claude Fable 5.2, one day later [video]

https://twitter.com/xhenrikkvamme/status/2120137440169984242
2•henrikkvamme•18m ago•1 comments

29M Japanese Buildings

https://tech.marksblogg.com/japanese-building-footprints.html
2•marklit•18m ago•0 comments

Theory predicting an older Universe passes key cosmological tests

https://www.uottawa.ca/faculty-science/news-all/theory-predicting-older-universe-without-dark-mat...
3•wjSgoWPm5bWAhXB•18m ago•1 comments

Show HN: GuestVine – follow a person across every podcast they guest on

https://guestvine.fm
1•paulreaney•18m ago•0 comments

Show HN: Kafuck – Apache Kafka Rewritten in Brainfuck

https://github.com/rmoff/kafuck/
1•rmoff•19m ago•0 comments

Show HN: TeamOnly, free hosting for AI-built apps behind your company login

https://teamonly.dev/
1•xoail•19m ago•0 comments

Show HN: Todaypad – a day planner that stores everything in the browser

https://todaypad.vercel.app
1•dictionarysucks•20m ago•0 comments

Can a Dutch language model support journalists while preserving publicitations

https://www.tno.nl/en/newsroom/insights/2026/11/dpg-media-gpt-nl-test-newsroom/
1•HelloUsername•22m ago•0 comments