Skip to content

Instantly share code, notes, and snippets.

@categulario
Created February 1, 2019 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save categulario/5413cbc79702b2bf7c5c5d3dc3aefe9a to your computer and use it in GitHub Desktop.
Save categulario/5413cbc79702b2bf7c5c5d3dc3aefe9a to your computer and use it in GitHub Desktop.
Sample rust file
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