SparseMatrixProject 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml ADDED
@@ -0,0 +1,14 @@
1
+ language: Ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - jruby-18mode # JRuby in 1.8 mode
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+ - rbx-18mode
7
+ - rbx-19mode
8
+ - 1.8.7
9
+
10
+
11
+
12
+
13
+
14
+
data/Gemfile CHANGED
@@ -1,4 +1,17 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in SparseMatrixProject.gemspec
4
+ <<<<<<< HEAD
4
5
  gemspec
6
+ =======
7
+ gem 'nokogiri'
8
+ gem 'rack', '~>1.1'
9
+ gem 'rspec', :require => 'spec'
10
+
11
+ gem 'rake'
12
+ gem 'rspec'
13
+ gem 'guard'
14
+ gem 'guard-rspec'
15
+ gem 'guard-bundler'
16
+ gem 'guard-gitpusher'
17
+ >>>>>>> 74a54b5fee97668eefe84bad85ac0e0a70ac726c
data/Gemfile~ ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'nokogiri'
4
+ gem 'rack', '~>1.1'
5
+ gem 'rspec', :require => 'spec'
6
+
7
+ gem 'rake'
8
+ gem 'rspec'
9
+ gem 'guard'
10
+ gem 'guard-rspec'
11
+ gem 'guard-bundler'
12
+ gem 'guard-gitpusher'
data/Guardfile ADDED
@@ -0,0 +1,8 @@
1
+ guard 'bundler' do
2
+ watch('Gemfile')
3
+ end
4
+
5
+ guard 'rspec', :version => 2 do
6
+ watch(%r{^spec/.+_spec\.rb$})
7
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
8
+ end
data/LICENSE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  Copyright (c) 2013 Jacobo Saavedra
2
-
2
+
3
3
  MIT License
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
data/LICENSE.txt~ ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jacobo Saavedra
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
+ <<<<<<< HEAD
1
2
  # SparseMatrixProject
2
-
3
+
3
4
  TODO: Write a gem description
4
5
 
5
6
  ## Installation
@@ -27,3 +28,17 @@ TODO: Write usage instructions here
27
28
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
29
  4. Push to the branch (`git push origin my-new-feature`)
29
30
  5. Create new Pull Request
31
+ =======
32
+ PRÁCTICA 11
33
+ ---------------------
34
+ Aarón José Vera Cerdeña
35
+
36
+ Jacobo Saavedra Valdés
37
+
38
+ 1.Utilizamos la práctica 10 con la estructura ya creada.
39
+ 2.Añadimos a los métodos suma y producto de matrices las funciones upto,times
40
+ y collect sustituyendolo por los bucles correspondientes.
41
+ 3.Comentamos todo el código siguiendo la estructura por niveles que exige el RDOC.
42
+ 4.Creamos la segunda version de la gema con las nuevas implementaciones.
43
+ 5.Subimos la gema a RubyGems mediante el comando gem push <gema>.
44
+ >>>>>>> 74a54b5fee97668eefe84bad85ac0e0a70ac726c
data/README.md~ ADDED
@@ -0,0 +1,47 @@
1
+ <<<<<<< HEAD
2
+ # SparseMatrixProject
3
+
4
+ TODO: Write a gem description
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'SparseMatrixProject'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install SparseMatrixProject
19
+
20
+ ## Usage
21
+
22
+ TODO: Write usage instructions here
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
31
+ =======
32
+ PRÁCTICA 10
33
+ ---------------------
34
+ Aarón José Vera Cerdeña
35
+
36
+ Jacobo Saavedra Valdés
37
+
38
+ 1.Utilizamos la práctica 9 creamos la gema e implementamos la jerarquía de clases dentro de la misma,
39
+ donde se heredaban las mismas.
40
+ Para diseñar la estructura donde implementar los métodos que hiciesen operaciones entre operaciones
41
+ densas y dispersas.
42
+ 2.En la parte Test Unit creamos un fichero tc_Matrices.rb donde realizamos las pruebas unitarias utilizando
43
+ el comando assert_equal para comprobar las operaciones entre las diferentes matrices.
44
+ 3.Rellenar el archivo spec implementando las operaciones entre las matrices.
45
+ 4.Implementar los nuevos métodos de máximo y mínimo para comprobar su funcionamiento con las mátrices.
46
+ 5.Subir la gema a RubyGems mediante el comando gem push <gema>.
47
+ >>>>>>> 74a54b5fee97668eefe84bad85ac0e0a70ac726c
data/Rakefile CHANGED
@@ -10,5 +10,9 @@ task :default => :spec
10
10
  desc "Run UniTest Matrices"
11
11
  task :test do
12
12
  sh "ruby -Ilib -Itest test/tc_Matrices.rb"
13
+ <<<<<<< HEAD
13
14
  end
14
15
 
