コード例 #1
0
        public INDimensionalVector ScalarMultiply(INDimensionalVector factor)
        {
            var result = new NDimensionalVector();

            for (var i = 0; i < Count && i < factor.Count; i++)
            {
                result[i] = this[i] * factor[i];
            }
            return(result);
        }
コード例 #2
0
        public INDimensionalVector Inverse()
        {
            var result = new NDimensionalVector();

            for (var i = 0; i < Count; i++)
            {
                result[i] = -this[i];
            }
            return(result);
        }
コード例 #3
0
        private INDimensionalVector Adder(INDimensionalVector value, AdderArgument type)
        {
            var length = GetBiggerLength(value);

            var result = new NDimensionalVector();

            for (var i = 0; i < length; i++)
            {
                if (i >= _vector.Count)
                {
                    result[i] = (int)type * value[i];
                }
                else if (i >= value.Count)
                {
                    result[i] = this[i];
                }
                else
                {
                    result[i] = this[i] + (int)type * value[i];
                }
            }
            return(result);
        }