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
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMXOdolllodkOKNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNx. cxXMMMMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWo ........ .xNMMMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMO. ................ oNMMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMMx ..................... dMMMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMMd ........................ ;WMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMMk .......................... .NMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMMMMO ............................. ;WMMMMMMMMMMMMMMMMMM |
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 | |
from numba import jit, int32 | |
from numpy.random import default_rng | |
rng = default_rng() | |
def startHands(numplayers, cards=4): | |
return np.stack((cards * np.ones((numplayers,)), np.ones((numplayers,)))) |
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
use ndarray::{azip, par_azip, s, Array, Array1, Axis, IntoNdProducer}; | |
use std::ops::{DivAssign, MulAssign, SubAssign}; | |
pub fn gauss_elim_rust(N: usize, M: usize, A: &mut [f32], B: &mut [f32]) { | |
assert_eq!(A.len(), N * N); | |
assert_eq!(B.len(), N * M); | |
for k in 0..(N - 1) { | |
let akk = A[k * N + k]; |
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 "gausselim.hpp" | |
#define A(I, J) (A_[I * N + J]) | |
#define B(I, J) (B_[I * M + J]) | |
void gauss_elim(int N, int M, float* restrict A_, float* restrict B_) { | |
for (int k = 0; k < N - 1; k++) { | |
for (int i = k + 1; i < N; i++) { | |
A(i, k) /= A(k, k); | |
} |
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
use ndarray::{Axis, IntoNdProducer, azip, par_azip, s}; | |
use std::ops::{DivAssign, SubAssign, MulAssign}; | |
pub fn gauss_elim(mut A: ndarray::ArrayViewMut2<f32>, mut B: ndarray::ArrayViewMut2<f32>) { | |
assert_eq!(A.nrows(), B.nrows()); | |
assert_eq!(A.nrows(), A.ncols()); | |
let N = A.nrows(); | |
let M = B.ncols(); |
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
cmake_minimum_required(VERSION 3.19) | |
project(PROJ1) | |
set(CMAKE_CXX_STANDARD 20) | |
set(CMAKE_C_STANDARD 11) | |
set(CMAKE_C_STANDARD_REQUIRED True) | |
set(CMAKE_CXX_STANDARD_REQUIRED True) | |
set(CMAKE_CXX_EXTENSIONS ON) | |
set(CMAKE_C_EXTENSIONS ON) |
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 <stdarg.h> | |
#include "oled.h" | |
#define FONT_WIDTH 5 | |
#define FONT_HEIGHT 8 | |
#include "oled_font.h" | |
#define RES_128X64 | |
#ifdef RES_128X64 |
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 | |
import random | |
import matplotlib.pyplot as plt | |
import itertools | |
import simpsons_paradox_data as simp_para_data | |
def run(): | |
print(bernoulli(0.6)) |
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
//Server implemented as Trait to allow various forms of handling | |
pub trait Server | |
where Self: Send { | |
fn get_response(&self, &String) -> Option<String>; //Takes a message and returns a response | |
fn acceptor(&self) -> TcpAcceptor; | |
fn new(address: &str) -> Self; | |
fn start(&self) { | |
for stream in self.acceptor().incoming() { |