Skip to content

Instantly share code, notes, and snippets.

View activexray's full-sized avatar
🏳️‍⚧️

Kira activexray

🏳️‍⚧️
View GitHub Profile
@activexray
activexray / cpp-dev-env-flake.nix
Created January 11, 2025 23:27 — forked from fufexan/cpp-dev-env-flake.nix
C/C++ dev environment in Nix, using Clang
{
description = "C/C++ environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils, ... }@inputs:
utils.lib.eachDefaultSystem (
@activexray
activexray / enzyme_nlopt.rs
Last active March 18, 2025 21:14
Rust/Enzyme example with NLOpt FFI
//! Following https://nlopt.readthedocs.io/en/latest/NLopt_Tutorial/
#![feature(autodiff)]
use nlopt::*;
use std::autodiff::autodiff;
#[autodiff(df, Reverse, Duplicated, Active)]
fn f(x: &[f64]) -> f64 {
x[1].sqrt()
}