module Nvector_custom:sig..end
An interface for creating custom nvectors in OCaml.
type kind
Represents an nvector manipulated by operations written in OCaml. Note that such operations entail the additional runtime cost of an OCaml callback.
type'dt =('d, kind) Nvector.t
The type scheme of custom nvectors.
type communicator
Represents an MPI communicator without introducing any unwanted
dependencies on MPI. See Nvector_parallel.hide_communicator.
type 'd nvector_ops = {
|
check : |
(* | Returns | *) |
|
clone : |
(* | Creates a new, distinct vector from an existing one without necessarily copying the contents of the original vector. | *) |
|
space : |
(* | Returns storage requirements for one nvector | *) |
|
getlength : |
(* | Returns the number of "active" entries. This value is cumulative across all processes in a parallel environment. | *) |
|
print : |
(* | Print to the given logfile (stdout, by default). | *) |
|
linearsum : |
(* |
| *) |
|
const : |
(* |
| *) |
|
prod : |
(* |
| *) |
|
div : |
(* |
| *) |
|
scale : |
(* |
| *) |
|
abs : |
(* |
| *) |
|
inv : |
(* |
| *) |
|
addconst : |
(* |
| *) |
|
maxnorm : |
(* |
| *) |
|
wrmsnorm : |
(* |
| *) |
|
min : |
(* |
| *) |
|
dotprod : |
(* |
| *) |
|
compare : |
(* |
| *) |
|
invtest : |
(* |
| *) |
|
wl2norm : |
(* |
| *) |
|
l1norm : |
(* |
| *) |
|
wrmsnormmask : |
(* |
| *) |
|
constrmask : |
(* |
| *) |
|
minquotient : |
(* |
| *) |
|
getcommunicator : |
(* | Returns the MPI communicator associated with an nvector. | *) |
|
linearcombination : |
(* |
| *) |
|
scaleaddmulti : |
(* |
| *) |
|
dotprodmulti : |
(* |
| *) |
|
linearsumvectorarray : |
(* |
| *) |
|
scalevectorarray : |
(* |
| *) |
|
constvectorarray : |
(* |
| *) |
|
wrmsnormvectorarray : |
(* |
| *) |
|
wrmsnormmaskvectorarray : |
(* |
| *) |
|
scaleaddmultivectorarray : |
(* |
| *) |
|
linearcombinationvectorarray : |
(* |
| *) |
|
dotprod_local : |
(* | Perform | *) |
|
maxnorm_local : |
(* | Perform | *) |
|
min_local : |
(* | Returns the smallest task-local element. | *) |
|
l1norm_local : |
(* | Perform | *) |
|
invtest_local : |
(* | Perform | *) |
|
constrmask_local : |
(* | Perform | *) |
|
minquotient_local : |
(* | Perform | *) |
|
wsqrsum_local : |
(* |
| *) |
|
wsqrsummask_local : |
(* |
| *) |
|
dotprodmulti_local : |
(* |
| *) |
|
dotprodmulti_allreduce : |
(* |
| *) |
}
The set of operations required to define an nvector. Some operations are optional; default values are either provided by the OCaml interface or the Sundials library.
Custom nvectors' payloads and operations must not hold any reference that loops back to the enclosing nvector. Such loops will not be properly garbage collected.
Nvector operations are not allowed to throw exceptions, as they cannot be propagated reliably. Uncaught exceptions will be discarded with a warning.
Note that the fused and array custom nvector operations currently reallocate fresh arrays at each call. There is thus a tradeoff between the speed advantages of providing a single callback that handles many values at once but allocates more heap memory and multiple callbacks.
val make_wrap : 'd nvector_ops ->
?context:Sundials.Context.t ->
?with_fused_ops:bool -> 'd -> 'd tInstantiation of custom nvectors.
make_wrap ops takes set a set of operations on the data
type 'd and yields a function for lifting values of type 'd
into 'd nvectors which can be passed to a solver.
val add_tracing : string -> 'd nvector_ops -> 'd nvector_opsAdd tracing to custom operations.
add_tracing p ops modifies a set of Nvector_custom.nvector_ops so that
a message, prefixed by p, is printed each time an operation
is called. This function is intended to help debug sets of
vector operations.
val enable : ?with_fused_ops:bool ->
?with_linear_combination:bool ->
?with_scale_add_multi:bool ->
?with_dot_prod_multi:bool ->
?with_linear_sum_vector_array:bool ->
?with_scale_vector_array:bool ->
?with_const_vector_array:bool ->
?with_wrms_norm_vector_array:bool ->
?with_wrms_norm_mask_vector_array:bool ->
?with_scale_add_multi_vector_array:bool ->
?with_linear_combination_vector_array:bool -> 'd t -> unitSelectively enable or disable fused and array operations.
The with_fused_ops argument enables or disables all such operations.
OperationNotSupported The requested functionality has not been provided.Config.NotImplementedBySundialsVersion Fused and array operations not available.module MakeOps(A:sig
type data
val ops : data Nvector_custom.nvector_opsend):Nvector.NVECTORwith type data = A.data and type kind = kind
Turn a set of Nvector_custom.nvector_ops into an nvector module.
module Any:sig..end
A generic nvector interface to custom nvectors.