@@ -84,7 +84,7 @@ void init_matrix(pybind11::module_ &m) {
8484 .def (" getFirstNColumns" , (void (Matrix::*)(int , Matrix&) const ) &Matrix::getFirstNColumns)
8585
8686 .def (" mult" ,[](const Matrix& self, const Matrix& other){
87- Matrix* result = new Matrix () ;
87+ Matrix* result = nullptr ;
8888 self.mult (other,result);
8989 return result;
9090 },py::return_value_policy::take_ownership)
@@ -94,7 +94,7 @@ void init_matrix(pybind11::module_ &m) {
9494 })
9595 .def (" mult" , (void (Matrix::*)(const Matrix&, Matrix&) const ) &Matrix::mult)
9696 .def (" mult" , [](Matrix& self, const Vector& other){
97- Vector* result = new Vector () ;
97+ Vector* result = nullptr ;
9898 self.mult (other,result);
9999 return result;
100100 }, py::return_value_policy::take_ownership)
@@ -112,7 +112,7 @@ void init_matrix(pybind11::module_ &m) {
112112 })
113113
114114 .def (" elementwise_mult" ,[](const Matrix& self, const Matrix& other) {
115- Matrix* result = new Matrix () ;
115+ Matrix* result = nullptr ;
116116 self.elementwise_mult (other, result);
117117 return result;
118118 }, py::return_value_policy::take_ownership)
@@ -123,7 +123,7 @@ void init_matrix(pybind11::module_ &m) {
123123 .def (" elementwise_mult" ,(void (Matrix::*)(const Matrix&,Matrix&) const ) &Matrix::elementwise_mult)
124124
125125 .def (" elementwise_square" ,[](const Matrix& self) {
126- Matrix* result = new Matrix () ;
126+ Matrix* result = nullptr ;
127127 self.elementwise_square (result);
128128 return result;
129129 },py::return_value_policy::take_ownership)
@@ -135,7 +135,7 @@ void init_matrix(pybind11::module_ &m) {
135135 .def (" multPlus" , (void (Matrix::*)(Vector&,const Vector&,double ) const ) &Matrix::multPlus)
136136
137137 .def (" transposeMult" ,[](const Matrix& self, const Matrix& other) {
138- Matrix* result = new Matrix () ;
138+ Matrix* result = nullptr ;
139139 self.transposeMult (other, result);
140140 return result;
141141 },py::return_value_policy::take_ownership)
@@ -145,7 +145,7 @@ void init_matrix(pybind11::module_ &m) {
145145 })
146146 .def (" transposeMult" , (void (Matrix::*)(const Matrix&, Matrix&) const ) &Matrix::transposeMult)
147147 .def (" transposeMult" ,[](const Matrix& self, const Vector& other) {
148- Vector* result = new Vector () ;
148+ Vector* result = nullptr ;
149149 self.transposeMult (other, result);
150150 return result;
151151 },py::return_value_policy::take_ownership)
0 commit comments