/// <summary> /// C = A||B; Constructs a new matrix which is the concatenation of two other matrices. /// Example: <i>0 1</i> append<i>3 4</i> --> <i>0 1 3 4</i>. /// <summary> public ObjectMatrix1D Append(ObjectMatrix1D A, ObjectMatrix1D B) { // concatenate ObjectMatrix1D matrix = Make(A.Count() + B.Count()); matrix.ViewPart(0, A.Count()).Assign(A); matrix.ViewPart(A.Count(), B.Count()).Assign(B); return(matrix); }
/// <summary> /// C = A||A||..||A; Constructs a new matrix which is concatenated<i> repeat</i> times. /// Example: ///<pre> /// 0 1 /// repeat(3) --> /// 0 1 0 1 0 1 ///</pre> /// <summary> public ObjectMatrix1D Repeat(ObjectMatrix1D A, int repeat) { int size = A.Count(); ObjectMatrix1D matrix = Make(repeat * size); for (int i = repeat; --i >= 0;) { matrix.ViewPart(size * i, size).Assign(A); } return(matrix); }
/// <summary> /// Constructs a list from the given matrix. /// The values are copiedd So subsequent changes in <i>values</i> are not reflected in the list, and vice-versa. /// /// <summary> /// <param name="values">The values to be filled into the new list.</param> /// <returns>a new list.</returns> public Cern.Colt.List.ObjectArrayList ToList(ObjectMatrix1D values) { int size = values.Count(); Cern.Colt.List.ObjectArrayList list = new Cern.Colt.List.ObjectArrayList(size); list.SetSize(size); for (int i = size; --i >= 0;) { list[i] = values[i]; } return(list); }