Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# cogent.maths.matrix.distance.DistanceMatrix.scale

All Samples(6)  |  Call(6)  |  Derive(0)  |  Import(0)

```            n = deepcopy(m)
dm = DistanceMatrix(data=n, RowOrder=m.keys(), Pad=False)
dm.scale(lambda x: x**2)
self.assertEqual(dm['A']['A'],m['A']['A']**2)
self.assertEqual(dm['B']['A'],m['B']['A']**2)
```
```            n = deepcopy(m)
dm = DistanceMatrix(data=n, RowOrder=m.keys(), Pad=False)
dm.scale(lambda x: x**3)
self.assertEqual(dm['A']['A'],m['A']['A']**3)
self.assertEqual(dm['B']['A'],m['B']['A']**3)
```
```            n = deepcopy(m)
dm = DistanceMatrix(data=n, RowOrder=m.keys(), Pad=False)
dm.scale(lambda x: 10**-(x/10.0))
self.assertFloatEqual(dm['A']['A'],10**-(m['A']['A']/10.))
self.assertFloatEqual(dm['B']['A'],10**-(m['B']['A']/10.))
```

```            n = deepcopy(m)
dm = DistanceMatrix(data=n, RowOrder=m.keys(), Pad=False)
dm.scale(lambda x: x**2)
self.assertEqual(dm['A']['A'],m['A']['A']**2)
self.assertEqual(dm['B']['A'],m['B']['A']**2)
```
```            n = deepcopy(m)
dm = DistanceMatrix(data=n, RowOrder=m.keys(), Pad=False)
dm.scale(lambda x: x**3)
self.assertEqual(dm['A']['A'],m['A']['A']**3)
self.assertEqual(dm['B']['A'],m['B']['A']**3)
```
```            n = deepcopy(m)
dm = DistanceMatrix(data=n, RowOrder=m.keys(), Pad=False)
dm.scale(lambda x: 10**-(x/10.0))
self.assertFloatEqual(dm['A']['A'],10**-(m['A']['A']/10.))
self.assertFloatEqual(dm['B']['A'],10**-(m['B']['A']/10.))
```