Module JBLAS::MatrixArithMixin
In: lib/jblas/mixin_arith.rb

Mixin for syntactic sugar for arithmetic operations.

Collected in MatrixMixin.

Roughly defines the following types of operators:

  • arithmetic (+,-,*,/,…)
  • logical operations (|,&,…)
  • logical tests (==,>,<,…)
  • arithmetic operations with column and row vectors (add_column_vector, …)

Methods

&   *   **   +   -   -@   /   <   <=   ==   ===   >   >=   ^   add   add!   add_column_vector!   add_row_vector!   addi   and!   div   div!   div_column_vector!   div_row_vector!   divi   eq!   ge!   gt!   le!   lt!   mmul!   mul   mul!   mul_column_vector!   mul_row_vector!   muli   ne!   or!   sub   sub!   sub_column_vector!   sub_row_vector!   subi   xor!   |  

Public Instance methods

Element-wise logical and.

[Source]

# File lib/jblas/mixin_arith.rb, line 124
    def &(o); self.and(o); end

Multiply this matrix with o. If o is a matrix, this matrix-matrix multiplication. If you want element-wise multiplication, you must use emul

[Source]

# File lib/jblas/mixin_arith.rb, line 54
    def *(o); mmul(o); end

Compute self to the power of o.

[Source]

# File lib/jblas/mixin_arith.rb, line 131
    def **(o); MatrixFunctions.pow(self, o); end

Add o to this matrix. Works with matrices and scalars.

[Source]

# File lib/jblas/mixin_arith.rb, line 48
    def +(o); add(o); end

Subtract o from this matrix. Works with matrices and scalars.

[Source]

# File lib/jblas/mixin_arith.rb, line 50
    def -(o); sub(o); end

Negating a matrix

[Source]

# File lib/jblas/mixin_arith.rb, line 58
    def -@; neg; end

Divide this matrix by o.

[Source]

# File lib/jblas/mixin_arith.rb, line 56
    def /(o); div(o); end

Element-wise test on less-than with o.

[Source]

# File lib/jblas/mixin_arith.rb, line 61
    def <(o); lt(o); end

Element-wise test on less-than-or-equal with o.

[Source]

# File lib/jblas/mixin_arith.rb, line 63
    def <=(o); le(o); end

Test on equality.

[Source]

# File lib/jblas/mixin_arith.rb, line 118
    def ==(o)
      #puts "== called with self = #{self.inspect}, o = #{o.inspect}"
      equals(o)
    end

Element-wise test on equality with o.

[Source]

# File lib/jblas/mixin_arith.rb, line 69
    def ===(o); eq(o); end

Element-wise test on greater-than with o.

[Source]

# File lib/jblas/mixin_arith.rb, line 65
    def >(o); gt(o); end

Element-wise test on greater-than-or-equal with o.

[Source]

# File lib/jblas/mixin_arith.rb, line 67
    def >=(o); ge(o); end

Element-wise logical exclusive-or.

[Source]

# File lib/jblas/mixin_arith.rb, line 128
    def ^(o); self.xor(o); end

Add matrices (see also +).

[Source]

# File lib/jblas/mixin_arith.rb, line 148
      def add(o); JAVA_METHOD; end

Add matrices in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 72
    def add!(s); addi(s); end

Add column vector to matrix in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 101
    def add_column_vector!(s); addi_column_vector(s); end

Add row vector to matrix in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 103
    def add_row_vector!(s); addi_row_vector(s); end

Add matrices in-place (see also add!).

[Source]

# File lib/jblas/mixin_arith.rb, line 150
      def addi(o, result=self); JAVA_METHOD; end

Element-wise logical "and" in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 94
    def and!(s); andi(s); end

Divide matrices element-wise (see also /)

[Source]

# File lib/jblas/mixin_arith.rb, line 163
      def div(o); JAVA_METHOD; end

Divide matrices element-wise in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 80
    def div!(s); divi(s); end

Multiply row vector element-wise with matrix in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 113
    def div_column_vector!(s); divi_column_vector(s); end

Divide matrix element-wise by row vector in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 115
    def div_row_vector!(s); divi_row_vector(s); end

Divide matric element-wise in-place (see also div!)

[Source]

# File lib/jblas/mixin_arith.rb, line 165
      def divi(o, result=self); JAVA_METHOD; end

Element-wise test for equality in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 82
    def eq!(s); eqi(s); end

Element-wise test for greater-than-or-equal in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 92
    def ge!(s); gei(s); end

Element-wise test for greater-than in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 90
    def gt!(s); gti(s); end

Element-wise test for less-than-or-equal in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 88
    def le!(s); lei(s); end

Element-wise test for less-than in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 86
    def lt!(s); lti(s); end

Matrix multiply matrices in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 78
    def mmul!(s); mmuli(s); end

Multiply matrices element-wise. (see also *)

[Source]

# File lib/jblas/mixin_arith.rb, line 158
      def mul(o); JAVA_METHOD; end

Multiply matrices element-wise in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 76
    def mul!(s); muli(s); end

Multiply row vector element-wise with matrix in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 109
    def mul_column_vector!(s); muli_column_vector(s); end

Divide matrix element-wise by column vector in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 111
    def mul_row_vector!(s); muli_row_vector(s); end

Multiply matrices element-wise in-place. (see also mul!)

[Source]

# File lib/jblas/mixin_arith.rb, line 160
      def muli(o, result=self); JAVA_METHOD; end

Element-wise test for inequality in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 84
    def ne!(s); nei(s); end

Element-wise logical "or" in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 96
    def or!(s); ori(s); end

Subtract matrices (see also -).

[Source]

# File lib/jblas/mixin_arith.rb, line 153
      def sub(o); JAVA_METHOD; end

Subtract matrices in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 74
    def sub!(s); subi(s); end

Subtract column vector from matrix in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 105
    def sub_column_vector!(s); subi_column_vector(s); end

Subtract column vector from matrix in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 107
    def sub_row_vector!(s); subi_row_vector(s); end

Subtract matrices in-place (see also sub!).

[Source]

# File lib/jblas/mixin_arith.rb, line 155
      def subi(o, result=self); JAVA_METHOD; end

Element-wise logical exclusive-or in-place.

[Source]

# File lib/jblas/mixin_arith.rb, line 98
    def xor!(s); xori(s); end

Element-wise logical or.

[Source]

# File lib/jblas/mixin_arith.rb, line 126
    def |(o); self.or(o); end

[Validate]