//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** @author John Miller * @version 1.5 * @date Sun Jul 15 16:50:28 EDT 2018 * @see LICENSE (MIT style license file). * * @see http://www.scala-lang.org/node/724 * @see http://www.scala-lang.org/old/node/12014.html */ package scalation import math.FunctionS2S //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** The `linalgebra` package contains classes, traits and objects for * linear algebra, including vectors and matrices for real and complex numbers. */ package object linalgebra { /** The type definitions for functions involving base types from `linalgebra` (f: T => T), * where T is a vector or matrix. * @see also `scalation.math` */ // type FunctionS2S = Double => Double // function of a scalar - Double - in `math` type FunctionV2S = VectorD => Double // function of a vector - VectorD type FunctionV_2S = VectoD => Double // function of a vector - VectoD - base trait type FunctionV2V = VectorD => VectorD // vector-valued function of a vector - VectorD type FunctionV_2V = VectoD => VectoD // vector-valued function of a vector - VectoD - base trait type FunctionM2M = MatrixD => MatrixD // matrix-valued function of a matrix - MatrixD type FunctionM_2M = MatriD => MatriD // matrix-valued function of a matrix - MatriD - base trait //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** Vectorize a scalar function (S2S) to create a vector function (V_2V). * @param f the scalar function to vectorize */ def vectorize (f: FunctionS2S): FunctionV_2V = (x: VectoD) => x.map (f(_)) //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** Matrixize a scalar function (S2S) to create a matrix function (M_2M). * @param f the scalar function to matrixize */ def matrixize (f: FunctionV_2V): FunctionM_2M = (x: MatriD) => x.map (f(_)) } // linalgebra package object