Here is a simple example which generates a loss of the connection to the kernel.
A few words to help you understand what this simplified code is aimed to do.
The inputs are:
- a matrix M (10 by 2 in the example given above),
- a "slave" column p,
- a "master" column q,
- a list of rangesr.
Let nr the number of elements of r.
The goal is to separate the elements of M[.. ,p] in nr sorted lists L1, ..., Lnr according to the rule
- M[n ,p] is in Lk if M[n ,q] is in r[k]
A notional example is given in the snippet code below.
The variable num contains nr lists, the kth one contains the values of n such that M[n ,q] is in r[k] .
As soon as one element of num is empty list the line S := ... generates the Connection to Kernel lost message.
I have made sure that this no longer happens by coding more carefully.
However, since some recent posts have mentioned this type of connection loss (usually difficult to trace), I thought it might be useful to publish this example (a census of connection loss situations might help make Maple more robust)
Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895
LTB := ListTools:-BinaryPlace:
M := LinearAlgebra:-RandomMatrix(10, 2):
p := 1:
q := 2:
r := [-100..-1, -1..1, 1..100]:
nr := numelems(r):
Y_x, Y_ix := sort(M[.., q] , output=[sorted, permutation]):
bounds := map(u -> 1+LTB(Y_x, op(1, u))..LTB(Y_x, op(2, u)), r);
Y_nb := map(u -> op(2, u)-op(1, u)+1, bounds);
[2, 0, 8]
num := [ seq(Y_ix[bounds[k]], k=1...nr) ];
[[9, 1], , [3, 2, 6, 7, 10, 4, 8, 5]]
S := [ seq(sort(convert(M[num[k], p], Vector)), k=1..nr) ];