Пример #1
0
 public void AddRange(BoolVector values)
 {
     kdlPINVOKE.BoolVector_AddRange(swigCPtr, BoolVector.getCPtr(values));
     if (kdlPINVOKE.SWIGPendingException.Pending)
     {
         throw kdlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #2
0
 public void SetRange(int index, BoolVector values)
 {
     kdlPINVOKE.BoolVector_SetRange(swigCPtr, index, BoolVector.getCPtr(values));
     if (kdlPINVOKE.SWIGPendingException.Pending)
     {
         throw kdlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #3
0
    public virtual float dot(BoolVector vec)
    {
        float ret = modshogunPINVOKE.StreamingBoolFeatures_dot__SWIG_0(swigCPtr, BoolVector.getCPtr(vec));

        if (modshogunPINVOKE.SWIGPendingException.Pending)
        {
            throw modshogunPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Пример #4
0
    public BoolVector get_vector()
    {
        BoolVector ret = new BoolVector(modshogunPINVOKE.StreamingBoolFeatures_get_vector(swigCPtr), true);

        if (modshogunPINVOKE.SWIGPendingException.Pending)
        {
            throw modshogunPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Пример #5
0
        internal static BoolVector CreateFilledBoolVector(int size, bool fill)
        {
            var boolVector = new BoolVector(size);

            for (int i = 0; i < size; i++)
            {
                boolVector.Add(fill);
            }
            return(boolVector);
        }
Пример #6
0
    public BoolVector get_feature_vector(int num)
    {
        BoolVector ret = new BoolVector(modshogunPINVOKE.BoolFeatures_get_feature_vector(swigCPtr, num), true);

        if (modshogunPINVOKE.SWIGPendingException.Pending)
        {
            throw modshogunPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Пример #7
0
        public void Test_negation()
        {
            BoolVector expectedResult = new BoolVector(new List <int>()
            {
                0, 0, 0, 1
            });
            BoolVector actualResult = BoolVectorAction.VectorNegation(boolVectors[4]);

            Assert.IsTrue(expectedResult.Components.SequenceEqual(actualResult.Components));
        }
Пример #8
0
        public void Test_disjunction()
        {
            BoolVector expectedResult = new BoolVector(new List <int>()
            {
                1, 1, 1, 0
            });
            BoolVector actualResult = BoolVectorAction.Disjunction(boolVectors);

            Assert.IsTrue(expectedResult.Components.SequenceEqual(actualResult.Components));
        }
Пример #9
0
    public static BoolVector get_vector(BoolVector src, bool own)
    {
        BoolVector ret = new BoolVector(modshogunPINVOKE.BoolVector_get_vector__SWIG_0(BoolVector.getCPtr(src), own), true);

        if (modshogunPINVOKE.SWIGPendingException.Pending)
        {
            throw modshogunPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
        public BoolVector isRegular()
        {
            BoolVector ret = new BoolVector(NQuantLibcPINVOKE.Schedule_isRegular__SWIG_1(swigCPtr), false);

            if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
            {
                throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #11
0
        public int setLockedJoints(BoolVector locked_joints)
        {
            int ret = kdlPINVOKE.ChainJntToJacSolver_setLockedJoints(swigCPtr, BoolVector.getCPtr(locked_joints));

            if (kdlPINVOKE.SWIGPendingException.Pending)
            {
                throw kdlPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #12
0
        public static BoolVector VectorNegation(BoolVector vector)
        {
            BoolVector resultVector = new BoolVector(vector.Components.Count);

            foreach (int comp in vector.Components)
            {
                resultVector.Components.Add(Convert.ToInt32(comp != 1));
            }
            return(resultVector);
        }
Пример #13
0
    public static BoolVector Repeat(bool value, int count)
    {
        global::System.IntPtr cPtr = swiglibPINVOKE.BoolVector_Repeat(value, count);
        BoolVector            ret  = (cPtr == global::System.IntPtr.Zero) ? null : new BoolVector(cPtr, true);

        if (swiglibPINVOKE.SWIGPendingException.Pending)
        {
            throw swiglibPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Пример #14
0
    public BoolVector GetRange(int index, int count)
    {
        global::System.IntPtr cPtr = swiglibPINVOKE.BoolVector_GetRange(swigCPtr, index, count);
        BoolVector            ret  = (cPtr == global::System.IntPtr.Zero) ? null : new BoolVector(cPtr, true);

        if (swiglibPINVOKE.SWIGPendingException.Pending)
        {
            throw swiglibPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Пример #15
0
    private void TestVector()
    {
        //申请新的Vector
        BoolVector boolVector = new BoolVector(new List <bool>()
        {
            true,
            false
        });

        //测试Vector
        for (int i = 0; i < boolVector.Count; i++)
        {
            Debug.Log(boolVector[i]);
        }
    }
        private void MergeButton_Click(object sender, RoutedEventArgs e)
        {
            EditorSubsystemManaged.getInstance().QueueActionAndBlock(new Action(() =>
            {
                StateSerializer ss   = new StateSerializer();
                BaseState cur_state  = GSM.getInstance().getStateUnderActive();
                BaseState new_state  = GSM.getInstance().getActiveState();
                BoolVector mergeMask = new BoolVector();
                foreach (var obj in objects)
                {
                    mergeMask.Add(obj.ShouldMerge);
                }

                ss.MergeStates(new_state, cur_state, mergeMask);
            }));

            this.Close();
        }
Пример #17
0
 public void Test_disjunctionNegative()
 {
     try
     {
         boolVectors.Add(new BoolVector(new List <int>()
         {
             0, 1, 1, 0, 1
         }));
         BoolVector actualResult = BoolVectorAction.Disjunction(boolVectors);
     }
     catch (ArgumentException ex)
     {
         Assert.AreEqual("All bool vectors must be the same size", ex.Message);
     }
     catch (Exception ex)
     {
         // not the right kind of exception
         Assert.Fail();
     }
 }
Пример #18
0
        private static BoolVector CalculateAction(List <BoolVector> vectors, ActionDelegate action)
        {
            int size = vectors[0].Components.Count;

            foreach (BoolVector vector in vectors)
            {
                if (vector.Components.Count != size)
                {
                    throw new ArgumentException("All bool vectors must be the same size");
                }
            }
            BoolVector resultVector = vectors[0];

            for (int i = 0; i < size; i++)
            {
                foreach (BoolVector vector in vectors)
                {
                    resultVector.Components[i] = action(resultVector.Components[i], vector.Components[i]);
                }
            }
            return(resultVector);
        }
Пример #19
0
        public void HandleControlOutputChange(BoolVector v)
        {
            ThreadPool.QueueUserWorkItem(o =>
            {
                //m1.collectNames(TextDescriptionType.TEXT_OutputName);

                RunOnGUIThread(this, () =>
                {
                    for (int i = 0; i < v.Count; i++)
                    {
                        if (ShowAllOutputsCheckbox.Checked) // || (m1.getTextDescription(TextDescriptionType.TEXT_OutputName, i) != ""))
                        {
                            ListViewItem Item = (OutputsList.Items.ContainsKey(i.ToString())) ?
                                                OutputsList.Items.Find(i.ToString(), false)[0] :
                                                OutputsList.Items.Add(new ListViewItem
                            {
                                Name = i.ToString()
                            });

                            Item.Text = m1.getTextDescription(TextDescriptionType.TEXT_OutputName, i);
                            if (Item.Text == "")
                            {
                                Item.Text = "Output " + (i + 1).ToString();
                            }
                            if (v[i])
                            {
                                Item.ImageKey = "on_symbol";
                            }
                            else
                            {
                                Item.ImageKey = "off_symbol";
                            }
                        }
                    }
                });
            });
        }
Пример #20
0
 public SwaptionVolCube1(SwaptionVolatilityStructureHandle atmVolStructure, PeriodVector optionTenors, PeriodVector swapTenors, DoubleVector strikeSpreads, QuoteHandleVectorVector volSpreads, SwapIndex swapIndexBase, SwapIndex shortSwapIndexBase, bool vegaWeightedSmileFit, QuoteHandleVectorVector parametersGuess, BoolVector isParameterFixed, bool isAtmCalibrated, SWIGTYPE_p_boost__shared_ptrT_EndCriteria_t endCriteria, double maxErrorTolerance, SWIGTYPE_p_boost__shared_ptrT_OptimizationMethod_t optMethod) : this(NQuantLibcPINVOKE.new_SwaptionVolCube1__SWIG_0(SwaptionVolatilityStructureHandle.getCPtr(atmVolStructure), PeriodVector.getCPtr(optionTenors), PeriodVector.getCPtr(swapTenors), DoubleVector.getCPtr(strikeSpreads), QuoteHandleVectorVector.getCPtr(volSpreads), SwapIndex.getCPtr(swapIndexBase), SwapIndex.getCPtr(shortSwapIndexBase), vegaWeightedSmileFit, QuoteHandleVectorVector.getCPtr(parametersGuess), BoolVector.getCPtr(isParameterFixed), isAtmCalibrated, SWIGTYPE_p_boost__shared_ptrT_EndCriteria_t.getCPtr(endCriteria), maxErrorTolerance, SWIGTYPE_p_boost__shared_ptrT_OptimizationMethod_t.getCPtr(optMethod)), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
Пример #21
0
 public SwaptionVolCube1(SwaptionVolatilityStructureHandle atmVolStructure, PeriodVector optionTenors, PeriodVector swapTenors, DoubleVector strikeSpreads, QuoteHandleVectorVector volSpreads, SwapIndex swapIndexBase, SwapIndex shortSwapIndexBase, bool vegaWeightedSmileFit, QuoteHandleVectorVector parametersGuess, BoolVector isParameterFixed, bool isAtmCalibrated) : this(NQuantLibcPINVOKE.new_SwaptionVolCube1__SWIG_3(SwaptionVolatilityStructureHandle.getCPtr(atmVolStructure), PeriodVector.getCPtr(optionTenors), PeriodVector.getCPtr(swapTenors), DoubleVector.getCPtr(strikeSpreads), QuoteHandleVectorVector.getCPtr(volSpreads), SwapIndex.getCPtr(swapIndexBase), SwapIndex.getCPtr(shortSwapIndexBase), vegaWeightedSmileFit, QuoteHandleVectorVector.getCPtr(parametersGuess), BoolVector.getCPtr(isParameterFixed), isAtmCalibrated), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
Пример #22
0
 // Constructor: boolVector v2 = new boolVector( v1 );
 public BoolVector(BoolVector that) : base()
 {
     this.CopyFromArray(that.ToArray()); return;
 }
Пример #23
0
 // Converter: boolVector v2 = boolVector.FromVector( v1 );
 public static BoolVector FromVector(BoolVector that)
 {
     return(new BoolVector(that));
 }
Пример #24
0
 public BoolVector get_vector() {
   BoolVector ret = new BoolVector(modshogunPINVOKE.StreamingBoolFeatures_get_vector(swigCPtr), true);
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Пример #25
0
        public QNetworkConvSimple(int inputWidth, int inputHeight, int inputDepth, int actionSize,
                                  int[] filterSizes, int[] filterDepths, int[] strides, bool[] pooling,
                                  int densehiddenLayers, int densehiddenSize, bool denseUseBias, DeviceDescriptor device, float denseInitialWeightScale = 0.01f)
        {
            Device         = device;
            StateSize      = inputWidth * inputHeight * inputDepth;
            ActionSize     = actionSize;
            InputDimension = new int[3] {
                inputWidth, inputHeight, inputDepth
            };


            //create actor network part
            InputState = CNTKLib.InputVariable(InputDimension, DataType.Float);

            Debug.Assert(filterSizes.Length == strides.Length && filterDepths.Length == filterSizes.Length, "Length of filterSizes,strides and filterDepth are not the same");

            var lastLayer = InputState;

            for (int i = 0; i < filterSizes.Length; ++i)
            {
                //conv layers. Use selu activaion and selu initlaization
                lastLayer = Layers.Convolution2D(lastLayer, filterDepths[i],
                                                 filterSizes[i], filterSizes[i], device, strides[i], true, true, "QConv_" + i, Mathf.Sqrt((1.0f / (filterSizes[i] * filterSizes[i]))));
                lastLayer = new SELUDef().BuildNew(lastLayer, device, "");
                //pooling
                if (pooling[i])
                {
                    lastLayer = CNTKLib.Pooling(lastLayer, PoolingType.Max, new int[] { 2, 2 }, new int[] { 2, 2 }, BoolVector.Repeat(true, 2), false, true, "pool2");
                }
            }

            lastLayer = CNTKLib.Flatten(lastLayer, new Axis(3), "Flatten");

            //dense layers
            var inputA  = new InputLayerCNTKVar(lastLayer);
            var outputA = new OutputLayerDense(actionSize, null, OutputLayerDense.LossFunction.None);

            outputA.HasBias            = false;
            outputA.InitialWeightScale = denseInitialWeightScale;
            SequentialNetworkDense qNetwork = new SequentialNetworkDense(inputA, LayerDefineHelper.DenseLayers(densehiddenLayers, densehiddenSize, denseUseBias, NormalizationMethod.None, 0, denseInitialWeightScale, new ReluDef()), outputA, device);

            //OutputQs = outputA.GetOutputVariable();
            OutputQs = outputA.GetOutputVariable();
        }
Пример #26
0
 public BoolVector(BoolVector orig) : this(modshogunPINVOKE.new_BoolVector__SWIG_5(BoolVector.getCPtr(orig)), true) {
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
Пример #27
0
 public void set_plif_use_cache(BoolVector use_cache) {
   modshogunPINVOKE.PlifMatrix_set_plif_use_cache(swigCPtr, BoolVector.getCPtr(use_cache));
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
Пример #28
0
        private static Value _Create(NDShape sampleShape, NDArrayViewPtrVector sequences, BoolVector sequenceStartFlags, DeviceDescriptor device)
        {
            global::System.IntPtr cPtr = CNTKLibPINVOKE.Value__Create__SWIG_6(NDShape.getCPtr(sampleShape), NDArrayViewPtrVector.getCPtr(sequences), BoolVector.getCPtr(sequenceStartFlags), DeviceDescriptor.getCPtr(device));
            Value ret = (cPtr == global::System.IntPtr.Zero) ? null : new Value(cPtr, true);

            if (CNTKLibPINVOKE.SWIGPendingException.Pending)
            {
                throw CNTKLibPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #29
0
 public static BoolVector get_vector(BoolVector src) {
   BoolVector ret = new BoolVector(modshogunPINVOKE.BoolVector_get_vector__SWIG_1(BoolVector.getCPtr(src)), true);
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Пример #30
0
        private static Value _CreateOneHotDouble(uint dimension, SizeTVectorVector oneHotSequences, BoolVector sequenceStartFlags, DeviceDescriptor device)
        {
            global::System.IntPtr cPtr = CNTKLibPINVOKE.Value__CreateOneHotDouble__SWIG_7(dimension, SizeTVectorVector.getCPtr(oneHotSequences), BoolVector.getCPtr(sequenceStartFlags), DeviceDescriptor.getCPtr(device));
            Value ret = (cPtr == global::System.IntPtr.Zero) ? null : new Value(cPtr, true);

            if (CNTKLibPINVOKE.SWIGPendingException.Pending)
            {
                throw CNTKLibPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #31
0
        private static Value _CreateOneHotFloat(NDShape sampleShape, SizeTVectorVector oneHotSequences, BoolVector sequenceStartFlags, DeviceDescriptor device, bool readOnly)
        {
            global::System.IntPtr cPtr = CNTKLibPINVOKE.Value__CreateOneHotFloat__SWIG_2(NDShape.getCPtr(sampleShape), SizeTVectorVector.getCPtr(oneHotSequences), BoolVector.getCPtr(sequenceStartFlags), DeviceDescriptor.getCPtr(device), readOnly);
            Value ret = (cPtr == global::System.IntPtr.Zero) ? null : new Value(cPtr, true);

            if (CNTKLibPINVOKE.SWIGPendingException.Pending)
            {
                throw CNTKLibPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #32
0
 public void set_feature_vector(BoolVector vector, int num) {
   modshogunPINVOKE.BoolFeatures_set_feature_vector(swigCPtr, BoolVector.getCPtr(vector), num);
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
Пример #33
0
 public SwaptionVolCube1(SwaptionVolatilityStructureHandle atmVolStructure, PeriodVector optionTenors, PeriodVector swapTenors, DoubleVector strikeSpreads, QuoteHandleVectorVector volSpreads, SwapIndex swapIndex, SwapIndex shortSwapIndex, bool vegaWeightedSmileFit, QuoteHandleVectorVector parametersGuess, BoolVector isParameterFixed, bool isAtmCalibrated, SWIGTYPE_p_boost__shared_ptrT_EndCriteria_t endCriteria, double maxErrorTolerance, OptimizationMethod optMethod) : this(NQuantLibcPINVOKE.new_SwaptionVolCube1__SWIG_0(SwaptionVolatilityStructureHandle.getCPtr(atmVolStructure), PeriodVector.getCPtr(optionTenors), PeriodVector.getCPtr(swapTenors), DoubleVector.getCPtr(strikeSpreads), QuoteHandleVectorVector.getCPtr(volSpreads), SwapIndex.getCPtr(swapIndex), SwapIndex.getCPtr(shortSwapIndex), vegaWeightedSmileFit, QuoteHandleVectorVector.getCPtr(parametersGuess), BoolVector.getCPtr(isParameterFixed), isAtmCalibrated, SWIGTYPE_p_boost__shared_ptrT_EndCriteria_t.getCPtr(endCriteria), maxErrorTolerance, OptimizationMethod.getCPtr(optMethod)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #34
0
 internal static HandleRef getCPtr(BoolVector obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
Пример #35
0
 public SwaptionVolCube1(SwaptionVolatilityStructureHandle atmVolStructure, PeriodVector optionTenors, PeriodVector swapTenors, DoubleVector strikeSpreads, QuoteHandleVectorVector volSpreads, SwapIndex swapIndex, SwapIndex shortSwapIndex, bool vegaWeightedSmileFit, QuoteHandleVectorVector parametersGuess, BoolVector isParameterFixed, bool isAtmCalibrated) : this(NQuantLibcPINVOKE.new_SwaptionVolCube1__SWIG_3(SwaptionVolatilityStructureHandle.getCPtr(atmVolStructure), PeriodVector.getCPtr(optionTenors), PeriodVector.getCPtr(swapTenors), DoubleVector.getCPtr(strikeSpreads), QuoteHandleVectorVector.getCPtr(volSpreads), SwapIndex.getCPtr(swapIndex), SwapIndex.getCPtr(shortSwapIndex), vegaWeightedSmileFit, QuoteHandleVectorVector.getCPtr(parametersGuess), BoolVector.getCPtr(isParameterFixed), isAtmCalibrated), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #36
0
 public virtual float dot(BoolVector vec) {
   float ret = modshogunPINVOKE.StreamingBoolFeatures_dot__SWIG_0(swigCPtr, BoolVector.getCPtr(vec));
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Пример #37
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(BoolVector obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
 public void calibrate(BlackCalibrationHelperVector helper, OptimizationMethod method, EndCriteria endCriteria, Constraint constraint, DoubleVector weights, BoolVector fixParameters)
 {
     NQuantLibcPINVOKE.MarkovFunctional_calibrate__SWIG_0(swigCPtr, BlackCalibrationHelperVector.getCPtr(helper), OptimizationMethod.getCPtr(method), EndCriteria.getCPtr(endCriteria), Constraint.getCPtr(constraint), DoubleVector.getCPtr(weights), BoolVector.getCPtr(fixParameters));
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #39
0
 public void MergeStates(BaseState src, BaseState dest, BoolVector whichObjsToMerge)
 {
     SharpMochaPINVOKE.StateSerializer_MergeStates__SWIG_0(swigCPtr, BaseState.getCPtr(src), BaseState.getCPtr(dest), BoolVector.getCPtr(whichObjsToMerge));
 }
Пример #40
0
 public BoolVector get_full_feature_vector(int num) {
   BoolVector ret = new BoolVector(modshogunPINVOKE.SparseBoolFeatures_get_full_feature_vector(swigCPtr, num), true);
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public void calibrate(CalibrationHelperVector arg0, OptimizationMethod arg1, EndCriteria arg2, Constraint constraint, DoubleVector weights, BoolVector fixParameters)
 {
     NQuantLibcPINVOKE.ShortRateModelHandle_calibrate__SWIG_0(swigCPtr, CalibrationHelperVector.getCPtr(arg0), OptimizationMethod.getCPtr(arg1), EndCriteria.getCPtr(arg2), Constraint.getCPtr(constraint), DoubleVector.getCPtr(weights), BoolVector.getCPtr(fixParameters));
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #42
0
        private void MergeButton_Click(object sender, RoutedEventArgs e)
        {
            EditorSubsystemManaged.getInstance().QueueActionAndBlock(new Action(() =>
               {
               StateSerializer ss = new StateSerializer();
               BaseState cur_state = GSM.getInstance().getStateUnderActive();
               BaseState new_state = GSM.getInstance().getActiveState();
               BoolVector mergeMask = new BoolVector();
               foreach (var obj in objects)
                   mergeMask.Add(obj.ShouldMerge);

               ss.MergeStates(new_state, cur_state, mergeMask);
               }));

            this.Close();
        }