# Vecnorm, countnz, At\_mul\_B and "all that jazz" - how to learn that these (and other) features have been deprecated?

**URL:** https://discourse.julialang.org/t/vecnorm-countnz-at-mul-b-and-all-that-jazz-how-to-learn-that-these-and-other-features-have-been-deprecated/27639
**Category:** New to Julia
**Created:** [August 17, 2019, 1:06am UTC](https://discourse.julialang.org/t/vecnorm-countnz-at-mul-b-and-all-that-jazz-how-to-learn-that-these-and-other-features-have-been-deprecated/27639 "2019-08-17T01:06:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)
#### Post date: [August 17, 2019, 1:06am UTC](https://discourse.julialang.org/t/vecnorm-countnz-at-mul-b-and-all-that-jazz-how-to-learn-that-these-and-other-features-have-been-deprecated/27639/1 "2019-08-17T01:06:36Z")

</div>

While trying to manually upgrade to Julia 1.x a package developed in the pre-0.7 days by somebody else, namely [PolynomialMatrices](https://github.com/neveritt/PolynomialMatrices.jl) ([my fork](https://github.com/hurak/PolynomialMatrices.jl)), now seemingly abandoned by its original author(s), I - being new to Julia - frequently encounter a problem that _some_ features of the language used in the old code are now deprecated but this fact is not stated anywhere (I certainly do consult NEWS for the individual releases, in particular [https://github.com/JuliaLang/julia/blob/v0.7.0/NEWS.md](https://github.com/JuliaLang/julia/blob/v0.7.0/NEWS.md)). True, some of these issues are detected through warnings in Julia v0.7 (and a solution is advised) but not all (some issues only demonstrate themselves as errors upon running some code). It is just that some features are described in the documentation for v0.6.4 and then absent in the docs for v0.7. Missing are (unless I am really overlooking something), for example:

- [vecnorm](https://docs.julialang.org/en/v0.6/stdlib/linalg/#Base.LinAlg.vecnorm)
- [At\_mul\_B and At\_mul\_Bt and “all that jazz”](https://docs.julialang.org/en/v0.6/stdlib/linalg/#Base.At_mul_B)
- [countnz](https://docs.julialang.org/en/v0.6/stdlib/arrays/#Base.countnz)

And I am curious if these disappeared without any substitution in 1.0 and newer. Any replacement for any of these?

On a general note, is there any systematic way how to keep track of these changes in the language without searching through discussions?

Or is it perhaps the other way around: that after discovering these issues by myself I should contribute by sending PR to the corresponding NEWS.md?

Many thanks.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [August 17, 2019, 2:28am UTC](https://discourse.julialang.org/t/vecnorm-countnz-at-mul-b-and-all-that-jazz-how-to-learn-that-these-and-other-features-have-been-deprecated/27639/2 "2019-08-17T02:28:53Z")

</div>

Every single one of the functions that you asked about have deprecation warnings in Julia 0.7 that tell you the name of the new function. In general, you should upgrade code from Julia 0.6 by first porting it to Julia 0.7 and eliminating the deprecation warnings, and then porting it to 1.0.

If you try `vecnorm` in 0.7, it will tell you to use `norm` instead. (The old induced-norm functionality is now called `opnorm`.)

```julia
julia> vecnorm([3,4,5])
WARNING: Base.vecnorm is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module Main
┌ Warning: `vecnorm` is deprecated, use `norm` instead.
│ caller = top-level scope at none:0
└ @ Core none:0
7.0710678118654755

```

If you use `At_mul_B` it will tell you to use `transpose(A) * B` instead:

```julia
julia> At_mul_B(rand(3,3), rand(3,3))
┌ Warning: `At_mul_B(A::AbstractMatrix{T}, B::AbstractMatrix{S}) where {T, S}` is deprecated, use `transpose(A) * B` instead.
│ caller = top-level scope at none:0
└ @ Core none:0
3×3 Array{Float64,2}:
 0.448665 0.475241 0.598641
 0.594207 0.592333 0.728903
 0.880249 0.881354 0.878509

```

Similarly for `At_mul_Bt`, which is deprecated to `transpose(A) * transpose(B)`.

And `countnz(x)` is deprecated for `count(!iszero, x)`:

```julia
julia> countnz([3,4,5])
┌ Warning: `countnz(x)` is deprecated, use either `count(!iszero, x)` or `count(t -> t != 0, x)` instead.
│ caller = top-level scope at none:0
└ @ Core none:0
3

```

---

<div class="post-metadata">

### Author: ![zdenek\_hurak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zdenek_hurak/32/53118_2.png) [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)
#### Post date: [August 17, 2019, 8:19am UTC](https://discourse.julialang.org/t/vecnorm-countnz-at-mul-b-and-all-that-jazz-how-to-learn-that-these-and-other-features-have-been-deprecated/27639/3 "2019-08-17T08:19:13Z")

</div>

Many thanks. Indeed, you are right, Julia 0.7 is giving not only warnings but also suggestions for all three examples.

Let me explain that what I did was that I only worked with the warnings that Julia 0.7 returned after `using` the whole package. There were many dozens if not hundreds warnings, after eliminating those (took a few hours), I thought/hoped that I was done and hurried to switch to Julia 1.1 and run the first examples there (it is these late night shifts…). It seems I will have to stay in Julia 0.7 for some time while upgrading the package.

But still… I think it would be useful if it is also stated somewhere explicitly (in README.md for Julia 0.7 perhaps) that `countnz`, `At_mul_Bt` and `vecnorm` are deprecated.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [August 17, 2019, 8:34am UTC](https://discourse.julialang.org/t/vecnorm-countnz-at-mul-b-and-all-that-jazz-how-to-learn-that-these-and-other-features-have-been-deprecated/27639/4 "2019-08-17T08:34:15Z")

</div>

[https://github.com/JuliaLang/julia/blob/release-0.7/NEWS.md#deprecated-or-removed](https://github.com/JuliaLang/julia/blob/release-0.7/NEWS.md#deprecated-or-removed)

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [August 17, 2019, 1:08pm UTC](https://discourse.julialang.org/t/vecnorm-countnz-at-mul-b-and-all-that-jazz-how-to-learn-that-these-and-other-features-have-been-deprecated/27639/5 "2019-08-17T13:08:04Z")

</div>

> [@zdenek\_hurak](#):
>
> I only worked with the warnings that Julia 0.7 returned after `using` the whole package

Most deprecation warnings are only issued when code is actually run — just eliminating deprecations from `using` is not generally sufficient, since loading the module typically only executes a small set of top-level code. If the package has a good test suite, then the next step is eliminating deprecation warnings emitted when you run the tests.
