Created
February 1, 2019 01:40
-
-
Save categulario/5413cbc79702b2bf7c5c5d3dc3aefe9a to your computer and use it in GitHub Desktop.
Sample rust file
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
struct Matrix { | |
contents: Vec<f64>, | |
filas: usize, | |
columnas: usize, | |
} | |
impl Matrix { | |
fn new(filas: usize, columnas: usize) { | |
Matrix { | |
} | |
} | |
fn random(filas: usize, columnas: usize) -> Matrix { | |
} | |
} | |
fn dot(m1: Matrix, m2: Matrix) -> Matrix { | |
} | |
fn multiplicar(m1: &[f64], m2: &[f64]) -> Vec<f64> { | |
assert_eq!(m1.len(), m2.len()); | |
let mut result = Vec::with_capacity(m1.len()); | |
for (i, j) in m1.iter().zip(m2.iter()) { | |
result.push(i*j); | |
} | |
result | |
} | |
fn main() { | |
let m = Matrix::random(4, 5); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment