Sha256: 41752eac4ad78eca499ffa99d51a8a2fa9494a3939d9dd470d95e3303f223f82

Contents?: true

Size: 612 Bytes

Versions: 5

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Numo::Linalg do
  describe 'det' do
    let(:m) { 5 }
    let(:mat_a) { rand_square_real_mat(m) }
    let(:mat_b) { rand_square_complex_mat(m) }

    it 'calculates the dererminant of a square real matrix' do
      det = described_class.eigvals(mat_a).prod.real
      expect(described_class.det(mat_a)).to be_within(det).of(ERR_TOL)
    end

    it 'calculates the dererminant of a square complex matrix' do
      det = described_class.eigvals(mat_b).prod
      expect((described_class.det(mat_b) - det).abs).to be < ERR_TOL
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
numo-linalg-0.1.7 spec/linalg/function/det_spec.rb
numo-linalg-0.1.6 spec/linalg/function/det_spec.rb
numo-linalg-0.1.5 spec/linalg/function/det_spec.rb
numo-linalg-0.1.4 spec/linalg/function/det_spec.rb
numo-linalg-0.1.3 spec/linalg/function/det_spec.rb