/// <summary>
 /// Create a new diagonal matrix and initialize each diagonal value from the provided indexed enumerable.
 /// Keys must be provided at most once, zero is assumed if a key is omitted.
 /// This new matrix will be independent from the enumerable.
 /// A new memory block will be allocated for storing the matrix.
 /// </summary>
 public static DiagonalMatrix OfIndexedDiagonal(int rows, int columns, IEnumerable <Tuple <int, Complex> > diagonal)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <Complex> .OfIndexedEnumerable(rows, columns, diagonal)));
 }
 /// <summary>
 /// Create a new diagonal matrix and initialize each diagonal value using the provided init function.
 /// </summary>
 public static DiagonalMatrix Create(int rows, int columns, Func <int, Complex> init)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <Complex> .OfInit(rows, columns, init)));
 }
 /// <summary>
 /// Create a new diagonal matrix with diagonal values sampled from the provided random distribution.
 /// </summary>
 public static DiagonalMatrix CreateRandom(int rows, int columns, IContinuousDistribution distribution)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <double> .OfInit(rows, columns,
                                                                      i => distribution.Sample())));
 }
 /// <summary>
 /// Create a new diagonal matrix as a copy of the given other matrix.
 /// This new matrix will be independent from the other matrix.
 /// The matrix to copy from must be diagonal as well.
 /// A new memory block will be allocated for storing the matrix.
 /// </summary>
 public static DiagonalMatrix OfMatrix(Matrix <Complex> matrix)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <Complex> .OfMatrix(matrix.Storage)));
 }
 /// <summary>
 /// Create a new diagonal matrix straight from an initialized matrix storage instance.
 /// The storage is used directly without copying.
 /// Intended for advanced scenarios where you're working directly with
 /// storage for performance or interop reasons.
 /// </summary>
 public DiagonalMatrix(DiagonalMatrixStorage <float> storage)
     : base(storage)
 {
     _data = storage.Data;
 }
 /// <summary>
 /// Create a new diagonal matrix as a copy of the given two-dimensional array.
 /// This new matrix will be independent from the provided array.
 /// The array to copy from must be diagonal as well.
 /// A new memory block will be allocated for storing the matrix.
 /// </summary>
 public static DiagonalMatrix OfArray(double[,] array)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <double> .OfArray(array)));
 }
 public override Matrix <double> Diagonal(DiagonalMatrixStorage <double> storage)
 {
     return(new DiagonalMatrix(storage));
 }
 public DiagonalMatrix(Matrix <double> matrix)
     : this(DiagonalMatrixStorage <double> .OfMatrix(matrix.Storage))
 {
 }
Example #9
0
 public DiagonalMatrix(Matrix <float> matrix)
     : this(DiagonalMatrixStorage <float> .OfMatrix(matrix.Storage))
 {
 }
 /// <summary>
 ///     Create a new diagonal matrix straight from an initialized matrix storage instance.
 ///     The storage is used directly without copying.
 ///     Intended for advanced scenarios where you're working directly with
 ///     storage for performance or interop reasons.
 /// </summary>
 public abstract Matrix <T> Diagonal(DiagonalMatrixStorage <T> storage);
Example #11
0
 public DiagonalMatrix(float[,] array)
     : this(DiagonalMatrixStorage <float> .OfArray(array))
 {
 }
 internal DiagonalMatrix(DiagonalMatrixStorage <float> storage)
     : base(storage)
 {
     _storage = storage;
     _data    = _storage.Data;
 }
Example #13
0
 internal DiagonalMatrix(DiagonalMatrixStorage <Complex> storage)
     : base(storage)
 {
     _storage = storage;
     _data    = _storage.Data;
 }
 /// <summary>
 /// Create a new diagonal matrix straight from an initialized matrix storage instance.
 /// The storage is used directly without copying.
 /// Intended for advanced scenarios where you're working directly with
 /// storage for performance or interop reasons.
 /// </summary>
 public DiagonalMatrix(DiagonalMatrixStorage <Complex> storage)
     : base(storage)
 {
     _data = storage.Data;
 }
 return(new DiagonalMatrix(DiagonalMatrixStorage <float> .OfIndexedEnumerable(rows, columns, diagonal)));
 /// <summary>
 /// Create a new diagonal matrix straight from an initialized matrix storage instance.
 /// The storage is used directly without copying.
 /// Intended for advanced scenarios where you're working directly with
 /// storage for performance or interop reasons.
 /// </summary>
 public DiagonalMatrix(DiagonalMatrixStorage<Complex> storage)
     : base(storage)
 {
     _storage = storage;
     _data = _storage.Data;
 }
Example #17
0
 /// <summary>
 /// Create a new diagonal matrix straight from an initialized matrix storage instance.
 /// The storage is used directly without copying.
 /// Intended for advanced scenarios where you're working directly with
 /// storage for performance or interop reasons.
 /// </summary>
 public DiagonalMatrix(DiagonalMatrixStorage<float> storage)
     : base(storage)
 {
     _data = storage.Data;
 }
 /// <summary>
 /// Create a new diagonal matrix as a copy of the given two-dimensional array.
 /// This new matrix will be independent from the provided array.
 /// The array to copy from must be diagonal as well.
 /// A new memory block will be allocated for storing the matrix.
 /// </summary>
 public static DiagonalMatrix OfArray(float[,] array)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <float> .OfArray(array)));
 }
