Beispiel #1
0
 public void Code(Type t, ref IArrayTensor4 value)
 {
     value = (IArrayTensor4)FastObjectFactory.ObjectFactory(t)();
     Array array  = null; Code(value.ArrayType, ref array); value.Array = array;
     long  origin = 0L; CodeLong(ref origin); value.Origin = origin;
     V4l   length = default(V4l); CodeV4l(ref length); value.Size = length;
     V4l   delta  = default(V4l); CodeV4l(ref delta); value.Delta = delta;
 }
Beispiel #2
0
        /// <summary>
        /// Calculates the sum for a given set of V4ls.
        /// </summary>
        public static V4l Sum(this V4l[] vectors)
        {
            V4l sum = V4l.Zero;

            for (var i = 0; i < vectors.Length; i++)
            {
                sum += vectors[i];
            }

            return(sum);
        }
Beispiel #3
0
        /// <summary>
        /// Calculates the sum for a given set of V4ls.
        /// </summary>
        public static V4l Sum(this IEnumerable <V4l> vectors)
        {
            V4l sum = V4l.Zero;

            foreach (var e in vectors)
            {
                sum += e;
            }

            return(sum);
        }
Beispiel #4
0
 /// <summary>
 /// Create a valid image tensor4, with stride appropriate for the
 /// given size.
 /// </summary>
 public static Tensor4 <T> CreateImageTensor4 <T>(this V4l size)
 {
     return(new Tensor4 <T>(0L, size,
                            new V4l(size.W, size.W * size.X, size.W * size.X * size.Y, 1L)));
 }
 public void Write(V4l x)
 {
     Write(x.X); Write(x.Y); Write(x.Z); Write(x.W);
 }
Beispiel #6
0
        // public IEnumerable<INode> SubNodes { get { return Enumerable.Empty<INode>(); } }

        #endregion

        #region Static Creator Functions

        public static Tensor4 <T> CreateTensor4 <T>(V4l size)
        {
            return(size.CreateImageTensor4 <T>());
        }
Beispiel #7
0
 /// <summary>Computes MD5 hash of given data.</summary>
 public static Guid ComputeMd5Hash(this V4l x)
 => ComputeMd5Hash(bw => { bw.Write(x.X); bw.Write(x.Y); bw.Write(x.Z); bw.Write(x.W); });