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
def get_balloon_parameters(self): | |
"""get balloon model parameters.""" | |
alpha = 0.32 | |
E0 = 0.4 | |
eps = 0.5 | |
par = { | |
"eps": eps, | |
"E0": 0.4, | |
"V0": 4.0, |
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 <iostream> | |
#include <vector> | |
#include <immintrin.h> // For SIMD intrinsics (optional for AVX/AVX2) | |
#include <string> | |
#include <random> | |
#include <assert.h> | |
#include <algorithm> | |
#include <sys/stat.h> | |
#include <unistd.h> |
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
# Function to convert musical notes to numerical values | |
def convert_notes_to_numbers(notes): | |
''' | |
Convert characters to numbers, keeping the punctuation unchanged | |
Parameters | |
---------- | |
notes: str - the string of notes to convert | |
Returns |
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 | |
x = np.fromfile("X.bin", dtype=float, count=-1) | |
# dtype: float for double, | |
# np.uint32 for integer. |
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
// open file as binary: | |
std::ofstream oX((path + "/X.bin").c_str(), std::ios::out | std::ios::binary); | |
// write a vector into the file | |
oX.write((char *)&x[0], x.size() * sizeof x[0]); | |
// close the file | |
oX.close(); |