• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

js51 / SplitP / 7894856040

14 Feb 2024 12:52AM UTC coverage: 46.404% (-5.7%) from 52.085%
7894856040

push

github

web-flow
Merge pull request #38 from js51/SplitP-rewrite

Re-organise modules

403 of 880 new or added lines in 12 files covered. (45.8%)

413 of 890 relevant lines covered (46.4%)

1.39 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.0
/splitp/matrix.py
1
import scipy
3✔
2
import numpy as np
3✔
3

4
def is_sparse(matrix):
3✔
NEW
5
    return scipy.sparse.issparse(matrix)
×
6

7
def frobenius_norm(matrix, data_table=None):
3✔
8
    """Calculates the Frobenius Norm for a given matrix"""
NEW
9
    if data_table is not None:
×
NEW
10
        return sum(val**2 for _, val in data_table.itertuples(index=False))**(1/2)
×
NEW
11
    if is_sparse(matrix):
×
NEW
12
        return sum(matrix[i, j]**2 for i, j in zip(*matrix.nonzero()))**(1/2)
×
13
    else:
NEW
14
        return np.sqrt(sum(val**2 for val in np.nditer(matrix)))
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc