-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-35411: [MATLAB] Create a templated C++ Proxy Class for Numeric Arrays #35479
Conversation
classes for numeric arrays. Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
arrays. Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
…lmax, etc.) 2. Add DeepCopy parameterization to test points. Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
layer. Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Kevin Gurney <kgurney@mathworks.com>
Thanks for the feedback @kou! Let us know if you have any other comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Benchmark runs are scheduled for baseline = 7f3e87d and contender = b372242. b372242 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
['Python', 'R'] benchmarks have high level of regressions. |
…ic Arrays (apache#35479) ### Rationale for this change This pull request is a followup to apache#34563. To facilitate the implementation of future array types, we would like to first create a C++ template class for numeric arrays. We also want to start adding basic tests for the array functionality in the MATLAB interface. ### What changes are included in this PR? 1. Added a C++ template Class called `NumericArray` templated on `CType`. 2. Re-implemented the `Float64Array` C++ proxy class in terms of the new template class, i.e. `NumericArray<double>`. 3. Added a method called `double()` on the MATLAB Float64Array class to convert the arrow.[Type]Array to a MATLAB `double` array. 4. Added basic tests for round-tripping float64 arrays. 5. Created a base C++ proxy `Array` class that all proxy array classes will inherit from. 6. Renamed `Print()` to `ToString()` and made it return a string instead of printing to the screen. ### Are these changes tested? Yes, we added automated test cases to the test class `tFloat64Array.m`. In addition, we manually qualified these changes on macOS. ### Are there any user-facing changes? Yes, the `Print()` method is no longer public and there is now a method called `double()` on `arrow.array.Float64Array`. Included below is a simple example of using the `double()` method: ```matlab >> arrowArray = arrow.array.Float64Array([1, 2, 3]) arrowArray = [ 1, 2, 3 ] >> matlabArray = double(arrowArray) matlabArray = 1 2 3 >> class(arrowArray) ans = 'arrow.array.Float64Array' >> class(matlabArray) ans = 'double' ``` ### Future Directions 1. Support the rest of the numeric types. 2. Add an abstract MATLAB base class called `arrow.array.Array`. 3. Continue building out the methods (e.g. `length()`) 4. Support `null` values (validity bitmap). 5. Handle converting non-ascii characters from `UTF-8` to `UTF-16`. 6. Handle errors in the C++ layer. * Closes: apache#35411 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
…ic Arrays (apache#35479) ### Rationale for this change This pull request is a followup to apache#34563. To facilitate the implementation of future array types, we would like to first create a C++ template class for numeric arrays. We also want to start adding basic tests for the array functionality in the MATLAB interface. ### What changes are included in this PR? 1. Added a C++ template Class called `NumericArray` templated on `CType`. 2. Re-implemented the `Float64Array` C++ proxy class in terms of the new template class, i.e. `NumericArray<double>`. 3. Added a method called `double()` on the MATLAB Float64Array class to convert the arrow.[Type]Array to a MATLAB `double` array. 4. Added basic tests for round-tripping float64 arrays. 5. Created a base C++ proxy `Array` class that all proxy array classes will inherit from. 6. Renamed `Print()` to `ToString()` and made it return a string instead of printing to the screen. ### Are these changes tested? Yes, we added automated test cases to the test class `tFloat64Array.m`. In addition, we manually qualified these changes on macOS. ### Are there any user-facing changes? Yes, the `Print()` method is no longer public and there is now a method called `double()` on `arrow.array.Float64Array`. Included below is a simple example of using the `double()` method: ```matlab >> arrowArray = arrow.array.Float64Array([1, 2, 3]) arrowArray = [ 1, 2, 3 ] >> matlabArray = double(arrowArray) matlabArray = 1 2 3 >> class(arrowArray) ans = 'arrow.array.Float64Array' >> class(matlabArray) ans = 'double' ``` ### Future Directions 1. Support the rest of the numeric types. 2. Add an abstract MATLAB base class called `arrow.array.Array`. 3. Continue building out the methods (e.g. `length()`) 4. Support `null` values (validity bitmap). 5. Handle converting non-ascii characters from `UTF-8` to `UTF-16`. 6. Handle errors in the C++ layer. * Closes: apache#35411 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
…ic Arrays (apache#35479) ### Rationale for this change This pull request is a followup to apache#34563. To facilitate the implementation of future array types, we would like to first create a C++ template class for numeric arrays. We also want to start adding basic tests for the array functionality in the MATLAB interface. ### What changes are included in this PR? 1. Added a C++ template Class called `NumericArray` templated on `CType`. 2. Re-implemented the `Float64Array` C++ proxy class in terms of the new template class, i.e. `NumericArray<double>`. 3. Added a method called `double()` on the MATLAB Float64Array class to convert the arrow.[Type]Array to a MATLAB `double` array. 4. Added basic tests for round-tripping float64 arrays. 5. Created a base C++ proxy `Array` class that all proxy array classes will inherit from. 6. Renamed `Print()` to `ToString()` and made it return a string instead of printing to the screen. ### Are these changes tested? Yes, we added automated test cases to the test class `tFloat64Array.m`. In addition, we manually qualified these changes on macOS. ### Are there any user-facing changes? Yes, the `Print()` method is no longer public and there is now a method called `double()` on `arrow.array.Float64Array`. Included below is a simple example of using the `double()` method: ```matlab >> arrowArray = arrow.array.Float64Array([1, 2, 3]) arrowArray = [ 1, 2, 3 ] >> matlabArray = double(arrowArray) matlabArray = 1 2 3 >> class(arrowArray) ans = 'arrow.array.Float64Array' >> class(matlabArray) ans = 'double' ``` ### Future Directions 1. Support the rest of the numeric types. 2. Add an abstract MATLAB base class called `arrow.array.Array`. 3. Continue building out the methods (e.g. `length()`) 4. Support `null` values (validity bitmap). 5. Handle converting non-ascii characters from `UTF-8` to `UTF-16`. 6. Handle errors in the C++ layer. * Closes: apache#35411 Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com> Co-authored-by: sgilmore10 <74676073+sgilmore10@users.noreply.github.com> Co-authored-by: Kevin Gurney <kgurney@mathworks.com> Co-authored-by: Sutou Kouhei <kou@cozmixng.org> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Rationale for this change
This pull request is a followup to #34563. To facilitate the implementation of future array types, we would like to first create a C++ template class for numeric arrays. We also want to start adding basic tests for the array functionality in the MATLAB interface.
What changes are included in this PR?
NumericArray
templated onCType
.Float64Array
C++ proxy class in terms of the new template class, i.e.NumericArray<double>
.double()
on the MATLAB Float64Array class to convert the arrow.[Type]Array to a MATLABdouble
array.Array
class that all proxy array classes will inherit from.Print()
toToString()
and made it return a string instead of printing to the screen.Are these changes tested?
Yes, we added automated test cases to the test class
tFloat64Array.m
. In addition, we manually qualified these changes on macOS.Are there any user-facing changes?
Yes, the
Print()
method is no longer public and there is now a method calleddouble()
onarrow.array.Float64Array
.Included below is a simple example of using the
double()
method:Future Directions
arrow.array.Array
.length()
)null
values (validity bitmap).UTF-8
toUTF-16
.