Skip to content

Commit ced2ca2

Browse files
author
Andy Ferris
committed
Added doc refs and tests
1 parent b3fc8ac commit ced2ca2

File tree

2 files changed

+39
-16
lines changed

2 files changed

+39
-16
lines changed

base/linalg/conjarray.jl

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,23 @@
33
"""
44
ConjArray(array)
55
6-
A lazy-view wrapper of an `AbstractArray`, taking the elementwise complex
7-
conjugate. This type is usually constructed (and unwrapped) via the `conj()`
8-
function (or related `ctranspose()`), but currently this is the default behavior
9-
for `RowVector` only.
6+
A lazy-view wrapper of an `AbstractArray`, taking the elementwise complex conjugate. This
7+
type is usually constructed (and unwrapped) via the [`conj`](@ref) function (or related
8+
[`ctranspose`](@ref)), but currently this is the default behavior for `RowVector` only. For
9+
other arrays, the `ConjArray` constructor can be used directly.
10+
11+
# Examples
12+
13+
```jldoctest
14+
julia> [1+im, 1-im]'
15+
1×2 RowVector{Complex{Int64},ConjArray{Complex{Int64},1,Array{Complex{Int64},1}}}:
16+
1-1im 1+1im
17+
18+
julia> ConjArray([1+im 0; 0 1-im])
19+
2×2 ConjArray{Complex{Int64},2,Array{Complex{Int64},2}}:
20+
1-1im 0+0im
21+
0+0im 1+1im
22+
```
1023
"""
1124
immutable ConjArray{T, N, A <: AbstractArray} <: AbstractArray{T, N}
1225
parent::A

base/linalg/rowvector.jl

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
"""
22
RowVector(vector)
33
4-
A lazy-view wrapper of an `AbstractVector`, which turns a length-`n` vector into
5-
a `1×n` shaped row vector and represents the transpose of a vector (the elements
6-
are also transposed recursively). This type is usually constructed (and
7-
unwrapped) via the `transpose()` function or `.'` operator (or related
8-
`ctranspose()` or `'` operator).
9-
10-
By convention, a vector can be multiplied by a matrix on its left (`A * v`)
11-
whereas a row vector can be multiplied by a matrix on its right (such that
12-
`v.' * A = (A.' * v).'`). It differs from a `1×n`-sized matrix by the facts that
13-
its transpose returns a vector and the inner product `v1.' * v2` returns a
14-
scalar, but will otherwise behave similarly.
4+
A lazy-view wrapper of an `AbstractVector`, which turns a length-`n` vector into a `1×n`
5+
shaped row vector and represents the transpose of a vector (the elements are also transposed
6+
recursively). This type is usually constructed (and unwrapped) via the [`transpose`](@ref)
7+
function or `.'` operator (or related [`ctranspose`](@ref) or `'` operator).
8+
9+
By convention, a vector can be multiplied by a matrix on its left (`A * v`) whereas a row
10+
vector can be multiplied by a matrix on its right (such that `v.' * A = (A.' * v).'`). It
11+
differs from a `1×n`-sized matrix by the facts that its transpose returns a vector and the
12+
inner product `v1.' * v2` returns a scalar, but will otherwise behave similarly.
1513
"""
1614
immutable RowVector{T,V<:AbstractVector} <: AbstractMatrix{T}
1715
vec::V
@@ -89,7 +87,19 @@ parent(rowvec::RowVector) = rowvec.vec
8987
"""
9088
conj(rowvector)
9189
92-
Returns a `ConjArray` lazy view of the input, where each element is conjugated.
90+
Returns a [`ConjArray`](@ref) lazy view of the input, where each element is conjugated.
91+
92+
### Example
93+
94+
```jldoctest
95+
julia> v = [1+im, 1-im].'
96+
1×2 RowVector{Complex{Int64},Array{Complex{Int64},1}}:
97+
1+1im 1-1im
98+
99+
julia> conj(v)
100+
1×2 RowVector{Complex{Int64},ConjArray{Complex{Int64},1,Array{Complex{Int64},1}}}:
101+
1-1im 1+1im
102+
```
93103
"""
94104
@inline conj(rowvec::RowVector) = RowVector(_conj(rowvec.vec))
95105
@inline conj{T<:Real}(rowvec::RowVector{T}) = rowvec

0 commit comments

Comments
 (0)