AutoVectors.AutoVector
— TypeAutoVector(def=0.0,mini::Integer=1,maxi::Integer=0,miniloc::Integer=0)
AutoVector(f::Function,mini::Integer=1,maxi::Integer=0,miniloc::Integer=0)
AutoVector(v::Vector,mini::Integer=1,maxi::Integer=0,miniloc::Integer=0)
Frequently you just use
v = AutoVector(), defaulting to Float64, size 0
or v = AutoVector(0), defaulting to Int64, size 0
An AutoVector expands when written to outside its range. Reading outside its range does not expand the range, and gives def.
Arguments:
def–default element, usually 0.0. Determines the type T of AutoVector{T}
mini and maxi give the index range of the created AutoVector (logical indices, not index in data vector)
miniloc is the location of mini-1 within the data vector, default 0 (data index)
You can initialize an AutoVector with the default, from a function, or by putting in a vector. Most functions and constructors deal with logical indices, Data indices refers to location within the data vector dat, which should not be something to worry about normally.
AutoVectors.applyshift
— Methodapplyshift(x::AutoVector,offset::Integer)
Create a new AutoVector shifted to left by offset, sharing the same data array.
AutoVectors.avdot
— Methodavdot(x::AutoVector,y::AutoVector)
Dot product (with no complex conjugating), sumi xi y_i over the intersection of ranges.
AutoVectors.avlocation
— Methodavlocation(v::AutoVector,i)
The data location of logical index i.
AutoVectors.avlocmax
— Methodavlocmax(v::AutoVector)
The data location of maxi(v).
AutoVectors.avlocmin
— Methodavlocmin(v::AutoVector)
The data location of mini(v).
AutoVectors.avnorm
— Methodavnorm(v::AutoVector)
Norm of AutoVector
AutoVectors.avrange
— Methodavrange(v::AutoVector)
The logical range as mini:maxi. A synonym is arange.
AutoVectors.avtripconv
— Methodavtripconv(u::AutoVector,g::AutoVector,v::AutoVector)
Same as avdot(convolve(u,g),v)
AutoVectors.avtriple
— Methodavtriple(x::AutoVector,y::AutoVector,z::AutoVector)
Triple dot product (with no complex conjugating), sumi xi yi zi over the intersection of ranges.
AutoVectors.avvec
— Methodavvec(v::AutoVector)
avvec(v) creates a standard Vector with all values from mini to maxi; the new Vector does not know mini; it only knows its length, given by maxi-mini+1.
AutoVectors.clear!
— Methodclear!(v::AutoVector)
Resets v to empty.
AutoVectors.convolve
— Functionconvolve(x::AutoVector,y::AutoVector,cut=1.0e-14) # use absolute cutoff
Convolve with cutoff; no writing of elements if abs(value) < cut
AutoVectors.doprint
— Methoddoprint([file descriptor],v::AutoVector; spacing = 1)
Print all the elements to standard output or a file, with indices scaled by spacing.
AutoVectors.fast
— Methodfast(v::AutoVector,i)
fast(v,i) is like accessing v[i], but without the check for being outside the logical range. If i is outside, fast may or may not throw a standard range exception depending on whether i lands outside the data vector's range. For use when i is known to be inside the logical range. Combined with @inbounds, there will be no range checking at all, for optimal speed.
AutoVectors.fftav
— Methodfftav(f::AutoVector{Float64},delta)
For a real function f(x) defined by sampling on a uniform grid with spacing delta, returns a tuple (F, freqsp, len), where F is the Fourier Transform as an AutoVector(ComplexF64), freqsp is the frequency spacing of F, and len the length of the vector used in the FFT (to be used in ifftav). Implicitly, the function is assumed to be zero outside the range of the input. The normalizations are different from the usual discrete FT conventions, incorporating the spacing, and corresponding to a continuous integral. The FT is defined as
$F(k) = \frac{1}{\sqrt{2 \pi}} \int dx e^{-i k x} f(x)$
AutoVectors.ifftav
— Methodifftav(F::AutoVector{ComplexF64},freqspacing,maxind)
For a function F_i defined on a uniform frequency grid with spacing freqspacing, returns the Inverse Fourier Transform.
$f(x) = \frac{1}{\sqrt{2 \pi}} \int dk e^{i k x} F(k)$
AutoVectors.makeAutoVectorOfVecs
— MethodmakeAutoVectorOfVecs(veczero::Vector,mini::Integer,maxi::Integer)
Create an AutoVector that holds Vectors as elements, an AutoVecotr of Vectors. The zero default Vector is veczero.
AutoVectors.makeauto
— Methodmakeauto(v::Vector{T};offset=nothing, firstindex=nothing, cutoff=0.0) where T
Make an AutoVector out of a Vector, producing a new data vector. If offset is supplied, shifts data to left by offset. If firstindex is supplied, it makes mini=firstindex. You can't specify both offset and firstindex. With cutoff nonzero, elements are only put in if abs(el) > cutoff. To put in a part of a Vector at a particular range, say putting elements 2 to 4 at positions 5 to 7, do this: makeauto(v[2:4],firstindex=5)
AutoVectors.maxi
— Methodmaxi(v::AutoVector)
Maximum logical index.
AutoVectors.mini
— Methodmini(v::AutoVector)
Minimum logical index.
AutoVectors.olaprange
— Methodolaprange(v::AutoVector,w::AutoVector)
olaprange(v,w) gives range of overlapping indices of AutoVectors v and w, given as a:b.
AutoVectors.reverse_ind
— Methodreverse_ind(x::AutoVector)
A reflection about the origin; the new AutoVector goes from -maxi to -mini.
AutoVectors.shrink!
— Methodshrink!(x::AutoVector,cut)
Adjust mini and maxi to omit tails where all elements are less than cut in absolute value.
AutoVectors.subav
— Methodsubav(x::AutoVector,newmini::Integer,newmaxi::Integer)
Create a new AutoVector with the indicated range, sharing the same data array
Base.:*
— MethodMultiply all elements of a AutoVector by a Float64
Base.:*
— Method*(coef::Vector{Float64},v::Vector{AutoVector{Float64}})
Add a vector of AutoVectors together scaled by coefficients
Base.:+
— MethodAdd AutoVectors
Base.:+
— MethodAdd a Float64 to all elements of a AutoVector
Base.:-
— MethodSubtract AutoVectors
Base.:-
— MethodSubtract a Float64 from all elements of a AutoVector{Float64}
Base.length
— Methodlength(v::AutoVector)
Logical length.
Base.setindex!
— MethodAssign the value, but outside bounds forces resizing and adjustment of mini or maxi
LinearAlgebra.axpy!
— Methodaxpy!(y::AutoVector,a::Float64,x::AutoVector, cutoff::Float64) # y += a * x with cutoff for writing
LinearAlgebra.axpy!
— Methodaxpy!(y::AutoVector,a::Float64,x::AutoVector) # y += a * x