module Local:sig
..end
Compute the task-local portions of certain operations.
val dotprod : Nvector.NVECTOR_OPS.t -> Nvector.NVECTOR_OPS.t -> float
dotprod x y
returns the dot product of x
and y
.
val maxnorm : Nvector.NVECTOR_OPS.t -> float
maxnorm x
returns the maximum absolute value in x.
val min : Nvector.NVECTOR_OPS.t -> float
min x
returns the smallest element in x
.
val l1norm : Nvector.NVECTOR_OPS.t -> float
l1norm x
returns the l1 norm of x
.
val invtest : Nvector.NVECTOR_OPS.t -> Nvector.NVECTOR_OPS.t -> bool
invtest x z
calculates z(i) = 1 / x(i)
with prior testing for
zero values. This routine returns true
if all components of x
are
nonzero (successful inversion) and false
otherwise (not all elements
inverted).
val constrmask : Nvector.NVECTOR_OPS.t ->
Nvector.NVECTOR_OPS.t -> Nvector.NVECTOR_OPS.t -> bool
constrmask c x m
calculates m(i) = Pi x(i)
returning the
conjunction. The value of Pi
depends on c(i)
: 2: x(i) > 0
,
1: x(i) >= 0
, 0: true
, -1: x(i) <= 0
, and -2: x(i) < 0
.
val minquotient : Nvector.NVECTOR_OPS.t -> Nvector.NVECTOR_OPS.t -> float
minquotient num denom
returns the minimum of num(i) / denom(i)
.
Zero denom
elements are skipped.
val wsqrsum : Nvector.NVECTOR_OPS.t -> Nvector.NVECTOR_OPS.t -> float
wsqrsum x w
calculates the weighted squared sum of x
with
weight vector w
.
That is, $s = \sum_{i=0}^{n_\mathit{local} - 1}(x_i w_i)^2$ .
val wsqrsummask : Nvector.NVECTOR_OPS.t ->
Nvector.NVECTOR_OPS.t -> Nvector.NVECTOR_OPS.t -> float
wsqrsummask x w id
calculates the weighted squared sum of x
with weight vector w
for the elements where id
is positive.
That is, $m =
\sum_{i=0}^{n_\mathit{local} - 1}(x_i w_i H(\math{id}_i))^2$
where $H(\alpha) = \begin{cases}
1 & \alpha > 0 \ 0 & \alpha \le 0
\end{cases} $ .
val dotprodmulti : Nvector.NVECTOR_OPS.t ->
Nvector.NVECTOR_OPS.t array -> Sundials.RealArray.t -> unit
dotprodmulti x y d
calculates
d(j) = x(0)*y(j)(0) + ... + x(n-1)*y(j)(n-1)
for the nl
task-local elements in the nvectors and where j
ranges over the
array elements.
val dotprodmulti_allreduce : Nvector.NVECTOR_OPS.t -> Sundials.RealArray.t -> unit
dotprodmulti_allreduce x d
combines the task-local portions
of the dot product of a vector x
with nv vectors.