Skip to content

Commit

Permalink
Revert "adds row and column stochastic matrices"
Browse files Browse the repository at this point in the history
This reverts commit a9db8a6.
  • Loading branch information
SteveBronder committed Jul 16, 2024
1 parent 03c4492 commit 606a395
Show file tree
Hide file tree
Showing 13 changed files with 334 additions and 690 deletions.
Empty file modified scripts/hooks/install_hooks.sh
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions src/analysis_and_optimization/Mir_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ let trans_bounds_values (trans : Expr.Typed.t Transformation.t) : bound_values =
| PositiveOrdered -> {lower= `Lit 0.; upper= `None}
| UnitVector -> {lower= `Lit (-1.); upper= `Lit 1.}
| CholeskyCorr | CholeskyCov | Correlation | Covariance | Ordered | Offset _
|Multiplier _ | OffsetMultiplier _ | Identity | RowStochastic
|ColumnStochastic
|Multiplier _ | OffsetMultiplier _
|Identity
(* This is a stub, but,
until we define a distribution which accepts a tuple,
this doesn't matter.
Expand Down
4 changes: 0 additions & 4 deletions src/analysis_and_optimization/Pedantic_dist_warnings.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ type var_constraint =
| CholeskyCov
| Correlation
| Covariance
| RowStochastic
| ColumnStochastic

(** Constraint paired with a name for user messages *)
type var_constraint_named = {name: string; constr: var_constraint}
Expand Down Expand Up @@ -92,8 +90,6 @@ let transform_mismatch_constraint (constr : var_constraint)
| CholeskyCov -> trans <> CholeskyCov && trans <> CholeskyCorr
| Correlation -> trans <> Correlation
| Covariance -> trans <> Covariance && trans <> Correlation
| RowStochastic -> trans <> RowStochastic
| ColumnStochastic -> trans <> ColumnStochastic

(** Check for inconsistency between a distribution argument's range and
a literal value *)
Expand Down
8 changes: 3 additions & 5 deletions src/frontend/Ast_to_Mir.ml
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,7 @@ let check_transform_shape decl_id decl_var meta = function
same_shape decl_id decl_var "lower" e1 meta
@ same_shape decl_id decl_var "upper" e2 meta
| Covariance | Correlation | CholeskyCov | CholeskyCorr | Ordered
|PositiveOrdered | Simplex | UnitVector | Identity | TupleTransformation _
|RowStochastic | ColumnStochastic ->
|PositiveOrdered | Simplex | UnitVector | Identity | TupleTransformation _ ->
[]

let copy_indices indexed (var : Expr.Typed.t) =
Expand All @@ -295,8 +294,7 @@ let extract_transform_args var = function
| LowerUpper (a1, a2) | OffsetMultiplier (a1, a2) ->
[copy_indices var a1; copy_indices var a2]
| Covariance | Correlation | CholeskyCov | CholeskyCorr | Ordered
|PositiveOrdered | Simplex | UnitVector | Identity | TupleTransformation _
|RowStochastic | ColumnStochastic ->
|PositiveOrdered | Simplex | UnitVector | Identity | TupleTransformation _ ->
[]

let rec param_size transform sizedtype =
Expand Down Expand Up @@ -328,7 +326,7 @@ let rec param_size transform sizedtype =
|LowerUpper (_, _)
|Offset _ | Multiplier _
|OffsetMultiplier (_, _)
|Ordered | PositiveOrdered | UnitVector | RowStochastic | ColumnStochastic ->
|Ordered | PositiveOrdered | UnitVector ->
sizedtype
| TupleTransformation tms ->
let _, dims = SizedType.get_array_dims sizedtype in
Expand Down
6 changes: 1 addition & 5 deletions src/frontend/Pretty_printing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,7 @@ let pp_bracketed_transform ppf = function
pf ppf "<@[offset=%a,@ multiplier=%a@]>" pp_expression e1 pp_expression e2
| Identity | Ordered | PositiveOrdered | Simplex | UnitVector | CholeskyCorr
|CholeskyCov | Correlation | Covariance | TupleTransformation _
|RowStochastic
|ColumnStochastic
(* tuple transformations are handled in pp_transformed_type *) ->
(* tuple transformations are handled in pp_transformed_type *) ->
()

let rec pp_transformed_type ppf (st, trans) =
Expand Down Expand Up @@ -364,8 +362,6 @@ let rec pp_transformed_type ppf (st, trans) =
| CholeskyCov -> pf ppf "cholesky_factor_cov%a" cov_sizes_fmt ()
| Correlation -> pf ppf "corr_matrix%a" cov_sizes_fmt ()
| Covariance -> pf ppf "cov_matrix%a" cov_sizes_fmt ()
| RowStochastic -> pf ppf "row_stochastic%a" sizes_fmt ()
| ColumnStochastic -> pf ppf "column_stochastic%a" sizes_fmt ()
| TupleTransformation transforms ->
(* NB this calls the top-level function to handle internal arrays etc *)
let transTypes = Middle.Utils.zip_stuple_trans_exn st transforms in
Expand Down
2 changes: 0 additions & 2 deletions src/frontend/Typechecker.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1657,8 +1657,6 @@ and check_transformation cf tenv ut trans =
List.map typesTrans ~f:(fun (ut, tm) ->
check_transformation cf tenv ut tm) in
TupleTransformation tes
| RowStochastic -> RowStochastic
| ColumnStochastic -> ColumnStochastic

and check_var_decl loc cf tenv sized_ty trans
(variables : untyped_expression Ast.variable list) is_global =
Expand Down
2 changes: 0 additions & 2 deletions src/frontend/lexer.mll
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ rule token = parse
Parser.CHOLESKYFACTORCOV }
| "corr_matrix" { lexer_logger "corr_matrix" ; Parser.CORRMATRIX }
| "cov_matrix" { lexer_logger "cov_matrix" ; Parser.COVMATRIX }
| "row_stochastic" { lexer_logger "row_stochastic" ; Parser.ROWSTOCHASTIC }
| "column_stochastic" { lexer_logger "column_stochastic" ; Parser.COLUMNSTOCHASTIC }
(* Transformation keywords *)
| "lower" { lexer_logger "lower" ; Parser.LOWER }
| "upper" { lexer_logger "upper" ; Parser.UPPER }
Expand Down
Loading

0 comments on commit 606a395

Please sign in to comment.