10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-07-25 12:17:25 +02:00

Minor changes

This commit is contained in:
Anthony Scemama 2019-04-04 13:14:01 +02:00
parent 1a4677dc19
commit e56e01197d
3 changed files with 18 additions and 5 deletions

View File

@ -4,6 +4,8 @@ The input is a stream of input data, and the output is a stream of data.
*)
val run_sequential : ('a -> 'b) -> 'a Stream.t -> 'b Stream.t
val run : ?ordered:bool -> ?comm:Mpi.communicator ->
f:('a -> 'b) -> 'a Stream.t -> 'b Stream.t
(** Run the [f] function on every process by popping elements from the

View File

@ -33,6 +33,10 @@ val broadcast_vec : Lacaml.D.vec -> Lacaml.D.vec
(** {5 Intra-node operations} *)
module Node : sig
(** This module contains parallel primitives among processes
within the same compute node.
*)
val name : string
(** Name of the current host *)

View File

@ -103,11 +103,6 @@ let make
Mat.init_cols n m (fun i k ->
(lambda.{k} *. m_new_U.{i,k} -. m_new_W.{i,k}) /.
(max (diagonal.{i} -. lambda.{k}) 0.01) )
in
let maxu = lange u_proposed ~norm:`M in
let thr = maxu *. 0.001 in
let u_proposed =
Mat.map (fun x -> if abs_float x < thr then 0. else x) u_proposed
|> Mat.to_col_vecs_list
in
@ -118,6 +113,18 @@ let make
if Parallel.master then
Printf.printf "%3d %16.10f %16.8e%!\n" iter lambda.{1} residual_norm;
(* Make new vectors sparse *)
let u_proposed =
Mat.of_col_vecs_list u_proposed
in
let maxu = lange u_proposed ~norm:`M in
let thr = maxu *. 0.01 in
let u_proposed =
Mat.map (fun x -> if abs_float x < thr then 0. else x) u_proposed
|> Mat.to_col_vecs_list
in
if residual_norm > threshold then
let u_next, w_next, iter =
if iter = n_iter then