Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ version = "0.1.0"
edition = "2024"

[dependencies]
rayon = "1.12.0"
4 changes: 3 additions & 1 deletion rust/docs/matrix/add.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
同じサイズの行列同士の要素ごとの加算を行います。
* サイズが異なる行列同士の加算はエラーを返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/add_assign.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
同じサイズの行列同士の要素ごとの加算を行います。
* サイズが異なる行列同士の加算はパニックを引き起こします。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/add_trait.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
同じサイズの行列同士の要素ごとの加算を行います。
* サイズが異なる行列同士の加算はNoneを返します。

# Examples
```

```rust
use matrix::Matrix;
let m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/add_with.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
同じサイズの行列同士の要素ごとの加算を行います。
* サイズが異なる行列同士の加算はエラーを返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/col_iter.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
指定した列の要素への参照を返します。

# Examples
```

```rust
use matrix::Matrix;
let m: Matrix<i32> = Matrix::with_size(2, 2);
assert_eq!(m.col_iter(0).unwrap().collect::<Vec<&i32>>(), vec![&0, &0]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
指定した列の要素への可変参照を返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m: Matrix<i32> = Matrix::with_size(2, 2);
if let Some(col_iter) = m.col_mut_iter(0) {
if let Some(col_iter) = m.col_iter_mut(0) {
col_iter.for_each(|val| *val = 42);
}
assert_eq!(m.col_iter(0).unwrap().collect::<Vec<&i32>>(), vec![&42, &42]);
Expand Down
13 changes: 13 additions & 0 deletions rust/docs/matrix/col_par_iter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
指定した列の要素への並列参照を返します。
このイテレータは、列の要素への可変参照を返します。

# Examples

```rust
use matrix::Matrix;
let mut m: Matrix<i32> = Matrix::with_size(2, 2);
if let Some(col_iter) = m.col_par_iter_mut(0) {
col_iter.for_each(|val| *val = 42);
}
assert_eq!(m.col_iter(0).unwrap().collect::<Vec<&i32>>(), vec![&42, &42]);
```
12 changes: 12 additions & 0 deletions rust/docs/matrix/col_par_iter_mut.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
指定した列の要素への並列可変参照を返します。
このイテレータは、列の要素への可変参照を返します。イテレータは、列の要素を順番に返しますが、同時に複数の要素にアクセスすることができます。

# Examples

```rust
use matrix::Matrix;
let mut m: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
m.col_par_iter_mut(0).unwrap().for_each(|x| *x *= 2);
assert_eq!(m[(0, 0)], 2);
assert_eq!(m[(1, 0)], 6);
```
4 changes: 3 additions & 1 deletion rust/docs/matrix/cols.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
列数を返します。

# Examples
```

```rust
use matrix::Matrix;
let m: Matrix<i32> = Matrix::with_size(3, 4); // [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
assert_eq!(m.cols(), 4);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/div.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
同じサイズの行列同士の要素ごとの除算を行います。
* サイズが異なる行列同士の除算はエラーを返します。
* 0で割る要素がある場合もエラーを返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/div_assign.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
同じサイズの行列同士の要素ごとの除算を行います。
* サイズが異なる行列同士の除算はパニックを引き起こします。
* 0で割る要素がある場合もパニックを引き起こします。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[10, 20], [30, 40]]);
let m2: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/div_trait.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
同じサイズの行列同士の要素ごとの除算を行います。
* サイズが異なる行列同士の除算はNoneを返します。
* 0で割る要素がある場合もNoneを返します。

# Examples
```

```rust
use matrix::Matrix;
let m2: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m3 = m1 / m2;
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/div_with.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
同じサイズの行列同士の要素ごとの除算を行います。
* サイズが異なる行列同士の除算はエラーを返します。
* 0で割る要素がある場合もエラーを返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/get.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
指定した位置の要素への参照を返します。

# Examples
```

```rust
use matrix::Matrix;
let m: Matrix<i32> = Matrix::with_size(2, 2);
assert_eq!(m.get(0, 0), Some(&0));
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/get_mut.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
指定した位置の要素への可変参照を返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m: Matrix<i32> = Matrix::with_size(2, 2);
if let Some(val) = m.get_mut(0, 0) {
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/hadamard_mul.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
同じサイズの行列同士の要素ごとの乗算を行います。
* サイズが異なる行列同士の乗算はエラーを返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/hadamard_mul_with.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
同じサイズの行列同士の要素ごとの乗算を行います。
* サイズが異なる行列同士の乗算はエラーを返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
タプルインデックスで要素にアクセスします。

# Examples
```

```rust
use matrix::Matrix;
let m: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
assert_eq!(m[(0, 0)], 1);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/mul.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
行列積を行います。
* 列数と行数が一致しない行列同士の乗算はエラーを返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/mul_assign.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
行列積を行います。
* サイズが異なる行列同士の乗算はパニックを引き起こします。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/mul_trait.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
同じサイズの行列同士の要素ごとの乗算を行います。
* サイズが異なる行列同士の乗算はNoneを返します。

# Examples
```

```rust
use matrix::Matrix;
let m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/mul_with.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
行列積を行います。
* 列数と行数が一致しない行列同士の乗算はエラーを返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
4 changes: 4 additions & 0 deletions rust/docs/matrix/new.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
二次元配列から行列を作成します。
* TはDefaultとCopyトレイトを実装している必要があります。

# Examples

```rust
use NeuralNetwork::matrix::Matrix;
let m: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
assert_eq!(m.get(0, 0), Some(&1));
assert_eq!(m.get(0, 1), Some(&2));
assert_eq!(m.get(1, 0), Some(&3));
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/row_iter.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
指定した行の要素への参照を返します。

# Examples
```

```rust
use matrix::Matrix;
let m: Matrix<i32> = Matrix::with_size(2, 2);
assert_eq!(m.row_iter(0).unwrap().collect::<Vec<&i32>>(), vec![&0, &0]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
指定した行の要素への可変参照を返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m: Matrix<i32> = Matrix::with_size(2, 2);
if let Some(row_iter) = m.row_mut_iter(0) {
Expand Down
11 changes: 11 additions & 0 deletions rust/docs/matrix/row_par_iter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
並列イテレータを返します。
このメソッドは、行の要素を並列に処理したい場合に使用します。

# Examples

```rust
use matrix::Matrix;
let m: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let sum: i32 = m.row_par_iter(0).unwrap().cloned().sum();
assert_eq!(sum, 3);
```
11 changes: 11 additions & 0 deletions rust/docs/matrix/row_par_iter_mut.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
並列イテレータを返します。
このメソッドは、行の要素を並列に処理したい場合に使用します。

# Examples

```rust
use matrix::Matrix;
let m: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
m.row_par_iter_mut(0).unwrap().for_each(|x| *x *= 2);
assert_eq!(m[(0, 0)], 2);
```
4 changes: 3 additions & 1 deletion rust/docs/matrix/rows.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
行数を返します。

# Examples
```

```rust
use matrix::Matrix;
let m: Matrix<i32> = Matrix::with_size(3, 4); // [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
assert_eq!(m.rows(), 3);
Expand Down
4 changes: 3 additions & 1 deletion rust/docs/matrix/sub.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
同じサイズの行列同士の要素ごとの減算を行います。
* サイズが異なる行列同士の減算はエラーを返します。

# Examples
```

```rust
use matrix::Matrix;
let mut m1: Matrix<i32> = Matrix::new([[1, 2], [3, 4]]);
let m2: Matrix<i32> = Matrix::new([[5, 6], [7, 8]]);
Expand Down
Loading
Loading