1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
//!
//! Matrix functions operate on matrices.
//!
//! A matrix with M rows and N columns is defined by
//!
//! The dimension subscript may be omitted, if the context allows it, i.e.
//! . Matrices are represented by upper-case letters. The elements of a matrix
//! are denoted by the corresponding lower case letter and subscripts, which
//! defines the row and column number.
//! Square matrices have the same number of rows and columns, i.e.
//! .
use crate::*;
#[allow(unused_imports)]
use crate::matrix::*;
/// Calculates the determinant of a matrix.
///
/// [documentfoundation->MDETERM](https://wiki.documentfoundation.org/Documentation/Calc_Functions/MDETERM)
///
/// __Syntax__:
/// ```ods
/// MDETERM( A: Array )
/// ```
///
/// __Constraints__:
/// Only square matrices are allowed.
///
/// __Semantics__:
/// Returns the determinant of matrix A. The determinant is defined by
///
/// where P denotes a permutation of the numbers 1, 2, ..., n and
/// is the sign of the permutation, which is +1 for an even amount of
/// permutations (i.e., permutations that can be written as the composition of
/// an even number of transpositions), -1 otherwise. A transposition on 1, ...,
/// n is a permutation of 1, ..., n with exactly (n - 2) numbers fixed.
///
/// __See also__: [crate::of::minverse()],
#[inline]
pub fn mdeterm<A: Matrix>(a: A) -> FnNumber1<A> {
FnNumber1("MDETERM", a)
}
/// Returns the inverse of a matrix.
///
/// [documentfoundation->MINVERSE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/MINVERSE)
///
/// __Syntax__:
/// ```ods
/// MINVERSE( A: Array )
/// ```
///
/// __Constraints__:
/// Only square matrices are allowed.
///
/// __Semantics__:
/// Calculates the inverse
/// of matrix A. The matrix A multiplied with its inverse
/// results in the unity matrix of the same dimension as A:
///
/// Invertible matrices have a non-zero determinant. If the matrix is not
/// invertible, this function should return an Error value.
///
/// __See also__: [crate::of::mdeterm()],
#[inline]
pub fn minverse<A: Matrix>(a: A) -> FnMatrix1<A> {
FnMatrix1("MINVERSE", a)
}
/// Multiplies the matrices A and B.
///
/// [documentfoundation->MMULT](https://wiki.documentfoundation.org/Documentation/Calc_Functions/MMULT)
///
/// __Syntax__:
/// ```ods
/// MMULT( A: Array; B: Array )
/// ```
///
/// __Constraints__:
/// COLUMNS(A) = ROWS(B)
///
/// __Semantics__:
/// Returns the matrix product of the two matrices. The elements
/// of the resulting matrix
/// , are defined by:
///
/// __See also__: [crate::of::columns()], [crate::of::rows()],
#[inline]
pub fn mmult<A: Matrix, B: Matrix>(a: A, b: B) -> FnMatrix2<A, B> {
FnMatrix2("MMULT", a, b)
}
/// Creates a unit matrix of a specified dimension N.
///
/// [documentfoundation->MUNIT](https://wiki.documentfoundation.org/Documentation/Calc_Functions/MUNIT)
///
/// __Syntax__:
/// ```ods
/// MUNIT( N: Integer )
/// ```
///
/// __Constraints__:
/// The dimension has to be greater than zero.
///
/// __Semantics__:
/// Creates the unit matrix (identity matrix) of dimension N.
///
/// __See also__:
#[inline]
pub fn munit<A: Number>(n: A) -> FnMatrix1<A> {
FnMatrix1("MUNIT", n)
}
/// Returns the transpose of a matrix.
///
/// [documentfoundation->TRANSPOSE](https://wiki.documentfoundation.org/Documentation/Calc_Functions/TRANSPOSE)
///
/// __Syntax__:
/// ```ods
/// TRANSPOSE( A: Array )
/// ```
///
/// __Constraints__:
/// None
///
/// __Semantics__:
/// Returns the transpose AT of a matrix A, i.e. rows and columns of the matrix
/// are exchanged.
///
/// __See also__:
#[inline]
pub fn transpose<A: Matrix>(a: A) -> FnMatrix1<A> {
FnMatrix1("TRANSPOSE", a)
}