πͺ
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
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| w = 400 | |
| h = 300 | |
| def normalize(x): | |
| x /= np.linalg.norm(x) | |
| return x |
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 <Eigen/Core> | |
| #include <Eigen/Sparse> | |
| using namespace std; | |
| using namespace Eigen; | |
| void sinitialize(VectorXd &s,double mu,unsigned int sizex,VectorXd &x) | |
| { | |
| for (unsigned int i=0;i<sizex;i++) | |
| if (x[i]!=0)s[i] = mu/x[i]; | |
| else s[i]=0.1; |
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 <cstdio> | |
| class IntBuff { | |
| public: | |
| IntBuff() = default; | |
| explicit IntBuff(size_t sz) : sz(sz) { | |
| if (sz) { | |
| arr = new int[sz]; | |
| } | |
| }; |
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 <algorithm> | |
| #include <cstdio> | |
| #include <memory> | |
| class IntBuff { | |
| public: | |
| IntBuff() = default; | |
| explicit IntBuff(size_t sz) : sz(sz) { | |
| if (sz) { | |
| arr = new int[sz]; |
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 <algorithm> | |
| #include <cstdio> | |
| #include <memory> | |
| class IntBuff { | |
| public: | |
| IntBuff() = default; | |
| explicit IntBuff(size_t sz) : sz(sz) { | |
| if (sz) { | |
| arr = new int[sz]; |
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 <algorithm> | |
| #include <cstdio> | |
| #include <memory> | |
| class IntBuff { | |
| public: | |
| IntBuff() = default; | |
| explicit IntBuff(size_t sz) : sz(sz) { | |
| if (sz) { | |
| arr = std::unique_ptr<int[]>(new int[sz]); |
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 <llvm/IR/Function.h> | |
| #include <llvm/IR/IRBuilder.h> | |
| #include <llvm/IR/LLVMContext.h> | |
| #include <llvm/IR/Module.h> | |
| #include <llvm/IR/Value.h> | |
| #include <llvm/Support/raw_os_ostream.h> | |
| #include <memory> | |
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
| package main | |
| import ( | |
| _ "embed" | |
| ) | |
| //go:embed main.go | |
| var s string | |
| func main() { |
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
| import signal, time | |
| class InterruptSleep(Exception): | |
| pass | |
| def main(): | |
| while True: | |
| try: | |
| time.sleep(60) | |
| except InterruptSleep: |
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
| import threading, signal | |
| exit = threading.Event() | |
| def main(): | |
| while not exit.is_set(): | |
| exit.wait(60) | |
| def quit(signo, frame): | |
| exit.set() |