diff --git a/src/AbstractFixedEffectSolver.jl b/src/AbstractFixedEffectSolver.jl index 07eb5e8..ffd7d98 100644 --- a/src/AbstractFixedEffectSolver.jl +++ b/src/AbstractFixedEffectSolver.jl @@ -172,11 +172,11 @@ function FixedEffects.solve_coefficients!(r::AbstractVector, feM::AbstractFixedE if !(feM.weights isa UnitWeights) feM.b .*= sqrt.(feM.weights) end - fill!(feM.x, 0.0) + fill!(feM.x, zero(T)) x, ch = lsmr!(feM.x, feM.m, feM.b, feM.v, feM.h, feM.hbar; atol = tol, btol = tol, maxiter = maxiter) for (x, scale) in zip(feM.x.x, feM.m.scales) x .*= scale end x = Vector{eltype(r)}[collect(x) for x in feM.x.x] full(normalize!(x, feM.m.fes; tol = tol, maxiter = maxiter), feM.m.fes), div(ch.mvps, 2), ch.isconverged -end \ No newline at end of file +end diff --git a/src/FixedEffectCoefficients.jl b/src/FixedEffectCoefficients.jl index 503e976..27d748b 100644 --- a/src/FixedEffectCoefficients.jl +++ b/src/FixedEffectCoefficients.jl @@ -1,4 +1,4 @@ -# Define methods used in LSMR +e# Define methods used in LSMR ############################################################################## ## @@ -28,14 +28,14 @@ end function Base.fill!(fecoefs::FixedEffectCoefficients, α::Number) for x in fecoefs.x - fill!(x, α) + fill!(x, eltype(fecoefs)(α)) end return fecoefs end function LinearAlgebra.rmul!(fecoefs::FixedEffectCoefficients, α::Number) for x in fecoefs.x - rmul!(x, α) + rmul!(x, eltype(fecoefs)(α)) end return fecoefs end @@ -52,4 +52,4 @@ function LinearAlgebra.axpy!(α::Number, fecoefs1::FixedEffectCoefficients, feco axpy!(α, x1, x2) end return fecoefs2 -end \ No newline at end of file +end