This file contains 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 <optional> | |
#include <cmath> | |
////////////////////////////////////////////////////////////////////////// | |
/// ElasticModuli class implementing the conversion table at | |
/// https://en.wikipedia.org/wiki/Elastic_modulus | |
/// | |
/// Setting any two input parameters will calculate the remaining four. | |
/// | |
////////////////////////////////////////////////////////////////////////// |
This file contains 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 semanticscholar import SemanticScholar | |
from collections import defaultdict | |
from tqdm import tqdm | |
import sys | |
import os | |
s2_api_key = 'replaceme' | |
sch = SemanticScholar(timeout=10,api_key=s2_api_key) | |
print("Connected to SemanticScholar") |
This file contains 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
// Adapted from ADOL-C/examples/additional_examples/sparse/sparse_hessian.cpp | |
#include <math.h> | |
#include <cstdlib> | |
#include <cstdio> | |
#include <adolc/adolc.h> | |
#include <adolc/adolc_sparse.h> | |
#define tag 1 |
This file contains 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
# May need to have python 3.10 or higher installed | |
# Use blender to convert .gltf file to .obj file | |
# | |
import bpy | |
import sys | |
# Get the arguments passed to the script, skipping the first three | |
# sys.argv[0] is blender's executable, sys.argv[1] is '-P', sys.argv[2] is the script name | |
args = sys.argv[1:] |
This file contains 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
// https://github.com/autodiff/autodiff/issues/179 | |
#define FORWARD | |
#ifdef FORWARD | |
#include <autodiff/forward/dual.hpp> | |
#else | |
#include <autodiff/reverse/var.hpp> | |
#endif | |
#include <complex> | |
template <typename T> T f(const T & x) |
This file contains 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
// requires -std=c++17 | |
#include <stdio.h> | |
#include <autodiff/forward/real.hpp> // https://github.com/autodiff/autodiff/ | |
/// Take a gradient descent step at a given function | |
/// | |
/// @tparam FuncType should be an auto-lambda (i.e., `[](auto x)->auto{…}`) | |
/// @param[in] func scalar function | |
/// @param[in] initial_guess initial input to func | |
/// @return initial_guess - dfdx where dfdx is the derivative of func at initial_guess |
This file contains 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 <cmath> | |
#include <cstdio> | |
float angle_via_law_of_cosines(float a, float b, float c) | |
{ | |
return std::acos( (b+a-c) / (float(2)*std::sqrt(b*a)) ); | |
} | |
float angle_via_kahan(float a, float b, float c) | |
{ |
This file contains 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
diff --git a/CMakeLists.txt b/CMakeLists.txt | |
index 8801572..a4ab77b 100644 | |
--- a/CMakeLists.txt | |
+++ b/CMakeLists.txt | |
@@ -21,9 +21,11 @@ include(FeatureSummary) # More verbose Output for libraries using set_package_pr | |
# Look for supporting libraries | |
# ----------------------------- | |
-find_package(Eigen3 NO_MODULE REQUIRED) | |
-set_package_properties(Eigen3 PROPERTIES TYPE REQUIRED PURPOSE "C++ vector data structures") |
This file contains 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
# HG changeset patch | |
# User Torbjorn Granlund <[email protected]> | |
# Date 1606685500 -3600 | |
# Node ID 5f32dbc41afc1f8cd77af1614f0caeb24deb7d7b | |
# Parent 94c84d919f83ba963ed1809f8e80c7bef32db55c | |
Avoid the x18 register since it is reserved on Darwin. | |
diff -r 94c84d919f83 -r 5f32dbc41afc mpn/arm64/aors_n.asm | |
--- a/mpn/arm64/aors_n.asm Sat Nov 28 23:38:32 2020 +0100 |
This file contains 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
# https://stackoverflow.com/a/51164950/148668 | |
# | |
# python3 -m pip install gtts playsound pyobjc | |
from gtts import gTTS | |
import sys | |
from io import BytesIO | |
import objc | |
import playsound | |
import tempfile | |
import argparse |
NewerOlder