Name

SPVM::R::NDArray - N-Dimensional Array Base Class

Description

The R::NDArray class in SPVM represetns n-dimensional array and it is the base class of classes that represents typed n-dimensional arrays.

Usage

use R::NDArray;

Details

R::NDArray is column major.

Fields

data

has data : protected ro object;

An array of numeric type, multi-numeric type, or object type.

dim

has dim : int[];

Dimensions.

method dim : int[] ();

Creates a new array, copies the elements of this field, and returns the array.

method set_dim : void ($dim : int[]);

The dimensions $dim is normalized by R::Util#normalize_dim method, checks the normalized dim by R::Util#check_length method, and sets this field to the normalized dim.

Exceptions:

set_dim Method:

If "is_dim_read_only" is a true value, an exception is thrown.

Exceptions thrown by R::Util#normalize_dim method could be thrown.

Exceptions thrown by R::Util#check_length method could be thrown.

is_dim_read_only

has is_dim_read_only : ro byte;

If this field is a true value, it indicates "dim" field is read only, otherwise writable.

Class Methods

new

static method new : R::NDArray ($options : object[] = undef);

Instance Methods

init

protected method init : void ($options : object[] = undef);

make_dim_read_only

method make_dim_read_only : void ();

nrow

method nrow : int ();

ncol

method ncol : int ();

length

method length : int ();

is_empty

method is_empty : int ();

is_scalar

method is_scalar : int ();

is_vector

method is_vector : int ();

is_matrix

method is_matrix : int ();

is_square_matrix

method is_square_matrix : int ();

drop_dim

method drop_dim : void ($index : int = -1);

expand_dim

method expand_dim : void ($index : int = -1);

create_default_data

method create_default_data : object ($length : int = 0);

elem_to_string

method elem_to_string : string ($data : object, $data_index : int);

elem_assign

method elem_assign : void ($dist_data : object, $dist_data_index : int, $src_data : object, $src_data_index : int);

elem_clone

method elem_clone : void ($dist_data : object, $dist_data_index : int, $src_data : object, $src_data_index : int);

elem_cmp

method elem_cmp : int ($data : object, $a_data_index : int, $b_data_index : int);

to_string_ndarray

method to_string_ndarray : R::NDArray::String ();

Converts this n-dimensional array to a n-dimensional array of R::NDArray::String and returns it.

elem_size

method elem_size : int ();

elem_type_name

method elem_type_name : string ();

is_numeric_ndarray

method is_numeric_ndarray : int ();

is_mulnum_ndarray

method is_mulnum_ndarray : int ();

is_any_numeric_ndarray

method is_any_numeric_ndarray : int ();

is_object_ndarray

method is_object_ndarray : int ();

clone

method clone : R::NDArray ($shallow : int = 0);

Clones this n-dimensional array and returns it.

slice

method slice : R::NDArray ($asix_indexes_product : R::NDArray::Int[]);

Slices this n-dimensional array using the cartesian product of asix indexes $asix_indexes_product and returns it.

slice_set

method slice_set : void ($asix_indexes_product : R::NDArray::Int[], $ndarray : R::NDArray);

to_string

method to_string : string ();

order

method order : R::NDArray::Int ();

set_order

method set_order : void ($indexes_ndarray : R::NDArray::Int);

sort_asc

method sort_asc : void ();

sort_desc

method sort_desc : void ();

Well Known Child Classes

Copyright & License

Copyright (c) 2024 Yuki Kimoto

MIT License