Example #19
0
 /// <summary>
 /// Create a new diagonal matrix straight from an initialized matrix storage instance.
 /// The storage is used directly without copying.
 /// Intended for advanced scenarios where you're working directly with
 /// storage for performance or interop reasons.
 /// </summary>
 public DiagonalMatrix(DiagonalMatrixStorage<Complex32> storage)
     : base(storage)
 {
     _data = storage.Data;
 }
 /// <summary>
 /// Create a new diagonal matrix as a copy of the given other matrix.
 /// This new matrix will be independent from the other matrix.
 /// The matrix to copy from must be diagonal as well.
 /// A new memory block will be allocated for storing the matrix.
 /// </summary>
 public static DiagonalMatrix OfMatrix(Matrix <double> matrix)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <double> .OfMatrix(matrix.Storage)));
 }
Example #21
0
 /// <summary>
 /// Create a new diagonal matrix with diagonal values sampled from the provided random distribution.
 /// </summary>
 public static DiagonalMatrix CreateRandom(int rows, int columns, IContinuousDistribution distribution)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <Complex32> .OfInit(rows, columns,
                                                                         i => new Complex32((float)distribution.Sample(), (float)distribution.Sample()))));
 }
 /// <summary>
 /// Create a new square sparse identity matrix where each diagonal value is set to One.
 /// </summary>
 public static DiagonalMatrix CreateIdentity(int order)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <double> .OfInit(order, order, i => One)));
 }
Example #23
0
 /// <summary>
 /// Create a new diagonal matrix straight from an initialized matrix storage instance.
 /// The storage is used directly without copying.
 /// Intended for advanced scenarios where you're working directly with
 /// storage for performance or interop reasons.
 /// </summary>
 public DiagonalMatrix(DiagonalMatrixStorage <Complex32> storage)
     : base(storage)
 {
     _storage = storage;
     _data    = _storage.Data;
 }
 /// <summary>
 /// Create a new diagonal matrix straight from an initialized matrix storage instance.
 /// The storage is used directly without copying.
 /// Intended for advanced scenarios where you're working directly with
 /// storage for performance or interop reasons.
 /// </summary>
 public DiagonalMatrix(DiagonalMatrixStorage <double> storage)
     : base(storage)
 {
     _storage = storage;
     _data    = _storage.Data;
 }
Example #25
0
 public DiagonalMatrix(Complex[,] array)
     : this(DiagonalMatrixStorage <Complex> .OfArray(array))
 {
 }
 /// <summary>
 /// Create a new diagonal matrix as a copy of the given two-dimensional array.
 /// This new matrix will be independent from the provided array.
 /// The array to copy from must be diagonal as well.
 /// A new memory block will be allocated for storing the matrix.
 /// </summary>
 public static DiagonalMatrix OfArray(Complex[,] array)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <Complex> .OfArray(array)));
 }
Example #27
0
 public DiagonalMatrix(Matrix <Complex> matrix)
     : this(DiagonalMatrixStorage <Complex> .OfMatrix(matrix.Storage))
 {
 }
 /// <summary>
 /// Create a new diagonal matrix and initialize each diagonal value from the provided enumerable.
 /// This new matrix will be independent from the enumerable.
 /// A new memory block will be allocated for storing the matrix.
 /// </summary>
 public static DiagonalMatrix OfDiagonal(int rows, int columns, IEnumerable <Complex> diagonal)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <Complex> .OfEnumerable(rows, columns, diagonal)));
 }
Example #29
0
 /// <summary>
 /// Create a new diagonal matrix straight from an initialized matrix storage instance.
 /// The storage is used directly without copying.
 /// Intended for advanced scenarios where you're working directly with
 /// storage for performance or interop reasons.
 /// </summary>
 public static Matrix <T> Diagonal <T>(DiagonalMatrixStorage <T> storage)
     where T : struct, IEquatable <T>, IFormattable
 {
     return(Matrix <T> .Build.Diagonal(storage));
 }
 /// <summary>
 /// Create a new square sparse identity matrix where each diagonal value is set to One.
 /// </summary>
 public static DiagonalMatrix CreateIdentity(int order)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <Complex> .OfValue(order, order, One)));
 }
 internal DiagonalMatrix(DiagonalMatrixStorage<Complex32> storage)
     : base(storage)
 {
     _storage = storage;
     _data = _storage.Data;
 }
 internal DiagonalMatrix(DiagonalMatrixStorage<float> storage)
     : base(storage)
 {
     _storage = storage;
     _data = _storage.Data;
 }
 /// <summary>
 /// Create a new diagonal matrix as a copy of the given other matrix.
 /// This new matrix will be independent from the other matrix.
 /// The matrix to copy from must be diagonal as well.
 /// A new memory block will be allocated for storing the matrix.
 /// </summary>
 public static DiagonalMatrix OfMatrix(Matrix <float> matrix)
 {
     return(new DiagonalMatrix(DiagonalMatrixStorage <float> .OfMatrix(matrix.Storage)));
 }
Example #34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DiagonalMatrix"/> class.
 /// </summary>
 public DiagonalMatrix(DiagonalMatrixStorage<double> storage)
     : base(storage)
 {
     _storage = storage;
     _data = _storage.Data;
 }
Example #35
0
 public DiagonalMatrix(double[,] array)
     : this(DiagonalMatrixStorage <double> .OfArray(array))
 {
 }