[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54167] eigs called with user defined function
From: |
anonymous |
Subject: |
[Octave-bug-tracker] [bug #54167] eigs called with user defined function gives incorrect results if B is not the identity matrix |
Date: |
Fri, 22 Jun 2018 16:19:50 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Firefox/60.0 |
URL:
<http://savannah.gnu.org/bugs/?54167>
Summary: eigs called with user defined function gives
incorrect results if B is not the identity matrix
Project: GNU Octave
Submitted by: None
Submitted on: Fri 22 Jun 2018 08:19:48 PM UTC
Category: Libraries
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Octave user
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.4.0
Operating System: Microsoft Windows
_______________________________________________________
Details:
If you run the code below, you get an error if B is not the identity matrix.
clear all;
rand("seed", 0);
tol = sqrt(eps);
for j=1:2
for i=1:100
A = rand(10, 10);
if j == 1
B = eye(columns(A));
else
B = rand(rows(A), columns(A));
endif
A *= A.';
B *= B.';
opts.isreal = 1;
opts.issym = 1;
[v, lambda] = eigs(A, B, 3, "sm");
[v2, lambda2] = eigs(@(x) A \ x, columns(A), B, 3, "sm", opts);
assert(lambda, lambda2, tol*max(max(abs(lambda))));
for i=1:columns(v)
assert(A * v(:, i), lambda(i,i) * B * v(:,i), tol * norm(A * v(:,i)));
endfor
for i=1:columns(v2)
assert(A * v2(:, i), lambda2(i,i) * B * v2(:, i), tol * norm(A *
v2(:,i)));
endfor
endfor
endfor
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Fri 22 Jun 2018 08:19:48 PM UTC Name: eigs_test.m Size: 694B By:
None
<http://savannah.gnu.org/bugs/download.php?file_id=44417>
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54167>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54167] eigs called with user defined function gives incorrect results if B is not the identity matrix,
anonymous <=