Skip to content

Trying to understand what's happening #3

Description

Hello,

I'm trying to understand what's happening here exactly, as I'm not knowing Ruby, and trying to translate it to Swift:

input.each_with_index do |input_scalar, input_index|
                output.each_with_index do |output_scalar, output_index|

                    self.matrix[input_index] ||= []

                    self.matrix[input_index][output_index] ||= 0

                    self.matrix[input_index][output_index] += input_buffer[input_index] * output_buffer[output_index]

                end

            end

What is the ||= for? What exactly is achieved by this fragment in Network.rb?

Thanks for your support!

Best regards,
Hardy

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions