mirror of https://github.com/E-Almqvist/hsf
parent
d450208de4
commit
71be35d0b0
@ -0,0 +1,7 @@ |
|||||||
|
# This file is automatically @generated by Cargo. |
||||||
|
# It is not intended for manual editing. |
||||||
|
version = 3 |
||||||
|
|
||||||
|
[[package]] |
||||||
|
name = "rust-matrix" |
||||||
|
version = "0.1.0" |
@ -0,0 +1,31 @@ |
|||||||
|
mod ematrix { |
||||||
|
#[derive(Debug)] |
||||||
|
pub struct Matrix { |
||||||
|
cols: u32, |
||||||
|
rows: u32, |
||||||
|
col_vecs: Vec<Vec<f64>> |
||||||
|
} |
||||||
|
|
||||||
|
pub fn zero_vec(size: u32) -> Vec<f64> { |
||||||
|
let mut zero_vec: Vec<f64> = Vec::with_capacity(size as usize); // create template vec
|
||||||
|
for i in 0..size { zero_vec.push(0.0); } // push 0 to vec
|
||||||
|
return zero_vec; |
||||||
|
} |
||||||
|
|
||||||
|
impl Matrix { |
||||||
|
fn zero(&self, cols: u32, rows: u32) { |
||||||
|
let mut col_vecs: Vec<Vec<f64>> = Vec::with_capacity(cols as usize); |
||||||
|
for j in 0..cols {col_vecs.push( zero_vec(rows) );} |
||||||
|
|
||||||
|
Matrix { |
||||||
|
cols: cols, |
||||||
|
rows: rows, |
||||||
|
col_vecs: col_vecs |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
fn set(&self, col: u32, row: u32, val: f64) { |
||||||
|
self[col][row] = val; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,3 +1,6 @@ |
|||||||
|
mod ematrix; |
||||||
|
|
||||||
fn main() { |
fn main() { |
||||||
println!("Hello, world!"); |
println!("MATRIX TESTS"); |
||||||
|
let mut my_mat = ematrix::Matrix.zero(2, 2); |
||||||
} |
} |
||||||
|
@ -0,0 +1 @@ |
|||||||
|
{"rustc_fingerprint":6638864301609445754,"outputs":{"5309432699494263626":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n","stderr":""},"931469667778813386":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/usr\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"2797684049618456168":{"success":false,"status":"exit status: 1","code":1,"stdout":"","stderr":"error: `-Csplit-debuginfo` is unstable on this platform\n\n"},"17598535894874457435":{"success":true,"status":"","code":0,"stdout":"rustc 1.59.0 (Arch Linux rust 1:1.59.0-1)\nbinary: rustc\ncommit-hash: unknown\ncommit-date: unknown\nhost: x86_64-unknown-linux-gnu\nrelease: 1.59.0\nLLVM version: 13.0.1\n","stderr":""}},"successes":{}} |
@ -0,0 +1,3 @@ |
|||||||
|
Signature: 8a477f597d28d172789f06886806bc55 |
||||||
|
# This file is a cache directory tag created by cargo. |
||||||
|
# For information about cache directory tags see https://bford.info/cachedir/ |
@ -0,0 +1 @@ |
|||||||
|
{"rustc":7235102058043137102,"features":"[]","target":354133231530791879,"profile":9251013656241001069,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/rust-matrix-7e99d1ac027c777a/dep-bin-rust-matrix"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0} |
Binary file not shown.
@ -0,0 +1 @@ |
|||||||
|
This file has an mtime of when this was started. |
@ -0,0 +1,3 @@ |
|||||||
|
{"message":"cannot find value `Matrix` in module `ematrix`","code":{"code":"E0425","explanation":"An unresolved name was used.\n\nErroneous code examples:\n\n```compile_fail,E0425\nsomething_that_doesnt_exist::foo;\n// error: unresolved name `something_that_doesnt_exist::foo`\n\n// or:\n\ntrait Foo {\n fn bar() {\n Self; // error: unresolved name `Self`\n }\n}\n\n// or:\n\nlet x = unknown_variable; // error: unresolved name `unknown_variable`\n```\n\nPlease verify that the name wasn't misspelled and ensure that the\nidentifier being referred to is valid for the given situation. Example:\n\n```\nenum something_that_does_exist {\n Foo,\n}\n```\n\nOr:\n\n```\nmod something_that_does_exist {\n pub static foo : i32 = 0i32;\n}\n\nsomething_that_does_exist::foo; // ok!\n```\n\nOr:\n\n```\nlet unknown_variable = 12u32;\nlet x = unknown_variable; // ok!\n```\n\nIf the item is not defined in the current module, it must be imported using a\n`use` statement, like so:\n\n```\n# mod foo { pub fn bar() {} }\n# fn main() {\nuse foo::bar;\nbar();\n# }\n```\n\nIf the item you are importing is not defined in some super-module of the\ncurrent module, then it must also be declared as public (e.g., `pub fn`).\n"},"level":"error","spans":[{"file_name":"src/main.rs","byte_start":86,"byte_end":92,"line_start":5,"line_end":5,"column_start":31,"column_end":37,"is_primary":true,"text":[{"text":" let mut my_mat = ematrix::Matrix.zero(2, 2);","highlight_start":31,"highlight_end":37}],"label":"not found in `ematrix`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror[E0425]\u001b[0m\u001b[0m\u001b[1m: cannot find value `Matrix` in module `ematrix`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:5:31\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m5\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let mut my_mat = ematrix::Matrix.zero(2, 2);\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mnot found in `ematrix`\u001b[0m\n\n"} |
||||||
|
{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to previous error\u001b[0m\n\n"} |
||||||
|
{"message":"For more information about this error, try `rustc --explain E0425`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1mFor more information about this error, try `rustc --explain E0425`.\u001b[0m\n"} |
Binary file not shown.
@ -0,0 +1,6 @@ |
|||||||
|
/home/elal/Projects/school/prog2/mas/rust-matrix/target/debug/deps/rust_matrix-7e99d1ac027c777a: src/main.rs src/ematrix.rs |
||||||
|
|
||||||
|
/home/elal/Projects/school/prog2/mas/rust-matrix/target/debug/deps/rust_matrix-7e99d1ac027c777a.d: src/main.rs src/ematrix.rs |
||||||
|
|
||||||
|
src/main.rs: |
||||||
|
src/ematrix.rs: |
Binary file not shown.
@ -0,0 +1 @@ |
|||||||
|
/home/elal/Projects/school/prog2/mas/rust-matrix/target/debug/rust-matrix: /home/elal/Projects/school/prog2/mas/rust-matrix/src/ematrix.rs /home/elal/Projects/school/prog2/mas/rust-matrix/src/main.rs |
Loading…
Reference in new issue