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
% cargo run -- -a | |
Compiling clap v2.20.0 | |
Compiling clap-group v0.1.0 (file:///home/janis/code/scrap/rust/clap-group) | |
warning: unused variable: `matches`, #[warn(unused_variables)] on by default | |
--> main.rs:7:9 | |
| | |
7 | let matches = App::new("myapp") | |
| ^^^^^^^ | |
Finished dev [unoptimized + debuginfo] target(s) in 21.31 secs |
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
pub trait OptionResultExt { | |
type Out; | |
fn invert(self) -> Self::Out; | |
} | |
impl<T, E> OptionResultExt for Option<Result<T, E>> { | |
type Out = Result<Option<T>, E>; | |
fn invert(self) -> Self::Out { |
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
let time_progression = match sim_config.progression { | |
StepProgression::Linear => vec![sim_config.t; sim_config.nt], | |
StepProgression::Exponential => { | |
(0..sim_config.nt) | |
.map(|x| sim_config.t * 2f64.powi(x as i32)) | |
.collect::<Vec<_>>() | |
}, | |
}; | |
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
fn deserialize_to_last<S: io::Seek + io::Read>(stream: &mut S) -> Result<Self, bincode::serde::DeserializeError> { | |
use bincode::serde::{Deserializer,DeserializeError}; | |
let mut deserializer = Deserializer::new(stream, bincode::SizeLimit::Infinite); | |
let mut input: DeserializationStruct = Deserialize::deserialize(&mut deserializer)?; | |
loop { | |
#[cfg(debug_assertions)] | |
println!("{:?}", input); | |
input = match Deserialize::deserialize(&mut deserializer) { |
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
extern crate approx; | |
extern crate time; | |
use approx::ApproxEq; | |
use std::f64; | |
fn relative_eq(a: &f64, b: &f64, epsilon: f64, max_relative: f64) -> bool { | |
// Copied straight from approx | |
if a == b { return true; } |
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
#[macro_use(s)] extern crate ndarray; | |
#[macro_use] extern crate itertools; | |
use ndarray::{Array,OwnedArray}; | |
fn main() { | |
let r = 0..16; | |
let v = r.map(|x| x as f64).collect::<Vec<_>>(); | |
// Works |
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 std::ops::{Add,Mul}; | |
pub trait ODE { | |
type State; | |
fn get_state(&self) -> &Self::State; | |
fn differentiate(&self, &Self::State) -> Self::State; | |
fn differentiate_into(&self, &Self::State, &mut Self::State); | |
fn update_state(&mut self, &Self::State); |
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
# Current maintainer: Janis Beckert <janis.beckert at gmail.com> | |
# Original maintainer: Thomas Dziedzic < gostrc at gmail > | |
# Modified by: Cristóvão D. Sousa <crisjss@gmail.com> | |
# Modified by: Santi Villalba <sdvillal@gmail.com> | |
# Modified by: Janis Beckert <janis.beckert at gmail.com> | |
pkgbase=python-theano | |
pkgname=(python-theano python2-theano) | |
pkgver=0.7.0 | |
pkgrel=3 |
NewerOlder