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

rename null to nullspace #9714

Merged
merged 2 commits into from
Jan 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ Deprecated or removed

* `beginswith` is renamed to `startswith` ([#9578]).

* `null` is renamed to `nullspace`.

Julia v0.3.0 Release Notes
==========================

Expand Down
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
2 changes: 1 addition & 1 deletion base/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,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
2 changes: 1 addition & 1 deletion doc/stdlib/linalg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ Linear algebra functions in Julia are largely implemented by calling functions f

Moore-Penrose pseudoinverse

.. function:: null(M)
.. function:: nullspace(M)

Basis for nullspace of ``M``.

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