Class: Reem::LowerTriangularMatrix
- Inherits:
-
Object
- Object
- Reem::LowerTriangularMatrix
- Defined in:
- lib/reem/lower_triangular_matrix.rb
Instance Method Summary collapse
-
#initialize(matrix) ⇒ LowerTriangularMatrix
constructor
A new instance of LowerTriangularMatrix.
- #transpose ⇒ Object
Constructor Details
#initialize(matrix) ⇒ LowerTriangularMatrix
Returns a new instance of LowerTriangularMatrix.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/reem/lower_triangular_matrix.rb', line 3 def initialize(matrix) columns, rows = matrix.sizes @ltm = NArray.float(columns, rows) (0...columns).each do |i| (0..i).each do |j| @ltm[j,i] = matrix[j,i] end end end |
Instance Method Details
#transpose ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/reem/lower_triangular_matrix.rb', line 14 def transpose @transpose ||= begin columns, rows = @ltm.sizes matrix = NArray.float(columns, rows) (0...columns).each do |i| (0...rows).each do |j| matrix[i,j] = @ltm[j,i] end end matrix end end |