-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added isEye and isZero to the Linear Algebra module. (#22695)
Relevant issue: #22682 It was pointed out that we should have `isZero` and `isEye` methods in the Linear Algebra module. This PR adds these. Added two `isEye` and `isZero` to the linear algebra module. - [ ] Paratest [reviewed by @jeremiah-corrado]
- Loading branch information
Showing
5 changed files
with
72 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
10 changes: 10 additions & 0 deletions
10
test/library/packages/LinearAlgebra/correctness/testIdentity.chpl
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 @@ | ||
use LinearAlgebra; | ||
|
||
|
||
config const n = 100; | ||
|
||
var A = eye(n); | ||
writeln(isEye(A)); | ||
|
||
var B = Matrix([0,0,0], [0,0,0], eltType=real); | ||
writeln(isEye(B)); |
2 changes: 2 additions & 0 deletions
2
test/library/packages/LinearAlgebra/correctness/testIdentity.good
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,2 @@ | ||
true | ||
false |
13 changes: 13 additions & 0 deletions
13
test/library/packages/LinearAlgebra/correctness/testZero.chpl
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 @@ | ||
use LinearAlgebra; | ||
|
||
|
||
config const n = 100; | ||
config const m = 200; | ||
|
||
var A = Matrix(n,m,eltType=int(64)); | ||
|
||
writeln(isZero(A)); | ||
|
||
var B = eye(n); | ||
writeln(isZero(B)); | ||
|
2 changes: 2 additions & 0 deletions
2
test/library/packages/LinearAlgebra/correctness/testZero.good
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,2 @@ | ||
true | ||
false |