public static MatrixComplex FromRowVectors(IEnumerable <MatrixComplex> vectors) { if (vectors == null) { throw new ArgumentNullException("vectors"); } vectors = vectors.ToArray(); IEnumerable <Vector2Integer> vectorSizes = vectors.Select(vector => vector.Size); if (vectorSizes.Distinct().Count() != 1) { throw new ArgumentException("Vectors in parameter 'vectors' are not all the same size."); } Vector2Integer vectorSize = vectorSizes.Distinct().Single(); if (vectorSize.X != 1) { throw new ArgumentException("Vectors in parameter 'vectors' are not row vectors."); } MatrixComplex result = new MatrixComplex(vectors.Count(), vectorSize.Y); for (int rowIndex = 0; rowIndex < result.RowCount; rowIndex++) { for (int columnIndex = 0; columnIndex < result.ColumnCount; columnIndex++) { result[rowIndex, columnIndex] = vectors.ElementAt(rowIndex)[0, columnIndex]; } } return(result); }
public bool Contains(Vector2Integer vector) { return(rangeX.Contains(vector.X) && rangeY.Contains(vector.Y)); }
public Orthotope2Integer(Vector2Integer start, Vector2Integer end) { this.rangeX = new OrderedRange <int>(start.X, end.X); this.rangeY = new OrderedRange <int>(start.Y, end.Y); }