Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trs uses * and TRSinfo does not have correct # of multiplications #12

Open
rs1909 opened this issue Jul 22, 2023 · 0 comments
Open

trs uses * and TRSinfo does not have correct # of multiplications #12

rs1909 opened this issue Jul 22, 2023 · 0 comments

Comments

@rs1909
Copy link

rs1909 commented Jul 22, 2023

Try the following code

using LinearAlgebra
using TRS
import Base.*
import Base.eltype
import Base.size
import LinearAlgebra.mul!
import LinearAlgebra.issymmetric

struct MM
           A
end

size(p::MM,i) = size(p.A,i)
eltype(p::MM) = eltype(p.A)
issymmetric(p::MM) = LinearAlgebra.issymmetric(p.A)
*(p::MM,b) = begin print("+"); p.A * b end
mul!(x::AbstractVector, p::MM, y::AbstractVector) = begin print("."); mul!(x, p.A, y) end

bb = randn(1000,1000)
P = MM(Symmetric(bb))

trs(P, randn(1000), 10.01, tol = 1e-5)

The result is
............................................................................................................................................................................................................................................+++++++++++++++++++++++++++++++++++++++++++([0.9118078944996598; 0.17858464580297087; … ; 0.004596302762534588; -0.28270136894221026;;], TRS.TRSinfo(false, 10, 236, [62.17093160622234]))

Firstly the docs says that only mul! needs to defined. Secondly the actual multiplications are 279, instead of the reported 236.

It might not be an issue, but I feel this is somewhat suspicious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant