src/sparse_matrix.rb
# Scalar multiply increases/decreases itself by value.
Scalar multiply increases/decreases itself by value.
Scalar multiply increases / decreases itself by value .
def scalar_multiply(value)
        if !(value.is_a? Integer) and !(value.is_a? Float)
            raise TypeError, "The input object is not an Integer or Float. It is a #{value.class}."
        end
        product_matrix = self.get_copy
        @sparse_hash.each { |key, hashValue|
            product_matrix.set_element(key, hashValue * value )
        }
        return product_matrix
    end
def scalar_multiply ( value ) if ! ( value . is_a? Integer ) and ! ( value . is_a? Float ) raise TypeError , "The input object is not an Integer or Float. It is a #{value.class}." end product_matrix = self . get_copy @sparse_hash . each { | key , hashValue | product_matrix . set_element ( key , hashValue * value ) } return product_matrix end
Scalar multiply increases/decreases itself by value.
Scalar multiply increases / decreases itself by value .
# Check pre-conditions: value must be an Integer
value
<not_specific>