Created
April 2, 2020 12:27
-
-
Save phasetr/46f07a835c4ab01000cf33e537114579 to your computer and use it in GitHub Desktop.
rust ndarray
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-deps: serde, serde_derive, serde_yaml, ndarray | |
extern crate ndarray; | |
extern crate serde; | |
use ndarray::array; | |
use ndarray::prelude::*; | |
use ndarray::Array; | |
use ndarray::Array1; | |
fn main() { | |
let arr1: Array1<f64> = array![1.0, 2.0, 3.0, 4.0]; | |
let arr2: Array1<f64> = array![5.0, 6.0, 7.0, 8.0]; | |
let mut arr_sum1: Array1<f64> = Array::zeros(4); | |
println!("{}", &arr_sum1); | |
arr_sum1.slice(s![0..2]) = &arr1.slice(s![1..3]) + &arr2.slice(s![2..4]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
出てくるエラーは次の通り。