public static Array <Real> CombineWithBias(this Array <Real> t, Array <Real> x, Array <Real> y, Array <Real> result = null, Real beta = 0) { if (t.Shape.Length != 3 && x.Shape.Length != 1 && y.Shape.Length != 1) { throw new ArgumentException(); } if (t.Shape[2] != x.Shape[0] + 1 && t.Shape[1] != y.Shape[0] + 1) { throw new ArgumentException(); } result = t[_, Slicer.Upto(-1), Slicer.Upto(-1)].Combine21(x, y, result: result); // TODO check this mess //var biasY = t[_, Slicer.Until(-1), -1].Dot(y); t[_, Slicer.Upto(-1), -1].Dot(y, result: result, beta: 1); //Doesn't work actually //int offY = y.offset[0]; //int offT = t.offset[0] + t.offset[1] + t.offset[2] + (t.Shape[2] - 1) * t.Stride[2]; //for (int j = 0; j < y.Shape[0]; ++j) //{ // Blas.axpy(t.Shape[0], y.Values[offY], t.Values, offT, t.Stride[0], result.Values, result.offset[0], result.Stride[0]); // offY += y.Stride[0]; // offT += t.Stride[1]; //} //var biasX = t[_, -1, Slicer.Until(-1)].Dot(x); t[_, -1, Slicer.Upto(-1)].Dot(x, result: result, beta: 1); //var biasXY = t[_, -1, -1]; result.Acc(t[_, -1, -1]); //result = result + biasX + biasY + biasXY; return(result); }
private void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers, SliceFile sf) { try { if (InvokeRequired) { BeginInvoke(new MethodInvoker(delegate() { SliceEv(ev, layer, totallayers, sf); })); } else { switch (ev) { case Slicer.eSliceEvent.eSliceStarted: Text = ""; break; case Slicer.eSliceEvent.eSliceCompleted: //show the gcode Text = UVDLPApp.Instance().m_gcode.RawGCode; break; } } } catch (Exception ex) { DebugLogger.Instance().LogError(ex.Message); } }
public void CopyBranchNodes_17() { const int TWO_BUCKETS_LONG = 32; const int MAX_VALUES = 17; ushort[] BRANCH_VALUES = new ushort[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, }; var row = new RowBranch { Keys = new ushort[TWO_BUCKETS_LONG], }; Slicer.CopyBranchNodes(BRANCH_VALUES, 0, MAX_VALUES, TWO_BUCKETS_LONG, row); for (var i = 0; i < MAX_VALUES; i += 1) { Assert.AreEqual(BRANCH_VALUES[i], row.Keys[i]); } for (var i = MAX_VALUES; i < TWO_BUCKETS_LONG; i += 1) { Assert.AreEqual(ushort.MaxValue, row.Keys[i]); } }
public static Polyline[][] Create(Mesh mesh, double height, Interval modelRegion) { var slicer = new Slicer(mesh, height, modelRegion); slicer.Slice(); return(slicer.Contours); }
public static Slice[] SlicesWithoutBias(this Array <Real> a) { var slices = a.Slices(); slices[slices.Length - 1] = Slicer.Upto(-1); return(slices); }
static string trailingSpaces(string text) { var lines = text.Split(@"\r\n"); var matcher = new Matcher(); for (var i = 0; i < lines.Length; i++) { if (lines[i].IsEmpty()) { continue; } if (matcher.IsMatch(lines[i], @"([ \t]*)$")) { Slicer space = matcher[0, 1]; for (var j = 0; j < space.Length; j++) { space[j, 1] = space[j, 1] == "\t" ? "¬" : "•"; } matcher[0, 1] = space.ToString(); } lines[i] = matcher.ToString(); } return(lines.Listify("\r\n")); }
public static void CreatePivot(string tableSource, int[] pageFields, int[] rowFields, int[] dataFields, string pivotTableName = "Pivot Table", string[] slicerColumns = null) { Microsoft.Office.Interop.Excel.Worksheet worksheet = new Microsoft.Office.Interop.Excel.Worksheet(); Workbook workbook = Globals.ThisAddIn.Application.ActiveWorkbook; worksheet = workbook.Worksheets.Add(After: workbook.ActiveSheet); worksheet.Name = "Pivot"; ListObject table = GetTable(tableSource); Range rng = table.Range; worksheet.PivotTableWizard( XlPivotTableSourceType.xlDatabase, rng, worksheet.Range["A1"], pivotTableName ); PivotTable pivot = (PivotTable)worksheet.PivotTables(pivotTableName); //pivot.HasAutoFormat = true; pivot.ColumnGrand = true; pivot.RowGrand = true; for (int i = 0; i < pageFields.Length; i++) { PivotField field1 = pivot.PivotFields(pageFields[i]); field1.Orientation = XlPivotFieldOrientation.xlPageField; field1.Position = i + 1; field1.CurrentPage = "(All)"; } for (int i = 0; i < rowFields.Length; i++) { PivotField field1 = pivot.PivotFields(rowFields[i]); field1.Orientation = XlPivotFieldOrientation.xlRowField; field1.Position = i + 1; } PivotField columnField = pivot.PivotFields(); columnField.Orientation = XlPivotFieldOrientation.xlColumnField; columnField.Position = 1; for (int i = 0; i < dataFields.Length; i++) { PivotField field1 = pivot.PivotFields(dataFields[i]); field1.Orientation = XlPivotFieldOrientation.xlDataField; field1.Position = 1 + i; field1.Function = XlConsolidationFunction.xlSum; } //Add Slicers SlicerCaches caches = workbook.SlicerCaches; int counter = 1; if (slicerColumns != null) { foreach (string s in slicerColumns) { SlicerCache cache = caches.Add(pivot, s, s); Slicers slicers = cache.Slicers; Slicer slicer = slicers.Add(worksheet, Type.Missing, s, s, 160 * counter, 10, 144, 200); counter++; } } }
public static void Run() { // ExStart:1 // Load sample Excel file containing a table. Workbook workbook = new Workbook(sourceDir + "sampleCreateSlicerToExcelTable.xlsx"); // Access first worksheet. Worksheet worksheet = workbook.Worksheets[0]; // Access first table inside the worksheet. ListObject table = worksheet.ListObjects[0]; // Add slicer int idx = worksheet.Slicers.Add(table, 0, "H5"); Slicer slicer = worksheet.Slicers[idx]; slicer.Placement = PlacementType.FreeFloating; slicer.RowHeightPixel = 50; slicer.WidthPixel = 500; slicer.Title = "Aspose"; slicer.AlternativeText = "Alternate Text"; slicer.IsPrintable = false; slicer.IsLocked = false; // Refresh the slicer. slicer.Refresh(); // Save the workbook in output XLSX format. workbook.Save(outputDir + "outputChangeSlicerProperties.xlsx", SaveFormat.Xlsx); // ExEnd:1 Console.WriteLine("ChangeSlicerProperties executed successfully."); }
public void CopyBranchNodes_05() { const int BUCKET_SIZE = 16; var BRANCH_VALUES = new ushort[] { 11, 12, 13, 14, 15 }; const int MAX_VALUES = 5; var row = new RowBranch { Keys = new ushort[BUCKET_SIZE], }; Slicer.CopyBranchNodes(BRANCH_VALUES, 0, MAX_VALUES, BUCKET_SIZE, row); for (var i = 0; i < MAX_VALUES; i += 1) { Assert.AreEqual(BRANCH_VALUES[i], row.Keys[i]); } for (var i = MAX_VALUES; i < BUCKET_SIZE; i += 1) { Assert.AreEqual(ushort.MaxValue, row.Keys[i]); } }
void Slice(SliceConfigurationFile sliceConfigurationFile) { SliceConfiguration sliceConfigurationToUse = new SliceConfiguration(sliceConfigurationFile.SliceConfiguration); var slicer = new Slicer(sliceConfigurationToUse, new VersionDependentDataCopier()); string additionalDetails; try { additionalDetails = slicer.InitializeSlice(new CustomTreeDataHandler()); } catch (System.Exception exception) { SliceException sliceException = exception as SliceException; if (sliceException != null) { EditorUtility.DisplayDialog("Slicing Error", sliceException.ReasonSliceFailed, "OK"); return; } SliceCanceledException cancelException = exception as SliceCanceledException; if (cancelException != null) { return; } throw exception; } if (additionalDetails != "") { Debug.Log(additionalDetails); } }
public override string ToString() { if (success) { var result = new StringBuilder("%("); Slicer slicer = visibleSpaces(input); foreach (var match in matches) { slicer.Reset(); slicer[match.Index, match.Length] = "§".Repeat(match.Length); for (var i = 1; i < match.Groups.Length; i++) { var(_, index, length) = match.Groups[i]; slicer.Reset(); slicer[index, length] = "‡".Repeat(length); } } result.Append(slicer); result.Append(")"); return(result.ToString()); } return("%(Failure)"); }
public void Setup() { _meshHelper = _mock.StrictMock(typeof(IMeshHelper)) as IMeshHelper; _geometryHelper = _mock.StrictMock(typeof(IGeometryHelper)) as IGeometryHelper; _slicer = new Slicer(_meshHelper, _geometryHelper); }
private void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers) { if (InvokeRequired) { BeginInvoke(new MethodInvoker(delegate() { SliceEv(ev, layer, totallayers); })); } else { switch (ev) { case Slicer.eSliceEvent.eSliceStarted: cmdSlice.Text = "Cancel"; prgSlice.Maximum = totallayers - 1; break; case Slicer.eSliceEvent.eLayerSliced: prgSlice.Maximum = totallayers - 1; prgSlice.Value = layer; lblMessage.Text = "Slicing Layer " + (layer + 1).ToString() + " of " + totallayers.ToString(); break; case Slicer.eSliceEvent.eSliceCompleted: lblMessage.Text = "Slicing Completed"; cmdSlice.Text = "Slice!"; Close(); break; case Slicer.eSliceEvent.eSliceCancelled: cmdSlice.Text = "Slice!"; lblMessage.Text = "Slicing Cancelled"; prgSlice.Value = 0; break; } } }
public override void RevertChanges() { Filter.RevertChanges(); Phaser.RevertChanges(); Flanger.RevertChanges(); Synth.RevertChanges(); LoFi.RevertChanges(); RingModulator.RevertChanges(); GuitarToBass.RevertChanges(); SlowGear.RevertChanges(); Transpose.RevertChanges(); PitchBend.RevertChanges(); Robot.RevertChanges(); VocalDist.RevertChanges(); Dynamics.RevertChanges(); Eq.RevertChanges(); Isolator.RevertChanges(); Octave.RevertChanges(); Pan.RevertChanges(); Tremolo.RevertChanges(); Slicer.RevertChanges(); Delay.RevertChanges(); PanningDelay.RevertChanges(); TapeEcho.RevertChanges(); GranularDelay.RevertChanges(); Roll.RevertChanges(); Chorus.RevertChanges(); Reverb.RevertChanges(); }
public Enemy SpawnEnemy(EnemyType newType, Vector2 position) { Enemy newEnemy = null; switch (newType) { case (EnemyType.Slicer): newEnemy = new Slicer(manager.thisScene, position); break; case (EnemyType.Tortoise): newEnemy = new Tortoise(manager.thisScene, position); break; case (EnemyType.Dragonfly): newEnemy = new Dragonfly(manager.thisScene, position); break; case (EnemyType.Komodo): newEnemy = new Komodo(manager.thisScene, position); break; case (EnemyType.Phantom): newEnemy = new Phantom(manager.thisScene, position); break; default: break; } return(newEnemy); }
public async Task ApplyAsync(IDocumentOperations operations, IReadOnlyList <StreamAction> streams, CancellationToken cancellation) { // Doing the filtering here to prevent unnecessary network round trips by allowing // an aggregate projection to "work" on a stream with no matching events var filteredStreams = streams .Where(x => Projection.AppliesTo(x.Events.Select(x => x.EventType))) .ToArray(); var slices = await Slicer.SliceInlineActions(operations, filteredStreams, Tenancy).ConfigureAwait(false); var martenSession = (DocumentSessionBase)operations; foreach (var slice in slices) { IStorageOperation?operation; if (Projection.MatchesAnyDeleteType(slice)) { operation = Storage.DeleteForId(slice.Id, slice.Tenant); } else { operation = await DetermineOperation(martenSession, slice, cancellation).ConfigureAwait(false); } if (operation != null) { operations.QueueOperation(operation); } } }
/// <summary> /// Must be overridden to use as an async projection. Takes a range of events, and sorts them /// into an EventSlice for each detected aggregate document /// </summary> /// <param name="store"></param> /// <param name="database"></param> /// <param name="range"></param> /// <param name="cancellation"></param> /// <returns></returns> /// <exception cref="NotSupportedException"></exception> public ValueTask <IReadOnlyList <TenantSliceGroup <TDoc, TId> > > GroupEventRange(DocumentStore store, IMartenDatabase database, EventRange range, CancellationToken cancellation) { using var session = store.OpenSession(SessionOptions.ForDatabase(database)); return(Slicer.SliceAsyncEvents(session, range.Events)); }
public void TestSlicer_Exception() { var slicer = new Slicer <int>(new [] { 0, 1, 2, 3, 4 }); slicer.NextSlice(5); slicer.NextSlice(5); }
public void registerSlicerAction(Slicer activeSlicer, int step) { if (currentActiveSlicer != null && step == 0) { currentActiveSlicer = null; isPuzzleSliced = false; UpdateBlueSlicersVisibility(_currentCameraLoaction); } else if (currentActiveSlicer == null && step > 0) { currentActiveSlicer = activeSlicer; isPuzzleSliced = true; // 현재 사용되고 있는 슬라이서를 제외한 나머지는 모두 숨긴다 foreach (Slicer slicer in childSlicers) { if (activeSlicer != slicer) { slicer.gameObject.SetActive(false); } } } puzzleManager.SetEdgeCubeVisibility(isPuzzleSliced); }
public StringNavigator(string text) { this.text = text; position = 0; length = 0; status = StatusType.Starting; }
// Update is called once per frame void Update() { if (Input.GetMouseButton(0) && !isMouseDown) { HandleOnClickDown(); } else if (Input.GetMouseButtonUp(0)) { HandleOnClickUp(); Vector3 endPositionScreen = Input.mousePosition; Ray ray = cam.ScreenPointToRay(endPositionScreen); Ray ray1 = cam.ScreenPointToRay(startPositionScreen); Vector3 normal = Vector3.Cross(ray.direction, ray1.direction).normalized; List <GameObject> objects = FindObjects(startPositionScreen, endPositionScreen); foreach (GameObject obj in objects) { Slicer.Cut(obj, startPosition, normal); } } else if (Input.GetMouseButton(0) && isMouseDown) { // Draw from start position to mouse DrawLine(); } }
public void TestSlicer() { var slicer = new Slicer<int>(new []{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}); var a = slicer.NextSlice(5); var b = slicer.NextSlice(5); Assert.IsTrue(a.SequenceEqual(new []{0, 1, 2, 3, 4})); Assert.IsTrue(b.SequenceEqual(new []{5, 6, 7, 8, 9})); }
/** * This function will slice the provided object by the plane defined in this * GameObject. We use the GameObject this script is attached to define the position * and direction of our cutting Plane. Results are then returned to the user. */ public SlicedHull SliceObject(GameObject obj) { EzySlice.Plane cuttingPlane = ComputePlaneAgainst(obj); // finally, slice the object and return the results. SlicedHull will have all the mesh // details which the application can use to do whatever it wants to do return(Slicer.Slice(obj, cuttingPlane)); }
public static bool NeedsToBeRun1(PrinterConfig printer) { var extruderCount = printer.Settings.GetValue <int>(SettingsKey.extruder_count); return(extruderCount > 1 && !printer.Settings.GetValue <bool>(SettingsKey.filament_1_has_been_loaded) && Slicer.T1OrGreaterUsed(printer)); }
private void Start() { MeshFilter f = Slicee.GetComponent <MeshFilter>(); slicer = new Slicer(f.mesh, Optimise, CheckForHoles); oldPosition = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue); oldRotation = transform.rotation; }
public void TestSlicer() { var slicer = new Slicer <int>(new [] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }); var a = slicer.NextSlice(5); var b = slicer.NextSlice(5); Assert.IsTrue(a.SequenceEqual(new [] { 0, 1, 2, 3, 4 })); Assert.IsTrue(b.SequenceEqual(new [] { 5, 6, 7, 8, 9 })); }
private void Btn_LoadSpritesheet_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog()) { if (ofd.ShowDialog() == DialogResult.OK) { Slicer.LoadImage(ofd.FileName); } } }
public Property Slice_returns_original_elements() { return(Prop.ForAll <List <int> >(array => { var slicer = new Slicer <int>(array, _MaxCount); var slices = slicer.Slice(); return array.SequenceEqual(slices.SelectMany(sl => sl)); })); }
public Property Slice_returns_first_collections_with_maxCount_elements() { return(Prop.ForAll <List <int> >(array => { var slicer = new Slicer <int>(array, _MaxCount); var slices = slicer.Slice(); return slices.Reverse().Skip(1).All(sl => sl.Length == _MaxCount); })); }
public void GetBranch_01() { var slicer = new Slicer(new SIMDRuler()); var actual = slicer.CreateRowBranch(1); Assert.IsNotNull(actual); Assert.IsNotNull(actual.Keys); Assert.AreEqual(16, actual.Keys.Length); Assert.AreEqual(1, actual.NoOfBuckets); }
public Value Each() { using (var assistant = new ParameterAssistant(Arguments)) { var block = assistant.Block(); if (block == null) { return(null); } RegionManager.Regions.Push("string-indexer"); var changes = new Hash <int, string>(); var indexes = getIndexes(); foreach (var index in indexes) { var correctedIndex = WrapIndex(index, text.Text.Length, true); assistant.SetParameterValues(text.Text.Skip(index).Take(1), index.ToString(), correctedIndex); var result = block.Evaluate(); var signal = ParameterAssistant.Signal(); if (signal == ParameterAssistant.SignalType.Breaking) { break; } switch (signal) { case ParameterAssistant.SignalType.Continuing: continue; case ParameterAssistant.SignalType.ReturningNull: return(null); } if (result != null) { changes[correctedIndex] = result.Text; } } Slicer slicer = text.Text; foreach (var item in changes) { slicer[item.Key] = item.Value; } text.Text = slicer.ToString(); RegionManager.Regions.Pop("string-indexer"); return(null); } }
public void Setup() { uut = new Slicer(); testModelLocation = Directory.GetParent( Directory.GetParent( Directory.GetParent( Environment.CurrentDirectory). ToString()). ToString()) + "\\TestModels"; }
public FSK2Decoder(int sampleRate, int symbolRate, Output output) { mSamplesPerSymbol = (int)(sampleRate / symbolRate); mNormalOutput = (output == Output.NORMAL); mSymbolRate = symbolRate; mDelayBuffer = new RadioLog.Common.BooleanAveragingBuffer(mSamplesPerSymbol); mLowPassFilter = new RadioLog.Common.BooleanAveragingBuffer(mSamplesPerSymbol); mSlicer = new Slicer(this, mSamplesPerSymbol); }
private void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers, SliceFile sf) { try { if (InvokeRequired) { BeginInvoke(new MethodInvoker(delegate() { SliceEv(ev, layer, totallayers, sf); })); } else { switch (ev) { case Slicer.eSliceEvent.eSliceStarted: SetMainMessage("Slicing Started"); break; case Slicer.eSliceEvent.eLayerSliced: break; case Slicer.eSliceEvent.eSliceCompleted: //ctl3DView1.SetNumLayers(totallayers); SetMainMessage("Slicing Completed"); String timeest = BuildManager.EstimateBuildTime(UVDLPApp.Instance().m_gcode); SetTimeMessage("Estimated Build Time: " + timeest); //show the slice in the slice view break; } } } catch (Exception ex) { DebugLogger.Instance().LogError(ex.Message); } }
public void TestSlicer_Exception() { var slicer = new Slicer<int>(new []{0, 1, 2, 3, 4}); slicer.NextSlice(5); slicer.NextSlice(5); }
private void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers, SliceFile sf) { try { if (InvokeRequired) { BeginInvoke(new MethodInvoker(delegate() { SliceEv(ev, layer, totallayers, sf); })); } else { switch (ev) { case Slicer.eSliceEvent.eSliceCompleted: SetNumLayers(totallayers); //UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eReDraw, ""); this.Update(); break; } } } catch (Exception ex) { DebugLogger.Instance().LogError(ex.Message); } }