# igakit

committed ffb5410

Modify NURBS.breaks() to optionally return multiplicities

# src/igakit/nurbs.py

`         SpanIndex = _bsp.SpanIndex`
`         return SpanIndex(p, U)`
` `
`-    def breaks(self, axis=None):`
`+    def breaks(self, axis=None, mults=False):`
`         """`
`-        Breaks (unique knot values).`
`+        Breaks (unique knot values) and multiplicities.`
`         """`
`         try: np_unique = np.lib.arraysetops.unique`
`         except AttributeError: np_unique = np.unique1d`
`         axes = range(self.dim)`
`         if axis is None:`
`-            return [self.breaks(i) for i in axes]`
`+            return [self.breaks(i, mults) for i in axes]`
`         i = axes[axis]`
`         p = self.degree[i]`
`         U = self.knots[i]`
`-        return np_unique(U[p:-p])`
`+        if not mults:`
`+            return np_unique(U[p:-p])`
`+        u, idx = np_unique(U[p:-p], return_inverse=True)`
`+        s = np.bincount(idx)`
`+        FindMult = _bsp.FindMult`
`+        m = len(U)-1; n = m-p-1;`
`+        for k, j in ((p, 0), (n, -1)):`
`+            mult = FindMult(p, U, u[j], k)`
`+            s[j] = min(mult, p)`
`+        return u, s`
` `
`     #`
` `
`         assert U[p] <= value <= U[-p-1]`
`         #`
`         mult = _bsp.FindMult(p, U, value)`
`+        mult = min(mult, p)`
`         if times is None: times = mult`
`-        times = min(times, mult, p)`
`+        times = min(times, mult)`
`         assert times >= 0`
`         if times == 0: return self`
`         if value <= U[p]: return self`
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.