This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WorkoutsController < ApplicationController | |
... | |
def index | |
@workouts = Workout.complete | |
end | |
def fix_incompletes | |
@workouts = Workout.needs_revision |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Workout | |
property :description, type: String | |
property :date, type: DateTime | |
validates :date, presence: true | |
... | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _cs_matrix(_data_matrix, _minmax_mixin, IndexMixin): | |
... | |
def toarray(self, order=None, out=None): | |
if out is None and order is None: | |
order = self._swap('cf')[0] | |
out = self._process_toarray_args(order, out) | |
if not (out.flags.c_contiguous or out.flags.f_contiguous): | |
raise ValueError('Output array must be C or F contiguous') | |
# align ideal order with output array order |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class spmatrix(object): | |
... | |
def _process_toarray_args(self, order, out): | |
if out is not None: | |
if order is not None: | |
raise ValueError('order cannot be specified if out ' | |
'is not None') | |
if out.shape != self.shape or out.dtype != self.dtype: | |
raise ValueError('out array must be same dtype and shape as ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
python generate_sparsetools.py | |
Generate manual wrappers for C++ sparsetools code. | |
Type codes used: | |
'i': integer scalar | |
'I': integer array | |
'T': data array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Compute B += A for CSR matrix A, C-contiguous dense matrix B | |
* | |
* Input Arguments: | |
* I n_row - number of rows in A | |
* I n_col - number of columns in A | |
* I Ap[n_row+1] - row pointer | |
* I Aj[nnz(A)] - column indices | |
* T Ax[nnz(A)] - nonzero values | |
* T Bx[n_row*n_col] - dense matrix in row-major order |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class spmatrix(object): | |
""" This class provides a base class for all sparse matrices. It | |
cannot be instantiated. Most of the work is provided by subclasses. | |
""" | |
__array_priority__ = 10.1 | |
ndim = 2 | |
def __init__(self, maxprint=MAXPRINT): | |
self._shape = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class _cs_matrix(_data_matrix, _minmax_mixin, IndexMixin): | |
"""base matrix class for compressed row and column oriented matrices""" | |
def __init__(self, arg1, shape=None, dtype=None, copy=False): | |
_data_matrix.__init__(self) | |
if isspmatrix(arg1): | |
... | |
elif isinstance(arg1, tuple): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_shape(args, current_shape=None): | |
"""Imitate numpy.matrix handling of shape arguments""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class coo_matrix(_data_matrix, _minmax_mixin): | |
... | |
format = 'coo' | |
def __init__(self, arg1, shape=None, dtype=None, copy=False): | |
_data_matrix.__init__(self) | |
if isinstance(arg1, tuple): | |
... |