/// <summary>Copies the values of the specified source matrix /// into this (larger) matrix at the specified offset</summary> /// <param name="sourceMatrix">Source matrix</param> /// <param name="targetColumnOffset">Target column offset in this matrix</param> /// <param name="targetRowOffset">Target row offset in this matrix</param> public virtual void CopyFrom( MatrixBase <T> sourceMatrix, Int32 targetColumnOffset, Int32 targetRowOffset) { MatrixBase <T> .ElementWiseCopy(sourceMatrix, this, targetColumnOffset, targetRowOffset); }
/// <summary>Copies the values of the matrix object into a /// larger matrix at the specified offset</summary> /// <param name="matrix">Target matrix</param> /// <param name="targetColumnOffset">Target matrix column offset</param> /// <param name="targetRowOffset">Target matrix row offset</param> public virtual void CopyInto( MatrixBase <T> targetMatrix, Int32 targetColumnOffset, Int32 targetRowOffset) { MatrixBase <T> .ElementWiseCopy(this, targetMatrix, targetColumnOffset, targetRowOffset); }
/// <summary>CopyFrom</summary> /// <param name="sourceMatrix"></param> /// <param name="targetColumnOffset"></param> /// <param name="targetRowOffset"></param> public void CopyFrom( DoubleMatrix sourceMatrix, Int32 targetColumnOffset, Int32 targetRowOffset) { MatrixBase <Double> .ElementWiseCopy( sourceMatrix.InnerMatrix, this.InnerMatrix, targetColumnOffset, targetRowOffset); }
/// <summary>CopyInto</summary> /// <param name="targetMatrix"></param> /// <param name="targetColumnOffset"></param> /// <param name="targetRowOffset"></param> public void CopyInto( DoubleMatrix targetMatrix, Int32 targetColumnOffset, Int32 targetRowOffset) { MatrixBase <Double> .ElementWiseCopy( this.InnerMatrix, targetMatrix.InnerMatrix, targetColumnOffset, targetRowOffset); }
/// <summary> /// /// </summary> /// <param name="matricies"></param> /// <returns></returns> public static MatrixBase <T> JoinVertical( IEnumerable <MatrixBase <T> > matricies) { int?columnCount = null; int totalRowCount = 0; foreach (MatrixBase <T> matrix in matricies) { if (MatrixBase <T> .IsNull(matrix)) { throw new ArgumentNullException(); } if (columnCount == null) { columnCount = matrix.ColumnCount; } else if ((int)columnCount != matrix.ColumnCount) { throw new DimensionMismatchException(); } totalRowCount += matrix.RowCount; } MatrixBase <T> resultMatrix = new MatrixBase <T>((int)columnCount, totalRowCount); int rowOffset = 0; foreach (MatrixBase <T> matrix in matricies) { MatrixBase <T> .ElementWiseCopy(matrix, resultMatrix, 0, rowOffset); rowOffset += matrix.RowCount; } return(resultMatrix); }
/// <summary> /// /// </summary> /// <param name="matricies"></param> /// <returns></returns> public static MatrixBase <T> JoinHorizontal( IEnumerable <MatrixBase <T> > matricies) { int?rowCount = null; int totalColumnCount = 0; foreach (MatrixBase <T> matrix in matricies) { if (MatrixBase <T> .IsNull(matrix)) { throw new ArgumentNullException(); } if (rowCount == null) { rowCount = matrix.RowCount; } else if ((int)rowCount != matrix.RowCount) { throw new DimensionMismatchException(); } totalColumnCount += matrix.ColumnCount; } MatrixBase <T> resultMatrix = new MatrixBase <T>(totalColumnCount, (int)rowCount); int columnOffset = 0; foreach (MatrixBase <T> matrix in matricies) { MatrixBase <T> .ElementWiseCopy(matrix, resultMatrix, columnOffset, 0); columnOffset += matrix.ColumnCount; } return(resultMatrix); }