<< Back to previous view

[CRRBV-9] Repeated subvec and catvec fails Created: 17/Mar/15  Updated: 25/Mar/15

Status: Open
Project: core.rrb-vector
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Neil Kirsopp Assignee: Michał Marczyk
Resolution: Unresolved Votes: 0
Labels: None

Attachments: Text File subvec-catvec-2.patch     Text File subvec-catvec.patch    
Patch: Code and Test

 Description   

The attached patch contains a test which fails for both the Clojure and ClojureScript implementations. It simply repeatedly calls subvec and catvec to assemble an interleaved vector. The patch attached contains fixes for Clojure only. I will investigate the fixes for CLJS, but thought it best to raise an issue with my findings so far.

2371 is the minimum length that exhibits the behaviour (triggers an ArrayIndexOutOfBoundsException).



 Comments   
Comment by Neil Kirsopp [ 17/Mar/15 10:45 AM ]

New patch passing tests in Clojure and ClojureScript.

Comment by Michał Marczyk [ 25/Mar/15 8:30 PM ]

Thanks so much once again! I've applied your patch to master and added a test.check-based version of your test-reduce-subvec-catvec test (keeping the original breaking example).





[CRRBV-2] Efficient reverse resulting in reversed rrb-vector Created: 20/Dec/13  Updated: 20/Dec/13

Status: Open
Project: core.rrb-vector
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Major
Reporter: Gunnar Völkel Assignee: Michał Marczyk
Resolution: Unresolved Votes: 0
Labels: enhancement


 Description   

Is it possible to implement an efficient reverse on a rrb-vector resulting in an rrb-vector? This would be pretty useful in scenarios like the 2-opt neighborhood for local search for the Traveling Salesman Problem. The complete operation is as follows.

Given: a = [a_0, a_1, ..., a_{n-1}, a_{n}, a_{n+1}, ..., a_{n+k-2}, a_{n+k-1}, a_{n+k}, ..., a_{n+k+m-1}]
Goal: [a_0, a_1, ..., a_{n-1}, a_{n+k-1}, a_{n+k-2}, ..., a_{n+1}, a_{n}, a_{n+k}, ..., a_{n+k+m-1}]

Possible Clojure implementation of the described operation:

(let [x (subvec a 0 n), y (subvec a n (+ n k)), z (subvec a (+ n k))]
 (catvec x, (reverse-vec y), z))





Generated at Sat Apr 18 06:54:13 CDT 2015 using JIRA 4.4#649-r158309.