Properties
CosmoParticles.sumprop
— Functionsumprop(p::AbstractParticles, prop::Symbol)
Returns the sum of the specified property over all particles.
CosmoParticles.meanprop
— Functionmeanprop(p::AbstractParticles, prop::Symbol; massprop=:mass, massweighted::Bool=true)
Returns the mean of the specified property over all particles.
The mean can be weighted by the mass.
CosmoParticles.meanpos
— Functionmeanpos(p::AbstractParticles, prop::Symbol=:pos; massprop=:mass, massweighted=true)
Returns the mean of the particles' positions.
The mean can be weighted by the mass.
CosmoParticles.meanvel
— Functionmeanvel(p::AbstractParticles, prop::Symbol=:pos; massprop=:mass, massweighted=true)
Returns the mean of the particles' velocities.
The mean can be weighted by the mass.
CosmoParticles.angmom
— Functionangmom(p::AbstractParticles)
Returns the individual angular momenta of the particles.
If angmomprop
is a Symbol
, the already computed angular momenta are returned directly if they exist.
Keyword Arguments
origin=Nothing
: origin of the coordinate system for the computation of the angular momentumvelorigin=Nothing
: relative velocity zero-point, oftentimes the velocity of the center of massposprop=:pos
: property name of the positionvelprop=:vel
: property name of the velocitymassprop=:mass
: property name of the massangmomprop=nothing
: property name of the angular momentum - the method checks whether it already exists or not. Warning: The method assumes the already saved property to have used the sameorigin
andvelorigin
.
angmom(pos::AbstractMatrix, vel::AbstractMatrix, mass; origin=nothing, velorigin=nothing)
Returns the angular momentum based on the positions, velocities, and masses.
Both input matrices need to have the same dimensions $3 × N$. The mass can be a vector or a scalar value (useful if all particles have the same mass).
The coordinate system's origin can be passed as a vector of length 3, as well as the velocity origin, which determines the relative velocity at which the angular momentum should be determined. Typically, this will be the velocity of the center of mass.
CosmoParticles.angmomtot
— Functionangmomtot(p::AbstractParticles)
Returns the total angular momentum of the particles.
If angmomprop
is a Symbol
, the total angular momentum is computed from the already existing angular momenta.
Keyword Arguments
origin=Nothing
: origin of the coordinate system for the computation of the angular momentumvelorigin=Nothing
: relative velocity zero-point, oftentimes the velocity of the center of massposprop=:pos
: property name of the positionvelprop=:vel
: property name of the velocitymassprop=:mass
: property name of the massangmomprop=nothing
: property name of the angular momentum - the method checks whether it already exists or not. Warning: The method assumes the already saved property to have used the sameorigin
andvelorigin
.
angmomtot(pos::AbstractMatrix, vel::AbstractMatrix, mass; origin=nothing, velorigin=nothing)
Returns the total angular momentum based on the positions, velocities, and masses.
Both input matrices need to have the same dimensions $3 × N$. The mass can be a vector or a scalar value (useful if all particles have the same mass).
The coordinate system's origin can be passed as a vector of length 3, as well as the velocity origin, which determines the relative velocity at which the angular momentum should be determined. Typically, this will be the velocity of the center of mass.
This method never allocates the full angular momentum matrix for all particles like angmom
does. Use this when the individual particle angular momenta are not needed.
CosmoParticles.angmomtot_stable
— Functionangmomtot_stable(pos::AbstractMatrix, vel::AbstractMatrix, mass; origin=nothing, velorigin=nothing)
Returns the total angular momentum based on the positions, velocities, and masses, like angmomtot
.
Uses the stable summation algorithm Base.sum
for the summation, but is almost three times slower than angmomtot
.
See angmomtot
for the available keyword arguments.
CosmoParticles.colnorm
— Functioncolnorm(a::AbstractMatrix[, origin::AbstractVector])
Returns a new Vector
with the columnwise norms of a
around origin
.
This method does not check for overflow of the squared norm.
CosmoParticles.colnorm2
— Functioncolnorm2(a::AbstractMatrix[, origin:AbstractVector])
Returns a new Vector
with the columnwise squared norms of a
around origin
.
CosmoParticles.coldot
— Functioncoldot(a::AbstractMatrix, b::AbstractMatrix)
Returns the dot products of the matrix columns as a new matrix.
Both input matrices need to have the same dimensions $d × N$, representing $N$ $d$-dimensional vectors.
CosmoParticles.colcross
— Functioncolcross(a::AbstractMatrix, b::AbstractMatrix)
Returns the cross products of the matrix columns as a new matrix.
Both input matrices need to have the same dimensions $3 × N$.