mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-12-22 12:23:31 +01:00
Minor changes
This commit is contained in:
parent
1a4677dc19
commit
e56e01197d
@ -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 ->
|
val run : ?ordered:bool -> ?comm:Mpi.communicator ->
|
||||||
f:('a -> 'b) -> 'a Stream.t -> 'b Stream.t
|
f:('a -> 'b) -> 'a Stream.t -> 'b Stream.t
|
||||||
(** Run the [f] function on every process by popping elements from the
|
(** Run the [f] function on every process by popping elements from the
|
||||||
|
@ -33,6 +33,10 @@ val broadcast_vec : Lacaml.D.vec -> Lacaml.D.vec
|
|||||||
|
|
||||||
(** {5 Intra-node operations} *)
|
(** {5 Intra-node operations} *)
|
||||||
module Node : sig
|
module Node : sig
|
||||||
|
(** This module contains parallel primitives among processes
|
||||||
|
within the same compute node.
|
||||||
|
*)
|
||||||
|
|
||||||
val name : string
|
val name : string
|
||||||
(** Name of the current host *)
|
(** Name of the current host *)
|
||||||
|
|
||||||
|
@ -103,11 +103,6 @@ let make
|
|||||||
Mat.init_cols n m (fun i k ->
|
Mat.init_cols n m (fun i k ->
|
||||||
(lambda.{k} *. m_new_U.{i,k} -. m_new_W.{i,k}) /.
|
(lambda.{k} *. m_new_U.{i,k} -. m_new_W.{i,k}) /.
|
||||||
(max (diagonal.{i} -. lambda.{k}) 0.01) )
|
(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
|
|> Mat.to_col_vecs_list
|
||||||
in
|
in
|
||||||
|
|
||||||
@ -118,6 +113,18 @@ let make
|
|||||||
if Parallel.master then
|
if Parallel.master then
|
||||||
Printf.printf "%3d %16.10f %16.8e%!\n" iter lambda.{1} residual_norm;
|
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
|
if residual_norm > threshold then
|
||||||
let u_next, w_next, iter =
|
let u_next, w_next, iter =
|
||||||
if iter = n_iter then
|
if iter = n_iter then
|
||||||
|
Loading…
Reference in New Issue
Block a user