Inheritance and Virtual Table are often used to create interface in C++ polymorphic class
What if ... there were another way to do this ?
easier, cleaner, faster and more reliable
This article explains how to useCRTP
, [std::variant
](https://en.cppreference.com/w/cpp/utility/variant andstd::visit
to increase code performance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Setup PkgConfig (Windows) | |
if: runner.os == 'Windows' | |
env: | |
PKG_CONFIG_ZIP: "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip" | |
GETTEXT_RUNTIME_ZIP: "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip" | |
GLIB_ZIP: "http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip" | |
run: | | |
curl -LO "${{ env.PKG_CONFIG_ZIP }}" | |
7z x pkg-config_0.26-1_win32.zip -oC:\MinGW\bin pkg-config.exe | |
curl -LO "${{ env.GETTEXT_RUNTIME_ZIP }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bazel run --tool_tag=ijwb:CLion --curses=no --color=yes --progress_in_terminal_title=no -- //odin/examples:example_autodiff_stts | |
WARNING: ======================================================== | |
WARNING: || || | |
WARNING: || ██████╗ ██████╗ ██████╗ || | |
WARNING: || ██╔══██╗██╔═══██╗██╔══██╗ || | |
WARNING: || ██████╔╝██║ ██║██████╔╝ || | |
WARNING: || ██╔══██╗██║ ██║██╔══██╗ || | |
WARNING: || ██████╔╝╚██████╔╝██║ ██║ || | |
WARNING: || ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ || | |
WARNING: || || |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// include for size_t | |
#include <Eigen/Core> | |
#include <tuple> | |
//#include <unsupported/Eigen/CXX11/Tensor> | |
//#ifdef ODIN_AUTODIFF | |
//#define ODIN_CONST | |
#include <autodiff/forward/dual.hpp> | |
#include <autodiff/forward/dual/eigen.hpp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy import symbols, Matrix, diff, lambdify | |
import numpy as np | |
# Compute the 1st-order State Transition Tensor | |
def dfdx(eom, wrt, at): | |
u = eom.subs(at).evalf() | |
m = len(u) if hasattr(u, "__len__") else 1 | |
n = len(wrt) | |
t2 = np.zeros((m, n)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Symbolic, auto differentiated implementation of the STTS in [1] | |
References: | |
[1] https://arc.aiaa.org/doi/full/10.2514/1.G003897 | |
""" | |
import itertools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env gawk -f | |
# deno_dependency_analyzer.awk | |
# | |
# Usage: | |
# deno info --import-map ./import_map.json <your_deno_script>.ts | gawk -f deno_dependency_analyzer.awk | |
# | |
# Description: | |
# This Gawk script parses the output from 'deno info', extracts dependencies along with their sizes, | |
# converts all sizes to megabytes (MB), aggregates sizes by unique paths, and lists the top 10 largest | |
# dependencies sorted by size in descending order. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env gawk -f | |
# deno_dependency_analyzer.sh | |
# | |
# Description: | |
# This Gawk script parses the output from 'deno info', extracts dependencies along with their sizes, | |
# converts all sizes to megabytes (MB), aggregates sizes by unique paths, and lists the top 10 largest | |
# dependencies sorted by size in descending order. | |
# Execute 'deno info' with provided import map and script, and process the output with gawk | |
deno info --import-map "$IMPORT_MAP" "$DENO_SCRIPT" | gawk ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# 1. If .rust-channel exists, read it; otherwise default to stable | |
if [ -f .rust-channel ]; then | |
RUST_CHANNEL="$(cat .rust-channel)" | |
else | |
RUST_CHANNEL="stable" | |
fi | |
# 2. Validate the channel; if it's not "nightly", assume stable |
OlderNewer