# matrix.degree: Degree of each item of the matrix In polyMatrix: Infrastructure for Manipulation Polynomial Matrices

## Description

Returns a matrix obtained by applying a function `degree()` for each element of the matrix.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10``` ```matrix.degree(x) ## S4 method for signature 'matrix' matrix.degree(x) ## S4 method for signature 'polynomial' matrix.degree(x) ## S4 method for signature 'polyMatrix' matrix.degree(x) ```

## Arguments

 `x` an R object

## Details

Degree of each item is calculated using `degree()` which is defined for polynomials as the highest degree of the terms with non-zero coefficients.

For convenience this function is defined for any object, but returns zero for non polynomial objects.

## Value

If the argument is a matrix, the result is a matrix of the same size containing the degrees of the matrix items.

For a numerical matrix the value is always a zero matrix of the same size

For a polynomial the value is the degree of the polynomial

## Methods (by class)

• `matrix`: the degree of a numerical matrix is a zero matrix for compatibility

• `polynomial`: the degree of a polynomial

• `polyMatrix`: a matrix of degrees for each polynomial item of the source matrix

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18``` ```# numerical matrices matrix.degree(matrix(1:6, 2, 3)) ## [,1] [,2] [,3] ## [1,] 0 0 0 ## [2,] 0 0 0 # polynomials matrix.degree(parse.polynomial("x + 1")) ## 1 matrix.degree(parse.polynomial("x^3 + 1")) ## 3 matrix.degree(parse.polynomial("1")) ## 0 # polynomial matrices matrix.degree(parse.polyMatrix( "x; x^2 + 1", "0; 2x")) ## [,1] [,2] ## [1,] 1 2 ## [2,] 0 1 ```

polyMatrix documentation built on July 18, 2021, 5:06 p.m.