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
use num::bigint::BigInt; | |
use num::cast::ToPrimitive; | |
use num::integer::binomial; | |
use num::one; | |
use num::pow::Pow; | |
use num::zero; | |
use std::collections::VecDeque; | |
#[derive(Copy, Clone, PartialEq, Eq, Debug)] | |
enum Color { |
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
unsafe fn part_1<'a>( | |
right_side: &[[usize; N]], | |
matching: &BiMatching, | |
not_marked_left: &mut Vec<bool>, | |
weights: &'a [BigUint], | |
highest: &mut &'a BigUint, | |
result: &mut Vec<usize>, | |
rn: usize, | |
) { | |
let mut stack: Vec<(usize, usize, usize)> = vec![(0, rn, matching.left_to_right.len())]; |
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
use num::integer::binomial; | |
use std::cmp::Ordering; | |
fn next(x: &mut Vec<usize>) -> bool { | |
let mut i = x.len(); | |
while i > 0 { | |
i -= 1; | |
if x[i] > 0 { | |
x[i] -= 1; | |
i += 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
const N: usize = 2; | |
const P: usize = 6; | |
fn main() { | |
for k in 0..P { | |
for i in 0..N { | |
for j in 0..N { | |
println!("(declare-const p{}a{}{} Bool)", k, i, j); | |
println!("(declare-const p{}b{}{} Bool)", k, i, j); | |
} |
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
use ordered_float::OrderedFloat; | |
const N: usize = 2; | |
const M: usize = 2; | |
const K: usize = 2; | |
const P: usize = 7; | |
fn main() { | |
let mut pstate: [([[bool; K]; N], [[bool; M]; K]); P] = [([[false; K]; N], [[false; M]; K]); P]; | |
let mut cstate: [[[bool; P]; M]; N] = [[[false; P]; M]; N]; |
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
LIBRARY ieee; | |
USE ieee.std_logic_1164.all; | |
ENTITY mux2to1 IS | |
PORT( w0, w1, s : IN STD_LOGIC; | |
f : OUT STD_LOGIC); | |
END mux2to1; | |
ARCHITECTURE dataflow OF mux2to1 IS | |
BEGIN |
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 Data.Maybe | |
import Data.List | |
data SET v = Empty | |
| Singleton (SET v) | |
| Union (SET v) (SET v) | |
| Intersection (SET v) (SET v) | |
| Var v | |
data PRED v = Elem v (SET v) |
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
use rand::prelude::*; | |
use std::{fs::File, io::Write, process::Command}; | |
fn naive(f: &mut File) -> Result<(), std::io::Error> { | |
// Declarations | |
for i in 0..9 { | |
for j in 0..9 { | |
writeln!(f, "(declare-const |{}:{}| Int)", i, j)?; | |
writeln!(f, "(assert (<= |{}:{}| 9))", i, j)?; | |
writeln!(f, "(assert (<= 1 |{}:{}|))", i, j)?; |
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
use rayon::prelude::*; | |
const N: usize = 8; | |
// 2, 3 | |
// 3, 11 | |
// 4, 54 | |
// 5, 365 | |
// 6, 3848 | |
// 7, 68914 |
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 "TinyTimber.h" | |
#include "canTinyTimber.h" | |
// #define __CAN_LOOPBACK // Note: requires physical loopback between CAN 1 and 2 jacks | |
void DUMP(char *s); | |
// | |
// Initialize CAN controller | |
// |
OlderNewer