Skip to content

Commit

Permalink
rename null to nullspace
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jan 10, 2015
1 parent 24b14c6 commit eac0249
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,5 @@ const base64 = base64encode
@deprecate beginswith startswith

@deprecate functionlocs(f,t) map(functionloc, methods(f,t))

@deprecate null nullspace
2 changes: 1 addition & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ export
lufact,
lyap,
norm,
null,
nullspace,
ordschur!,
ordschur,
peakflops,
Expand Down
4 changes: 2 additions & 2 deletions base/linalg/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -455,14 +455,14 @@ pinv(a::StridedVector) = pinv(reshape(a, length(a), 1))
pinv(x::Number) = isfinite(one(x)/x) ? one(x)/x : zero(x)

## Basis for null space
function null{T}(A::StridedMatrix{T})
function nullspace{T}(A::StridedMatrix{T})
m, n = size(A)
(m == 0 || n == 0) && return eye(T, n)
SVD = svdfact(A, thin=false)
indstart = sum(SVD[:S] .> max(m,n)*maximum(SVD[:S])*eps(eltype(SVD[:S]))) + 1
return SVD[:V][:,indstart:end]
end
null(a::StridedVector) = null(reshape(a, length(a), 1))
nullspace(a::StridedVector) = nullspace(reshape(a, length(a), 1))

function cond(A::StridedMatrix, p::Real=2)
if p == 2
Expand Down
6 changes: 3 additions & 3 deletions test/linalg1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ debug && println("Solve square general system of equations")
@test_throws DimensionMismatch b\b'
@test norm(a*x - b, 1)/norm(b) < ε*κ*n*2 # Ad hoc, revisit!

debug && println("Test null")
debug && println("Test nullspace")
if eltya != BigFloat && eltyb != BigFloat # Revisit when implemented in julia
a15null = null(a[:,1:5]')
a15null = nullspace(a[:,1:5]')
@test rank([a[:,1:5] a15null]) == 10
@test_approx_eq_eps norm(a[:,1:5]'a15null, Inf) zero(eltya) 300ε
@test_approx_eq_eps norm(a15null'a[:,1:5], Inf) zero(eltya) 400ε
@test size(null(b), 2) == 0
@test size(nullspace(b), 2) == 0
end

end # for eltyb
Expand Down

1 comment on commit eac0249

@StefanKarpinski
Copy link
Member

Choose a reason for hiding this comment

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

👍

Please sign in to comment.