-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from yuehhua/master
Add MatrixMultiplication
- Loading branch information
Showing
5 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name = "MatrixMultiplication" | ||
uuid = "6fb7e565-1e98-4352-a061-49756642246e" | ||
authors = ["Yueh-Hua Tu <[email protected]>"] | ||
version = "0.1.0" | ||
|
||
[compat] | ||
julia = "1.4" | ||
|
||
[extras] | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Test"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# 矩陣乘法 | ||
|
||
矩陣乘法是在數值計算中相當基本的運算方式,矩陣乘法的效率常常也決定了數值軟體的效能。矩陣乘法中的每個元素計算依循以下式子: | ||
|
||
<img src="https://i.imgur.com/0g2zDzN.png" width="40%"> | ||
|
||
## 測試 | ||
|
||
```julia | ||
A = [1 2; 3 4] | ||
B = [1, 0] | ||
C = [1, 3] | ||
@test all(multiply(A, B) .== C) | ||
``` | ||
|
||
### 測試資料 | ||
|
||
以下測試資料中,請計算 `A`、`B` 相乘,並比對正確答案 `C`。 | ||
|
||
```julia | ||
A1 = rand(5, 5) | ||
B1 = rand(5, 5) | ||
C1 = A1*B1 | ||
|
||
A2 = rand(1, 5) | ||
B2 = rand(5, 1) | ||
C2 = A2*B2 | ||
|
||
A3 = rand(3, 4) | ||
B3 = rand(4, 5) | ||
C3 = A3*B3 | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module MatrixMultiplication | ||
|
||
src = [ | ||
] | ||
|
||
for s = src | ||
include("$(s).jl") | ||
end | ||
|
||
end # module |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using MatrixMultiplication | ||
using Test | ||
|
||
tests = [ | ||
] | ||
|
||
@testset "MatrixMultiplication.jl" begin | ||
for t in tests | ||
include("$(t).jl") | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ | |
|
||
### 簡單資料結構 | ||
|
||
* [矩陣乘法](MatrixMultiplication/) | ||
|
||
### 排序演算法 | ||
|
||
* [氣泡排序法](BubbleSort/) | ||
|