Processing math: 100%

Module type Nvector.NVECTOR_OPS

module type NVECTOR_OPS = sig .. end

Basic operations underlying an nvector.


type t 

The vector type.

val clone : t -> t

Create a new, distinct vector from an existing one.

val linearsum : float ->
t ->
float -> t -> t -> unit

linearsum a x b y z calculates z = a*x + b*y.

val const : float -> t -> unit

const c z sets all of z to c.

val prod : t ->
t -> t -> unit

prod x y z calculates z = x * y (pointwise).

val div : t ->
t -> t -> unit

div x y z calculates z = x / y (pointwise).

val scale : float -> t -> t -> unit

scale c x z calculates z = c *. x.

val abs : t -> t -> unit

abs x z calculates z = abs(x).

val inv : t -> t -> unit

inv x z calculates z = 1/x (pointwise).

val addconst : t -> float -> t -> unit

addconst x b z calculates z = x + b.

val dotprod : t -> t -> float

dotprod x y returns the dot product of x and y.

val maxnorm : t -> float

maxnorm x returns the maximum absolute value in x.

val wrmsnorm : t -> t -> float

wrmsnorm x w returns the weighted root-mean-square norm of x with weight vector w.

val min : t -> float

min x returns the smallest element in x.

val compare : float -> t -> t -> unit

compare c x z calculates z(i) = if abs x(i) >= c then 1 else 0.

val invtest : t -> 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 wl2norm : t -> t -> float

wl2norm x w returns the weighted (w) Euclidean l2 norm of x.

val l1norm : t -> float

l1norm x returns the l1 norm of x.

val wrmsnormmask : t ->
t -> t -> float

maxnormmask x w id returns the weighted root-mean-square norm of x using only elements where the corresponding id is non-zero.

val constrmask : t ->
t -> 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 : t -> t -> float

minquotient num denom returns the minimum of num(i) / denom(i). Zero denom elements are skipped.

val space : t -> int * int

lrw, liw = space c returns the number of realtype words lrw and integer words liw required to store c.

val getlength : t -> int

Returns the number of "active" entries. This value is cumulative across all processes in a parallel environment.

val print : ?logfile:Sundials.Logfile.t -> t -> unit

Prints to the given logfile (stdout, by default).

val linearcombination : Sundials.RealArray.t ->
t array -> t -> unit

linearcombination c x z calculates zi=nv1j=0cj(xj)i . The sum is over the nv elements of c and x.

val scaleaddmulti : Sundials.RealArray.t ->
t ->
t array -> t array -> unit

scaleaddmulti c x y z scales x and adds it to the nv vectors in y. That is, \forall j=0,\ldots,n_v-1, (z_j)_i = c_j x_i + (y_j)_i} .

val dotprodmulti : t ->
t array -> Sundials.RealArray.t -> unit

dotprodmulti x y d calculates the dot product of x with the nv elements of y. That is, j=0,,nv1,dj=n1i=0xi(yj)i .

val linearsumvectorarray : float ->
t array ->
float -> t array -> t array -> unit

linearsumvectorarray a x b y z computes the linear sum of the nv elements of x and y. That is, j=0,,nv1,(zj)i=a(xj)i+b(yj)i .

val scalevectorarray : Sundials.RealArray.t ->
t array -> t array -> unit

scalevectorarray c x z scales each of the nv vectors of x. That is, j=0,,nv1,(zj)i=cj(xj)i .

val constvectorarray : float -> t array -> unit

constvectorarray c x sets all elements of the nv nvectors in x to c. That is, j=0,,nv,(zj)i=c .

val wrmsnormvectorarray : t array ->
t array -> Sundials.RealArray.t -> unit

wrmsnormvectorarray x w m computes the weighted root mean square norm of the nv vectors in x and w. That is, j=0,,nv,mj=(1nn1i=0((xj)i(wj)i)2)12 , where n is the number of elements in each nvector.

val wrmsnormmaskvectorarray : t array ->
t array ->
t -> Sundials.RealArray.t -> unit

wrmsnormmaskvectorarray x w id m computes the weighted root mean square norm of the nv vectors in x and w. That is, j=0,,nv,mj=(1nn1i=0((xj)i(wj)iH(idi))2)12 , where H(x)={1if x>0 0otherwise and n is the number of elements in each nvector.

val scaleaddmultivectorarray : Sundials.RealArray.t ->
t array ->
t array array ->
t array array -> unit

scaleaddmultivectorarray a x yy zz scales and adds nv vectors in x across the ns vector arrays in yy. That is, j=0,,ns1,k=0,,nv1,(zzj,k)i=ak(xk)i+(yyj,k)i .

val linearcombinationvectorarray : Sundials.RealArray.t ->
t array array -> t array -> unit

linearcombinationvectorarray c xx z computes the linear combinations of ns vector arrays containing nv vectors. That is, k=0,,nv1,(zk)i=ns1j=0cj(xj,k)i .

module Local: sig .. end

Compute the task-local portions of certain operations.