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
py.python_import("pylab","plot"); | |
py.python_import("pylab","savefig"); | |
vector<float> rand; | |
py.__py("import numpy as np; import pylab"); | |
// create an arbitrary list in python and extra |
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
auto thing = dynamic_cast<derived_type*>(object->GetBaseObject()); | |
if(thing!=nullptr) { | |
thing->MethodOfDerivedClass(); | |
} |
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
Set width of integer output: | |
#include <iostream> | |
#include <iomanip> | |
int main() { | |
cout << setfill('0') << setw(2) << 5 << endl; | |
return 0; | |
} |
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 <iostream> | |
using namespace std; | |
class B { | |
public: | |
B() {x = 0;} | |
~B() {;} | |
int 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
#!/bin/sh | |
### name of job | |
#PBS -N JOB_NAME | |
### email on _a_bort, _b_egin, _e_nd | |
#PBS -m abe | |
### combine stdout/stderr | |
#PBS -j oe | |
### resource requests (time in HH:MM:SS) | |
#PBS -l walltime=99:00:00 | |
### dont retry |
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
In the ANL data format, I observe that the hexidecimal divider 0xaaaaaaaa does not appear in the raw data format. | |
e.g. | |
ANL: | |
00000000: 0e00 0000 4000 0000 9c21 e6cc 8301 0000 ....@....!...... | |
00000010: 1810 0711 cce6 219c 7001 0183 99c9 0000 ......!.p....... | |
00000020: 0181 f385 0080 398e 0000 0000 c42b d4da ......9......+.. | |
00000030: 0000 2be6 0000 0000 2007 2019 200c 2023 ..+..... . . . # | |
00000040: 200e 0000 2003 2005 1ff9 1ff9 1fed 1ff6 ... . ......... |
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
import numpy as np | |
def get_ame_masses(path): | |
masses = np.zeros((400,400)) | |
for line in open(path): |
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 <iostream> | |
using namespace std; | |
class Base { | |
public: | |
Base(){;} | |
virtual ~Base(){;} | |
void Func() { | |
cout << "Base::Func" << endl; |
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
// Function template constraint (implicit or "ad-hoc") | |
template<typename T> requires | |
requires (T a) { a + a; } && | |
requires (T b) { b * b; } && | |
requires (T c) { sqrt(c); } | |
T Magnitude(vector<T>&& vec) { | |
T sum; | |
for (auto& const i : vec) { sum += i*i; } | |
return sqrt(sum); |
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
S - Set of all nodes with no inbound connections (NodeType::Input) | |
-- Enumerating all paths | |
paths = {} | |
for each node n in S do | |
visit(n,{}) | |
function visit(node n, list l) | |
if n is not in l then |
OlderNewer