solve_trans: Compute a Linear Transformation on Arbitrary Vectors Using...

Description Usage Arguments Value Examples

View source: R/solve_trans.R

Description

The solution is calculated using the generalized inverse, so the inputs matrix need not be square.

Usage

1
solve_trans(xes, txes, to_solve = diag(nrow = nrow(xes)))

Arguments

xes

A matrix representing inputs to the transformation, of arbitrary rows and at least two columns.

txes

A matrix representing outputs of the transformation, of arbitrary rows and the same number of columns of @param xes.

to_solve

A matrix or numeric vector containing vectors on which the transformation will be computed, of the same number of rows as @param xes and arbitrary columns.

Value

A matrix representing the transformation applied to each vector of @param to_solve, with as many rows as @param t_xes and as many columns as @to_solve

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Example problems sourced from
#https://yutsumura.com/linear-algebra/linear-transformation-from-rn-to-rm/.
# Find matrix of transformation
solve_trans(matrix(c(1, 2, 3, 5), nrow =2 ), matrix(c(-3, 5, 7, 1), nrow = 2))

# Solve for a particular vector
solve_trans(
xes = matrix(c(0, 1, 0, 0, 1, 1), nrow = 3),
txes = matrix(c(1, 2, 0, 1), nrow = 2),
to_solve = matrix(c(0, 1, 2)))

ryan-heslin/matador documentation built on Dec. 22, 2021, 8:17 p.m.