stair_car 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -55,7 +55,17 @@ Sparse: spzeros, spones, sprand, spasc, spdesc
55
55
  You can get any element by passing in its row and column:
56
56
 
57
57
  m[0,1]
58
- => 2
58
+ => <#PMatrix() 1x1 dense>
59
+ 2
60
+
61
+ ### Get Float Value:
62
+
63
+ All lookups with [row,col] return a subview, use #value_at to get the float value.
64
+
65
+ m.value_at(0,1)
66
+ => 2.0
67
+
68
+ Keep in mind that all math operations can be done without converting back to float.
59
69
 
60
70
  ### Subviews
61
71
 
@@ -104,6 +104,10 @@ module StairCar
104
104
  rows = convert_indicies(rows, self.rows)
105
105
  cols = convert_indicies(cols, self.cols)
106
106
 
107
+ if value.is_a?(PMatrix) && value.rows == 1 && value.cols == 1
108
+ value = value.value_at(0,0)
109
+ end
110
+
107
111
  # Set either the value in a cell or a subview with a matrix
108
112
  if rows && cols && rows.size == 1 && cols.size == 1 && rows.first.is_a?(Fixnum) && cols.first.is_a?(Fixnum)
109
113
  @data.set(rows.first, cols.first, value)
data/stair_car.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "stair_car"
7
- gem.version = "0.1.3"
7
+ gem.version = "0.1.4"
8
8
  gem.authors = ["Ryan Stout"]
9
9
  gem.email = ["ryanstout@gmail.com"]
10
10
  gem.description = "StairCar is a fully featured matrix library for jruby (think matlab or numpy)"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stair_car
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-19 00:00:00.000000000 Z
12
+ date: 2013-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec