ed44baa4创建于 2022年9月18日历史提交

Array Operation

Methods

================================ ============ Method Description ================================ ============ trace_ (a) Trace of a matrix reshape_ 2 methods Reshaping a vector or matrix flatten_ (a[, order]) Flatten a matrix into a vector concat_ 2 methods Concatenation of vectors conjugate_ (a) Conjugate of a vector or matrix htranspose_ (a) Hermitian transpose of a matrix hstack_ (a, b) Stack matrices horizontally vstack_ (a, b) Stack matrices vertically ================================ ============

Description

.. _trace:

.. function:: trace(a)

:param T: type parameter, implements ``Number``
:param a: Matrix<T>
:return: T

Return the trace of the matrix.

.. _reshape:

.. function:: reshape(a)

:param T: type parameter, implements ``Number``
:param a: Matrix<T>
:return: Vector<T>

Reshape a matrix into a vector, flattening along the rows.

.. function:: reshape(a, row, col)

:param T: type parameter, implements ``Number``
:param a: Vector<T>
:param row: Int64
:param col: Int64
:return: Matrix<T>

Reshape a vector into a matrix with given number of rows and columns.
Elements of the vector are listed by row first.

.. _flatten:

.. function:: flatten(a[, order])

:param T: type parameter, implements ``Number``
:param a: Matrix<T>
:param order: Bool, default to true
:return: Vector<T>

Flatten a matrix into a vector. If ``order`` is true, flattening
is by row. Otherwise it is by column.

.. _concat:

.. function:: concat(left, right)

:param T: type parameter, implements ``Number``
:param left: Vector<T>
:param right: Vector<T>
:return: Vector<T>

Concatenate two vectors.

.. function:: concat(a)

:param T: type parameter, implements ``Number``
:param a: Array<Vector<T>>
:return: Vector<T>

Concatenate an array of vectors.

.. _conjugate:

.. function:: conjugate(a)

:param T: type parameter, implements ``Complex``
:param a: Vector<T>
:return: Vector<T>

Compute conjugate of a vector.

.. function:: conjugate(a)

:param T: type parameter, implements ``Complex``
:param a: Matrix<T>
:return: Matrix<T>

Compute conjugate of a matrix.

.. _htranspose:

.. function:: htranspose(a)

:param T: type parameter, implements ``Complex``
:param a: Matrix<T>
:return: Matrix<T>

Compute the hermitian transpose of a matrix.

.. _hstack:

.. function:: hstack(a, b)

:param T: type parameter, implements ``Number``
:param a: Matrix<T>
:param b: Matrix<T>
:return: Matrix<T>

Stacking two matrices in the horizontal direction.

.. _vstack:

.. function:: vstack(a, b)

:param T: type parameter, implements ``Number``
:param a: Matrix<T>
:param b: Matrix<T>
:return: Matrix<T>

Stacking two matrices in the vertical direction.