Skip to content

Instantly share code, notes, and snippets.

View Ziaeemehr's full-sized avatar
💭
Women-Life-Freedom✌️

Abolfazl Ziaeemehr Ziaeemehr

💭
Women-Life-Freedom✌️
View GitHub Profile
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,
@Ziaeemehr
Ziaeemehr / main.cpp
Last active December 20, 2024 16:40
#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>
@Ziaeemehr
Ziaeemehr / kalimba.py
Last active August 18, 2024 09:55
Convert Kalimba notes CHAR<->NUM
# 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
import numpy as np
x = np.fromfile("X.bin", dtype=float, count=-1)
# dtype: float for double,
# np.uint32 for integer.
// 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();