-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Steve Bentley
committed
Apr 7, 2017
1 parent
be6ed10
commit 0e76274
Showing
1 changed file
with
9 additions
and
98 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 |
---|---|---|
@@ -1,102 +1,13 @@ | ||
package lingo | ||
|
||
// import "fmt" | ||
import "fmt" | ||
|
||
// // Add matrix m1 and matrix m2, creating matrix m3. | ||
// func ExampleMatrix_Add() { | ||
// m1 := Matrix{ | ||
// {1, 2, 3}, | ||
// {2, 4, 5}, | ||
// } | ||
// Add Scalar s1 to Scalar s2, creating Scalar s3 | ||
func ExampleScalar_Add() { | ||
s1 := Scalar(1) | ||
s2 := Scalar(2) | ||
s3, _ := Add(s1, s2) | ||
|
||
// m2 := Matrix{ | ||
// {3, 5, 1}, | ||
// {4, 4, 3}, | ||
// } | ||
|
||
// m3, _ := m1.Add(m2) | ||
|
||
// fmt.Println(m3) | ||
// // Output: [4 7 4] | ||
// // [6 8 8] | ||
// } | ||
|
||
// // Subtract matrix m1 from matrix m2, creating matrix m3. | ||
// func ExampleMatrix_Subtract() { | ||
// m1 := Matrix{ | ||
// {1, 2, 3}, | ||
// {2, 4, 5}, | ||
// } | ||
|
||
// m2 := Matrix{ | ||
// {3, 5, 1}, | ||
// {4, 4, 3}, | ||
// } | ||
|
||
// m3, _ := m2.Subtract(m1) | ||
|
||
// fmt.Println(m3) | ||
// // Output: [2 3 -2] | ||
// // [2 0 -2] | ||
// } | ||
|
||
// // Element wise multiplcation of matrix m1 by matrix m2, creating matrix m3. | ||
// func ExampleMatrix_Multiply() { | ||
// m1 := Matrix{ | ||
// {1, 2, 3}, | ||
// {2, 4, 5}, | ||
// } | ||
|
||
// m2 := Matrix{ | ||
// {3, 5, 1}, | ||
// {4, 4, 3}, | ||
// } | ||
|
||
// m3, _ := m1.Multiply(m2) | ||
|
||
// fmt.Println(m3) | ||
// // Output: [3 10 3] | ||
// // [8 16 15] | ||
// } | ||
|
||
// // Dot product of matrix m1 and matrix m2, creating matrix m3. | ||
// func ExampleMatrix_Dot() { | ||
// m1 := Matrix{ | ||
// {1, 2, 3}, | ||
// {2, 4, 5}, | ||
// } | ||
|
||
// m2 := Matrix{ | ||
// {1, 2}, | ||
// {3, 2}, | ||
// {4, 5}, | ||
// } | ||
|
||
// m3, _ := m1.Dot(m2) | ||
|
||
// fmt.Println(m3) | ||
// // Output: [19 21] | ||
// // [34 37] | ||
// } | ||
|
||
// // Get the value at position 1,2 in matrix m. | ||
// func ExampleMatrix_Value() { | ||
// m := Matrix{ | ||
// {1, 2, 3}, | ||
// {2, 4, 5}, | ||
// } | ||
|
||
// v, _ := m.Value(1, 2) | ||
|
||
// fmt.Println(v) | ||
// // Output: 5 | ||
// } | ||
|
||
// // Rows | ||
// // Columns | ||
// // Dimensions | ||
// // Equal | ||
// // Scale | ||
// // Transpose | ||
// // Reshape | ||
// // ToVector | ||
fmt.Println(s3) | ||
// Output: 3 | ||
} |