simple/
simple.rs

1//
2// Copyright (c) 2025 Ɓukasz Szpakowski
3//
4// This Source Code Form is subject to the terms of the Mozilla Public
5// License, v. 2.0. If a copy of the MPL was not distributed with this
6// file, You can obtain one at https://mozilla.org/MPL/2.0/.
7//
8use unmtx_gpu::matrix;
9
10fn main()
11{
12    let a = matrix![
13        [1.0, 2.0, 3.0],
14        [4.0, 5.0, 6.0],
15        [7.0, 8.0, 9.0]
16    ];
17    let b = matrix![
18        [1.0, 4.0, 7.0],
19        [2.0, 5.0, 8.0],
20        [3.0, 6.0, 9.0]
21    ];
22    let c = a * b;
23    let elems = c.elems();
24    for i in 0..c.row_count() {
25        for j in 0..c.col_count() {
26            print!("\t{}", elems[i * c.col_count() + j]);
27        }
28        println!("");
29    }
30}