RTensor4D

scalation.mathstat.RTensor4D
See theRTensor4D companion object
class RTensor4D(val dim: Int, val dim2: VectorI, val dim3: VectorI, val dim4: Int, var v: Array[Array[Array[Array[Double]]]]) extends Serializable

The RTensor4D class is an implementation for 3-dimensional ragged tensors. The tensor may only be ragged in the middle dimension (dim2) and whose sizes may only be dependent of the first index, e.g., i in (i, j, k). The names of the dimensions corresponds to MATLAB (row, column, sheet).

Value parameters

dim

size of the 1st level/dimension (row) of the tensor (height)

dim2

variable size of the 2nd level/dimension (column) of the tensor (width)

dim3

variable size of the 3rd level/dimension (sheet) of the tensor (depth)

dim4

size of the 4th level/dimension (channel) of the tensor (spectra)

v

the 4D array for holding the tensor elements

Attributes

Companion
object
Graph
Supertypes
trait Serializable
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(u: Array[Array[Array[Array[Double]]]])

Construct a tensor from four dimensional array.

Construct a tensor from four dimensional array.

Value parameters

u

the three dimensional array

Attributes

Concrete methods

def *(s: Double): RTensor4D

Multiply this tensor by scalar s.

Multiply this tensor by scalar s.

Value parameters

s

the scalar to multiply by

Attributes

Multiply element-wise (Hadamard product) this tensor by tensor b.

Multiply element-wise (Hadamard product) this tensor by tensor b.

Value parameters

b

the tensor to add (requires leDimensions)

Attributes

def +(b: RTensor4D): RTensor4D

Add this tensor and tensor b.

Add this tensor and tensor b.

Value parameters

b

the tensor to add (requires leDimensions)

Attributes

def +(s: Double): RTensor4D

Add this tensor and scalar s.

Add this tensor and scalar s.

Value parameters

s

the scalar to add

Attributes

def -(b: RTensor4D): RTensor4D

From this tensor subtract tensor b.

From this tensor subtract tensor b.

Value parameters

b

the tensor to add (requires leDimensions)

Attributes

def -(s: Double): RTensor4D

From this tensor subtract scalar s.

From this tensor subtract scalar s.

Value parameters

s

the scalar to add

Attributes

def /(s: Double): RTensor4D

Divide this tensor by scalar s.

Divide this tensor by scalar s.

Value parameters

s

the scalar to divide by

Attributes

def apply(i: Int, j: Int, k: Int, l: Int): Double

Retrieve the i, j, k element from the tensor.

Retrieve the i, j, k element from the tensor.

Value parameters

i

1st dimension (row) index of the tensor

j

2nd dimension (column) index of the tensor

k

3rd dimension (sheet) index of the tensor

l

4rd dimension (channel) index of the tensor

Attributes

def apply(i: Int, j: Int, k: Int): VectorD

Retrieve the i, j, k vector from this tensor.

Retrieve the i, j, k vector from this tensor.

Value parameters

i

1st dimension (row) index of the tensor

j

2nd dimension (column) index of the tensor

k

3rd dimension (sheet) index of the tensor

Attributes

def apply(i: Int, j: Int): MatrixD

Retrieve the i, j matrix from this tensor.

Retrieve the i, j matrix from this tensor.

Value parameters

i

1st dimension (row) index of the tensor

j

2nd dimension (column) index of the tensor

Attributes

def apply(i: Int): TensorD

Retrieve the i 3-tensor from this tensor.

Retrieve the i 3-tensor from this tensor.

Value parameters

i

1st dimension (row) index of the tensor

Attributes

def apply(ii: (Int, Int)): RTensor4D

Retrieve the ii._1 to ii._2 row slice of the tensor.

Retrieve the ii._1 to ii._2 row slice of the tensor.

Value parameters

ii

1st dimension (row) indices of the tensor

Attributes

def apply(ii: (Int, Int), jj: (Int, Int)): RTensor4D

Retrieve the ii._1 to ii._2, jj._1 to jj._2 row-column slice of the tensor.

Retrieve the ii._1 to ii._2, jj._1 to jj._2 row-column slice of the tensor.

Value parameters

ii

1st dimension (row) indices of the tensor (null => all)

jj

2nd dimension (column) indices of the tensor

Attributes

def apply(is: Array[Int]): RTensor4D

Retrieve the is row selections from the tensor.

Retrieve the is row selections from the tensor.

Value parameters

is

1st dimension (row) indices of the tensor

Attributes

def apply(is: Array[Int], js: Array[Int], ks: Array[Int], ls: Array[Int]): RTensor4D

Retrieve the is, js, ks row-column-sheet selections from the tensor.

Retrieve the is, js, ks row-column-sheet selections from the tensor.

Value parameters

is

1st dimension (row) indices of the tensor (null => all)

js

2nd dimension (column) indices of the tensor

ks

3rd dimension (sheet) indices of the tensor

ls

4th dimension (channel) indices of the tensor

Attributes

inline def indices2(i: Int): Range
inline def indices3(i: Int): Range
def leDimensions(b: RTensor4D): Boolean

Check whether the dimensions of this tensor are less than or equal to le those of the other tensor b.

Check whether the dimensions of this tensor are less than or equal to le those of the other tensor b.

Value parameters

b

the other matrix

Attributes

def not(is: Array[Int]): RTensor4D

Retrieve the complement of the is row selections from the tensor.

Retrieve the complement of the is row selections from the tensor.

Value parameters

is

1st dimension (row) indices of the tensor

Attributes

def set(x: Double): Unit

Set all the tensor element values to x.

Set all the tensor element values to x.

Value parameters

x

the value to set all elements to

Attributes

def setFormat(newFormat: String): Unit

Set the format to the newFormat.

Set the format to the newFormat.

Value parameters

newFormat

the new format string

Attributes

override def toString: String

Convert this tensor to a string with a double line break after each sheet and a single line break after each row.

Convert this tensor to a string with a double line break after each sheet and a single line break after each row.

Attributes

Definition Classes
Any
def update(i: Int, j: Int, k: Int, l: Int, x: Double): Unit

Update a single element of the tensor to the given value.

Update a single element of the tensor to the given value.

Value parameters

i

1st dimension (row) index of the tensor

j

2nd dimension (column) index of the tensor

k

3rd dimension (sheet) index of the tensor

l

4th dimension (channel) indices of the tensor

x

the value to be updated at the above position in the tensor

Attributes

def update(i: Int, j: Int, k: Int, x: VectorD): Unit

Update a single vector of the tensor to the given vector.

Update a single vector of the tensor to the given vector.

Value parameters

i

1st dimension (row) index of the tensor

j

2nd dimension (column) index of the tensor

k

3rd dimension (sheet) index of the tensor

x

the vector to be updated at the above position in the tensor

Attributes

def update(i: Int, j: Int, x: MatrixD): Unit

Update a single matrix of the tensor to the given matrix.

Update a single matrix of the tensor to the given matrix.

Value parameters

i

1st dimension (row) index of the tensor

j

2nd dimension (column) index of the tensor

x

the matrix to be updated at the above position in the tensor

Attributes

def update(i: Int, x: RTensorD): Unit

Update a single matrix of the tensor to the given matrix.

Update a single matrix of the tensor to the given matrix.

Value parameters

i

1st dimension (row) index of the tensor

x

the matrix to be updated at the above position in the tensor

Attributes

Concrete fields

val dim: Int
val dim2: VectorI
val dim3: VectorI
val dim4: Int
val indices: Range
val indices4: Range