-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
1 parent
9c989da
commit 9a25cbe
Showing
3 changed files
with
88 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
75 changes: 75 additions & 0 deletions
75
modules/constructors_functions/tests/bug_github_issue_#1205.m
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,75 @@ | ||
%============================================================================= | ||
% Copyright (c) 2017 Allan CORNET (Nelson) | ||
%============================================================================= | ||
% This file is part of the Nelson. | ||
%============================================================================= | ||
% LICENCE_BLOCK_BEGIN | ||
% SPDX-License-Identifier: LGPL-3.0-or-later | ||
% LICENCE_BLOCK_END | ||
%============================================================================= | ||
% <-- Issue URL --> | ||
% https://github.com/nelson-lang/nelson/issues/1205 | ||
% <-- Short Description --> | ||
% `diag` may return wrong sub- or superdiagonals | ||
%============================================================================= | ||
A = vander(1:3); | ||
R = diag(A)'; | ||
REF = [1 2 1]; | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
A = vander(1:3); | ||
R = diag(A, 1)'; | ||
REF = [1 1]; | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
R = diag(A, 2)'; | ||
REF = 1; | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
R = diag(A, 3)'; | ||
REF = zeros(1, 0); | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
R = diag(A, 4)'; | ||
REF = zeros(1, 0); | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
R = diag(A, 5)'; | ||
REF = zeros(1, 0); | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
A = vander(1:4); | ||
R = diag(A, 4)'; | ||
REF = zeros(1, 0); | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
A = vander(1:4); | ||
R = diag(A, 5)'; | ||
REF = zeros(1, 0); | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
A = vander(1:4); | ||
R = diag(A, 45)'; | ||
REF = zeros(1, 0); | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
A = vander(1:3); | ||
R = diag(A, -1)'; | ||
REF = [4 3]; | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
A = vander(1:3); | ||
R = diag(A, -2)'; | ||
REF = 9; | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
A = vander(1:3); | ||
R = diag(A, -3)'; | ||
REF = zeros(1, 0); | ||
assert_isequal(R, REF); | ||
%============================================================================= | ||
A = vander(1:3); | ||
R = diag(A, -4)'; | ||
REF = zeros(1, 0); | ||
assert_isequal(R, REF); | ||
%============================================================================= |
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