示例#1
0
        /**
         * Returns Kronecker tensor with specified upper and lower indices.
         *
         * @param index1 first index
         * @param index2 second index
         * @return Kronecker tensor with specified upper and lower indices
         * @throws IllegalArgumentException if indices have same states
         * @throws IllegalArgumentException if indices have different types
         */
        public SimpleTensor CreateKronecker(uint index1, uint index2)
        {
            byte type;

            if ((type = IndicesUtils.getType(index1)) != IndicesUtils.getType(index2) || IndicesUtils.getRawStateInt((uint)index1) == IndicesUtils.getRawStateInt((uint)index2))
            {
                throw new ArgumentException("This is not kronecker indices!");
            }

            if (!isMetric(type) && IndicesUtils.getState(index2))
            {
                var t = index1;
                index1 = index2;
                index2 = t;
            }

            ISimpleIndices indices = IndicesFactory.createSimple(null, index1, index2);
            var            nd      = nameManager.mapNameDescriptor(nameManager.getKroneckerName(), new StructureOfIndices(indices));
            var            name    = nd.Id;

            return(Tensor.SimpleTensor(name, indices));
        }
示例#2
0
 public StructureOfIndices(ISimpleIndices indices)
 {
     this.indices = indices;
 }
示例#3
0
 public static SimpleTensor SimpleTensor(int name, ISimpleIndices indices)
 {
     throw new NotImplementedException();
 }
示例#4
0
 public TensorField(int name, ISimpleIndices indices, Tensor[] args, ISimpleIndices[] argIndices)
     : base(name, indices)
 {
     Args       = args;
     ArgIndices = argIndices;
 }
示例#5
0
 /**
  * Returns string name of tensor. The argument can be {@code null}.
  *
  * @param indices indices (in case of metric or Kronecker) and null in other cases
  * @return string name of tensor
  */
 public abstract string GetName(ISimpleIndices indices);
示例#6
0
 public SimpleTensor(int name, ISimpleIndices indices)
 {
     Name          = name;
     SimpleIndices = indices ?? throw new ArgumentNullException(nameof(indices));
 }