The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::R::NDArray::AnyObject - N-Dimensional Array of object Type.

Description

R::NDArray::AnyObject class in SPVM represents n-dimensional array of object type.

Usage

  use R::NDArray::AnyObject;
  
  my $ndarray = R::NDArray::AnyObject->new({data => [(object)1, 2, 3, 4, 5, 6], dim => [3, 2]});

Super Class

R::NDArray

Field

data

method data : object[] ();

Same as R::NDArray#data method, but the return type is different.

Class Methods

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

Creates a new R::NDArray::AnyObject and returns it.

This method calls R::NDArray#init method given the options $options.

Instance Methods

create_default_data

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

Creates a default data given the length $length and returns it.

elem_to_string

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

Converts an element $data at index $data_index to a string and returns it.

elem_assign

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

Assigns the element $src_data at index $src_data_index to the element $dist_data at index $dist_data_index.

elem_clone

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

Copies the element $src_data at index $src_data_index to the element $dist_data at index $dist_data_index.

elem_is_na

method elem_is_na : int ($data : object[], $data_index : int);

Checks if an element represets NA.

If the element $data at index $data_index is not defined, returns 1, otherwise returns 0.

clone

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

Same as R::NDArray#clone method, but the return type is different.

slice

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

Same as R::NDArray#slice method, but the return type is different.

Copyright & License

Copyright (c) 2024 Yuki Kimoto

MIT License