From d378ccac7f7d2f5cef2a6c27f4580a3ad5942d3d Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Tue, 18 Oct 2016 06:22:26 -0700 Subject: [PATCH] Add a max function Adds a max function on units by mapping max to the values of the elements and re-units them. --- src/SIUnits.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SIUnits.jl b/src/SIUnits.jl index e3b3ee9..428599f 100644 --- a/src/SIUnits.jl +++ b/src/SIUnits.jl @@ -255,6 +255,10 @@ module SIUnits SIQuantity{T,m,kg,s,A,K,mol,cd,rad,sr}(abs(x.val)) end + max{ND,N,m,kg,s,A,K,mol,cd,rad,sr}(x::Array{SIUnits.SIQuantity{N,m,kg,s,A,K,mol,cd,rad,sr},ND}, + y::Array{SIUnits.SIQuantity{N,m,kg,s,A,K,mol,cd,rad,sr},ND}) = + map((x_tmp,y_tmp)->SIUnits.SIQuantity{N,m,kg,s,A,K,mol,cd,rad,sr}(max(x_tmp.val,y_tmp.val)),x,y) + function isfinite{T,m,kg,s,A,K,mol,cd,rad,sr}(x::SIQuantity{T,m,kg,s,A,K,mol,cd,rad,sr}) isfinite(x.val) end