org.kramerlab.autoencoder.math.matrix

Mat

class Mat extends VectorSpace[Mat] with Visualizable with Serializable

Implementation of dense matrices in row major format with double values.

This is a minimalistic implementation of a dense double matrix. The main goal is to write an implementation that is too simple to break and too simple too introduce some sneaky autoboxing issues somewhere. It has no complex dependencies on any libraries, and is supposed to be used for testing and performance measurement of more advanced implementations.

Notice: Although it's stupid and ugly, it still beats the crap out of single-threaded java libraries like EJML... :/

Replace it by CUDA or something more performant later.

Linear Supertypes
Serializable, Serializable, Visualizable, VectorSpace[Mat], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Mat
  2. Serializable
  3. Serializable
  4. Visualizable
  5. VectorSpace
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Mat()

  2. new Mat(height: Int, width: Int)

  3. new Mat(height: Int, width: Int, defaultValue: Double)

  4. new Mat(height: Int, width: Int, defaultValue: Double, entries: Array[Array[Double]])

    Attributes
    protected

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def *(other: Mat): Mat

    matrix multiplication

  5. def *(d: Double): Mat

    Definition Classes
    MatVectorSpace
  6. def *=(d: Double): Unit

  7. def +(other: Mat): Mat

    Definition Classes
    MatVectorSpace
  8. def +=(other: Mat): Unit

  9. def -(other: Mat): Mat

    Definition Classes
    MatVectorSpace
  10. def -=(other: Mat): Unit

  11. def /(d: Double): Mat

    Definition Classes
    MatVectorSpace
  12. def /=(d: Double): Unit

  13. def :*(other: Mat): Mat

    Multiplies this matrix with other matrix pointwise

  14. def :*=(other: Mat): Mat

    Multiplies this matrix with other matrix pointwise and writes the result into this matrix

  15. def :/(other: Mat): Mat

  16. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  18. def \(other: Mat): Mat

    Solving dense linear equations with pivoted LU-decomposition

  19. def apply(rows: RangeSelector, cols: RangeSelector): Mat

  20. def apply(i: Int): Double

  21. def apply(r: Int, c: Int): Double

  22. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  23. def clone(): Mat

    Cloning this matrix

    Cloning this matrix

    Definition Classes
    Mat → AnyRef
  24. val defaultValue: Double

  25. def dot(other: Mat): Double

    Scalar product: sum of the results of the pointwise multiplication

    Scalar product: sum of the results of the pointwise multiplication

    Definition Classes
    MatVectorSpace
  26. val entries: Array[Array[Double]]

  27. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  28. def equals(other: Any): Boolean

    Definition Classes
    Mat → AnyRef → Any
  29. def exists(p: (Double) ⇒ Boolean): Boolean

  30. def existsWithIndex(p: (Int, Int, Double) ⇒ Boolean): Boolean

  31. def filter(p: (Double) ⇒ Boolean): Mat

    Removes all values from the matrix that do not fulfill the predicate p.

    Removes all values from the matrix that do not fulfill the predicate p. The removed values are replaced by the default value.

  32. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  33. def foldRows(start: Double)(f: (Double, Double) ⇒ Double): Mat

  34. def forall(p: (Double) ⇒ Boolean): Boolean

  35. def forallWithIndex(p: (Int, Int, Double) ⇒ Boolean): Boolean

  36. def foreach[U](f: (Double) ⇒ U): Unit

    Executes the specified procedure f for each entry of this matrix

  37. def foreachWithIndex[U](f: (Int, Int, Double) ⇒ U): Unit

    Inverses the control over the process of iteration through the entries of the matrix.

    Inverses the control over the process of iteration through the entries of the matrix.

    It would be interesting to compare which impact such an indirection has on performance: if would eliminate tons of boilerplate code. Notice that this iteration strategy is not applied in the most potentially time critical methods (map, filter, ...) of this class, although it obviously would make the code much more concise. We do not use it, because we really want to measure the performance of the implementations that are as low level as possible. However, this method is used when the performance is irrelevant, as in toString for example.

  38. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  39. def hashCode(): Int

    Definition Classes
    Mat → AnyRef → Any
  40. val height: Int

  41. def isInfinite: Boolean

    Definition Classes
    MatVectorSpace
  42. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  43. def isInvalid: Boolean

    Definition Classes
    MatVectorSpace
  44. def isNaN: Boolean

    Definition Classes
    MatVectorSpace
  45. def l2Norm: Double

  46. def l2NormSq: Double

    Calculates the squared Frobenius norm of the matrix

  47. def luDecomposition: (Mat, Array[Int])

  48. def map(f: (Double) ⇒ Double): Mat

    Maps entries of the matrix with the specified function f.

  49. def mapWithIndex(f: (Int, Int, Double) ⇒ Double): Mat

  50. def map_naive(f: (Double) ⇒ Double): Mat

  51. def map_parallel(f: (Double) ⇒ Double): Mat

  52. def naive_*(other: Mat): Mat

    Naive implementation of the dense matrix multiplication

  53. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  54. def negate(): Unit

    Replaces all entries by their additive inverses

  55. def norm: Double

    Definition Classes
    VectorSpace
  56. def normSq: Double

    Definition Classes
    VectorSpace
  57. def normalized: Mat

    Definition Classes
    VectorSpace
  58. final def notify(): Unit

    Definition Classes
    AnyRef
  59. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  60. def permutateRows(permutation: Array[Int]): Unit

  61. def reshape(newHeight: Int, newWidth: Int): Mat

    Reshapes the matrix row-wise

  62. def sameEntries(other: Mat): Boolean

  63. def shuffleRows(): Unit

  64. def size: (Int, Int)

  65. def sumRows: Mat

    Returns a new matrix that looks like multiplication of constant-1-row-vector from the left

  66. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  67. def tiled_*(other: Mat): Mat

    Tiled matrix multiply with tile size = 16

  68. def tiled_parallel_*(other: Mat): Mat

    Tiled matrix multiply

  69. def toArray: Array[Array[Double]]

  70. def toImage: BufferedImage

    Definition Classes
    MatVisualizable
  71. def toImage(colormap: (Double) ⇒ Int): BufferedImage

    Definition Classes
    MatVisualizable
  72. def toImage(w: Int, h: Int): BufferedImage

    Definition Classes
    Visualizable
  73. def toString(): String

    Creates a multiline string representation of this matrix.

    Creates a multiline string representation of this matrix. All entries are indented to the right, the exponentials of the entries are left independent (no global rescaling occurs). It doesn't look very nice, but it's good enough for debugging.

    Definition Classes
    Mat → AnyRef → Any
  74. def transpose: Mat

    Transposes the matrix.

    Transposes the matrix. This method creates a completely new matrix, all values are copied

  75. def unary_-: Mat

    Unary prefix minus

    Unary prefix minus

    Definition Classes
    MatVectorSpace
  76. def update(rows: RangeSelector, cols: RangeSelector, other: Mat): Unit

  77. def update(r: Int, c: Int, d: Double): Unit

  78. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  79. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  80. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  81. val width: Int

  82. def zero: Mat

    Creates new matrix of same dimension of this one, filled with zeros, and with a zero as default value

    Creates new matrix of same dimension of this one, filled with zeros, and with a zero as default value

    Definition Classes
    MatVectorSpace

Inherited from Serializable

Inherited from Serializable

Inherited from Visualizable

Inherited from VectorSpace[Mat]

Inherited from AnyRef

Inherited from Any

Ungrouped