Skip to content

Commit

Permalink
Correct the case of GPU/Float32 (#48)
Browse files Browse the repository at this point in the history
* Update FixedEffectSolverGPU.jl

* Update FixedEffectSolverCPU.jl

* Update Project.toml
  • Loading branch information
matthieugomez authored Jun 22, 2021
1 parent fb8d79c commit dc47665
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FixedEffects"
uuid = "c8885935-8500-56a7-9867-7708b20db0eb"
version = "2.0.4"
version = "2.0.5"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
6 changes: 3 additions & 3 deletions src/FixedEffectSolvers/FixedEffectSolverCPU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ function solve_residuals!(r::AbstractVector, feM::FixedEffectSolverCPU{T}; tol::
end
copyto!(feM.b, feM.r)
if length(feM.x.x) == 1
mul!(feM.x, feM.m', feM.b, 1.0, 0.0)
mul!(feM.x, feM.m', feM.b, 1, 0)
iter, converged = 1, true
else
mul!(feM.x, feM.m', feM.b, 1.0, 0.0)
mul!(feM.x, feM.m', feM.b, 1, 0)
x, ch = lsmr!(feM.x, feM.m, feM.b, feM.v, feM.h, feM.hbar; atol = tol, btol = tol, maxiter = maxiter)
iter, converged = ch.mvps + 1, ch.isconverged
end
mul!(feM.r, feM.m, feM.x, -1.0, 1.0)
mul!(feM.r, feM.m, feM.x, -1, 1)
if !(feM.weights isa UnitWeights)
feM.r ./= sqrt.(feM.weights)
end
Expand Down
4 changes: 2 additions & 2 deletions src/FixedEffectSolvers/FixedEffectSolverGPU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ function solve_residuals!(r::AbstractVector, feM::FixedEffectSolverGPU{T}; tol::
feM.r .*= sqrt.(feM.weights)
end
copyto!(feM.b, feM.r)
mul!(feM.x, feM.m', feM.b, 1.0, 0.0)
mul!(feM.x, feM.m', feM.b, 1, 0)
x, ch = lsmr!(feM.x, feM.m, feM.b, feM.v, feM.h, feM.hbar; atol = tol, btol = tol, maxiter = maxiter)
mul!(feM.r, feM.m, feM.x, -1.0, 1.0)
mul!(feM.r, feM.m, feM.x, -1, 1)
if !(feM.weights isa UnitWeights)
feM.r ./= sqrt.(feM.weights)
end
Expand Down

2 comments on commit dc47665

@matthieugomez
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/39432

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.0.5 -m "<description of version>" dc47665b34329ce13782f7707409cd09e8b521cd
git push origin v2.0.5

Please sign in to comment.