16
+ =======
17
+ end
18
+ >>>>>>> 74a54b5fee97668eefe84bad85ac0e0a70ac726c
data/Rakefile~ ADDED
@@ -0,0 +1,17 @@
1
+ <<<<<<< HEAD
2
+ require "bundler/gem_tasks"
3
+ =======
4
+ $:.unshift File.dirname(__FILE__) + 'lib'
5
+ $:.unshift './lib', './spec'
6
+
7
+ require 'rspec/core/rake_task'
8
+ RSpec::Core::RakeTask.new
9
+ task :default => :spec
10
+
11
+ desc "Run UniTest Matrices"
12
+ task :test do
13
+ sh "ruby -Ilib -Itest test/tc_Matrices.rb"
14
+ end
15
+
16
+
17
+ >>>>>>> 74a54b5fee97668eefe84bad85ac0e0a70ac726c
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'SparseMatrixProject/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "SparseMatrixProject"
8
+ spec.version = SparseMatrixProject::VERSION
9
+ spec.authors = ["Jacobo Saavedra Valdes", "Aaron Jose Vera Cerdeña"]
10
+ spec.email = ["alu0100658682@ull.edu.es", "alu0100537451@ull.edu.es"]
11
+ spec.description = %q{Gema para realizar suma y resta entre matrices densas y dispersas}
12
+ spec.summary = %q{Matrices dispersas y densas}
13
+ spec.homepage = ""
14
+ spec.license = ""
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'SparseMatrixProject'
File without changes
@@ -1,3 +1,3 @@
1
1
  module SparseMatrixProject
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,3 @@
1
+ module SparseMatrixProject
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "SparseMatrixProject/version"
2
+
3
+ module SparseMatrixProject
4
+ # Your code goes here...
5
+ end
data/lib/gcd.rb ADDED
@@ -0,0 +1,15 @@
1
+ #=gcd.rb
2
+ #
3
+ # Autores:: Aarón José Vera Cerdeña,Jacobo Saavedra Valdes
4
+ #
5
+ # == Este fichero contiene:
6
+ # Se calcula el máximo común divisor de las fracciones
7
+ #
8
+ def gcd(u, v)
9
+ u, v = u.abs, v.abs
10
+ while v > 0
11
+ u, v = v, u % v
12
+ end
13
+ u
14
+ end
15
+
data/lib/gcd.rb~ ADDED
@@ -0,0 +1,8 @@
1
+ def gcd(u, v)
2
+ u, v = u.abs, v.abs
3
+ while v > 0
4
+ u, v = v, u % v
5
+ end
6
+ u
7
+ end
8
+
@@ -0,0 +1,71 @@
1
+ require "../lib/matriz.rb"
2
+
3
+
4
+
5
+ matrizden1 = Densa.new(3,3[1,3,5,2,4,6,7,8,9])
6
+ matrizden2 = Densa.new(3,3[1,3,5,2,4,6,7,8,9])
7
+ matrizdenS = Densa.new(3,3[0,0,0,0,0,0,0,0,0])
8
+
9
+ matrizdenS = matrizden1 + matrizden2
10
+ puts "#{(matrizdenS.to_s)}"
11
+ =begin
12
+ matriz2 = Matrices.new([[2,4,6],[1,3,5],[2,7,8]])
13
+
14
+ matrizs = Matrices.new([[0,0,0],[0,0,0],[0,0,0]])
15
+
16
+ matriz4 = Matrices.new([[5,5,7],[4,5,8],[7,8,9]])
17
+
18
+ matriz5 = Matrices.new([[2,4,6],[1,3,5],[2,7,8]])
19
+
20
+ matrizr = Matrices.new([[0,0,0],[0,0,0],[0,0,0]])
21
+
22
+ matrizt = Matrices.new([[5,5,7],[4,5,8],[7,8,9]])
23
+
24
+ matrizo = Matrices.new([[2,4,6],[1,3,5],[2,7,8]])
25
+
26
+ ####
27
+ puts "####"
28
+ puts "#{matriz1.dispersa}"
29
+ puts "####"
30
+ ####
31
+
32
+ puts "Matriz 1"
33
+
34
+ puts "#{matriz1.mostrar}"
35
+
36
+ puts "Matriz 2"
37
+
38
+ puts "#{matriz2.mostrar}"
39
+ ##SUMA
40
+ matrizs = matriz1 + matriz2
41
+
42
+ puts "SUMA:"
43
+
44
+ puts "#{matrizs.mostrar}"
45
+ ##RESTA
46
+ puts "RESTA:"
47
+
48
+ matrizr = matriz4 - matriz5
49
+
50
+ puts "#{matrizr.mostrar}"
51
+ ##PRODUCTO
52
+ puts "PRODUCTO:"
53
+
54
+ matriz3 = matriz1 * matriz2
55
+
56
+ puts "#{matriz3.mostrar}"
57
+ ##TRASPUESTAS
58
+ puts "TRASPUESTA de la primera matriz:"
59
+
60
+ puts "#{matrizt.traspuesta.mostrar}"
61
+
62
+ ##OPUESTA
63
+
64
+ #
65
+ puts "OPUESTA de la segunda matriz:"
66
+
67
+ puts "#{matrizo.opuesta.mostrar}"
68
+
69
+
70
+
71
+ =end