From 31b8725fb6628a252ddd2daf25607af902479d5d Mon Sep 17 00:00:00 2001 From: Joaquim Garcia Date: Fri, 19 Feb 2021 19:39:15 -0300 Subject: [PATCH 1/2] add docstring to function in copy.jl --- src/Utilities/copy.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Utilities/copy.jl b/src/Utilities/copy.jl index 1738f8ebff..695b2cfb0b 100644 --- a/src/Utilities/copy.jl +++ b/src/Utilities/copy.jl @@ -115,6 +115,16 @@ function IndexMap(n = 0) ) end +""" + index_map_for_variable_indices(variables) + +This function does not add variables to the IndexMap. +It simply initializes the IndexMap with a proper data struture. +If the variable indices are contiguous and start from 1, then +a optimized data structure with pre allocated memmory is initialized. +Otherwise the data structure will start empty and will try to +keep using performant structure for as long as possible. +""" function index_map_for_variable_indices(variables) n = length(variables) if all(i -> variables[i] == MOI.VariableIndex(i), 1:n) From 148b4fb295a36dc52eef584214e3e9ce5fe2f010 Mon Sep 17 00:00:00 2001 From: Joaquim Dias Garcia Date: Sat, 20 Feb 2021 23:42:18 -0300 Subject: [PATCH 2/2] Update copy.jl --- src/Utilities/copy.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utilities/copy.jl b/src/Utilities/copy.jl index 695b2cfb0b..c36f570065 100644 --- a/src/Utilities/copy.jl +++ b/src/Utilities/copy.jl @@ -121,7 +121,7 @@ end This function does not add variables to the IndexMap. It simply initializes the IndexMap with a proper data struture. If the variable indices are contiguous and start from 1, then -a optimized data structure with pre allocated memmory is initialized. +an optimized data structure with pre allocated memory is initialized. Otherwise the data structure will start empty and will try to keep using performant structure for as long as possible. """