MathNet.Numerics.LinearAlgebra.Single.DenseMatrix.OfColumnVectors C# (CSharp) Method

OfColumnVectors() public static method

Create a new dense matrix as a copy of the given column vectors. This new matrix will be independent from the vectors. A new memory block will be allocated for storing the matrix.
public static OfColumnVectors ( ) : DenseMatrix
return DenseMatrix
        public static DenseMatrix OfColumnVectors(params Vector<float>[] columns)
        {
            var storage = new VectorStorage<float>[columns.Length];
            for (int i = 0; i < columns.Length; i++)
            {
                storage[i] = columns[i].Storage;
            }
            return new DenseMatrix(DenseColumnMajorMatrixStorage<float>.OfColumnVectors(storage));
        }

Same methods

DenseMatrix::OfColumnVectors ( IEnumerable columns ) : DenseMatrix

Usage Example

        // copying vector basis in several samples
        public static Matrix <float> VectorToMatrix(int columns, Vector <float> v)
        {
            List <Vector <float> > vv = new List <Vector <float> >(columns); // creating a list  of  column vectors

            for (int i = 0; i < columns; i++)
            {
                vv.Add(v);                           // initilizaing the matrix List
            }
            return(DenseMatrix.OfColumnVectors(vv)); // return the column list
        }