Esempio n. 1
0
 public NArray(StorageLocation location, T[,] value)
 {
     Length      = value.Length;
     RowCount    = value.GetLength(0);
     ColumnCount = value.GetLength(1);
     _storage    = StorageCreator.NewStorage(location, value);
 }
Esempio n. 2
0
 public NArray(NArrayStorage <T> storage)
 {
     _storage    = storage;
     RowCount    = storage.RowCount;
     ColumnCount = storage.ColumnCount;
     Length      = storage.Length;
 }
Esempio n. 3
0
 public NArray(StorageLocation location, int rowCount, int columnCount)
 {
     RowCount    = rowCount;
     ColumnCount = columnCount;
     Length      = RowCount * ColumnCount;
     _storage    = StorageCreator.NewStorage <T>(location, rowCount, columnCount);
 }
 public static NArray <T> CreateNArray <T>(NArrayStorage <T> storage)
 {
     if (typeof(T) == typeof(double))
     {
         return(new NArray(storage as NArrayStorage <double>) as NArray <T>);
     }
     //else if (typeof(T) == typeof(int)) return new NArrayInt(storage as NArrayStorage<int>) as NArray<T>;
     else
     {
         return(null);
     }
 }
Esempio n. 5
0
 private bool StorageMatches(NArrayStorage <T> storage)
 {
     return(storage.RowCount == RowCount && storage.ColumnCount == ColumnCount);
 }
Esempio n. 6
0
 public NArray(StorageLocation location, T[] value)
 {
     RowCount    = Length = value.Length;
     ColumnCount = 1;
     _storage    = StorageCreator.NewStorage(location, value);
 }
Esempio n. 7
0
 public NArray(StorageLocation location, int length)
 {
     RowCount    = Length = length;
     ColumnCount = 1;
     _storage    = StorageCreator.NewStorage <T>(location, length, 1);
 }
 /// <summary>
 /// Creates a copy of a sub-matrix, allocating new storage.
 /// </summary>
 /// <param name="target"></param>
 /// <param name="sourceRowIndex"></param>
 /// <param name="targetRowIndex"></param>
 /// <param name="rowCount"></param>
 /// <param name="sourceColumnIndex"></param>
 /// <param name="targetColumnIndex"></param>
 /// <param name="columnCount"></param>
 internal abstract void CopySubMatrixTo(NArrayStorage <T> target,
                                        int sourceRowIndex, int targetRowIndex, int rowCount,
                                        int sourceColumnIndex, int targetColumnIndex, int columnCount);
 internal abstract bool Matches(NArrayStorage <T> other);