NAME

SPVM::Matrix::Double - double Matrix

SYNOPSYS

my $values = new double[10]; my $rows_length = 2; my $columns_length = 3; my $matrix = SPVM::Matrix::Double->new($values, $rows_length, $columns_length);

Accessors

my $values = $matrix->values; my $rows_length= $matrix->rows_length; my $columns_length = $matrix->columns_length;

DESCRIPTION

SPVM::Matrix::Double is double Matrix.

METHODS

new : SPVM::Matrix::Double ($values : ${element_type}[], $rows_length: int, $columns_length : int)

my $values = new double[10]; my $rows_length = 2; my $columns_length = 3; my $matrix = SPVM::Matrix::Double->new($values, $rows_length, $columns_length);

Arguments:

1. Values. this value is set to values field. Note that the reference is set to values field not creating new array which elements is copied from argument array.

2. Row. This value is set to rows_length field.

3. Column. This value is set to columns_length field.

Return Value:

Matrix object.

Exception:

1. If Values is not defined, a exception occurs.

2. If Values length is different from Row * Column, a exception occurs.

values : ${element_type}[] ()

my $values = $matrix->values;

Get values field. Note that get the reference of values field not creating new array which elements is copied from values field.

rows_length : int ()

my $rows_length= $matrix->rows_length;

Get rows_length field.

columns_length : int ()

my $columns_length = $matrix->columns_length;

Get columns_length field.

to_string : string ()

my $string = $matrix->to_string;

Convert Matrix Content to String. Each column is joined 1 space and Each row is end with \n

1 3 5 2 4 6

Matrix Features

Values is always defined

values field is alway defined after new matrix object.

Array length of Values is always Row length * Column length

The array length of values is always rows_length field * columns_length field.

Column-major

Matrix is Column-major.

# Matrix # $x11 $x12 $x13 # $x21 $x22 $x23 my $values = [$x11, $x21, $x12, $x22, $x13, $x23]; my $rows_length= 2; my $columns_length = 3; my $matrix = SPVM::Matrix::Double->new($values, $rows_length, $columns_length);

Imutable Things

The following fields is imutable.

1. values field

2. rows_length field

3. columns_length field

Mutable Things

The following thing is mutable.

1. Each value of values field.

# Can set each value of values field. $matrix->values->[0] = $x11;