Sha256: 5a10ca69d52ca0d7cefcb56ff285b14cf55e915a1928b830e365bc68104fefa9

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

# Copyright 2017 Kouhei Sutou <kou@clear-code.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Arrow
  class Int8DataType
    def narray_class
      Numo::Int8
    end
  end

  class Int16DataType
    def narray_class
      Numo::Int16
    end
  end

  class Int32DataType
    def narray_class
      Numo::Int32
    end
  end

  class Int64DataType
    def narray_class
      Numo::Int64
    end
  end

  class UInt8DataType
    def narray_class
      Numo::UInt8
    end
  end

  class UInt16DataType
    def narray_class
      Numo::UInt16
    end
  end

  class UInt32DataType
    def narray_class
      Numo::UInt32
    end
  end

  class UInt64DataType
    def narray_class
      Numo::UInt64
    end
  end

  class FloatDataType
    def narray_class
      Numo::SFloat
    end
  end

  class DoubleDataType
    def narray_class
      Numo::DFloat
    end
  end

  class Tensor
    def to_narray
      narray = value_data_type.narray_class.new(shape)
      narray.store_binary(buffer.data.to_s)
      narray
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
red-arrow-numo-narray-0.0.1 lib/arrow-numo-narray/to-narray.rb