add one unit test case for warmstart
@@ -293,3 +293,46 @@ static bool test_iter_irgnm_l1(void)
UT_REGISTER_TEST(test_iter_irgnm_l1);
+
+static bool test_iter_lsqr_warmstart(void)
+{
+ enum { N = 3 };
+ long dims[N] = { 4, 2, 3 };
+
+ complex float* src1 = md_alloc(N, dims, CFL_SIZE);
+ complex float* dst1 = md_alloc(N, dims, CFL_SIZE);
+ complex float* dst2 = md_alloc(N, dims, CFL_SIZE);
+
+ md_zfill(N, dims, src1, 1.);
+ md_zfill(N, dims, dst1, 0.);
+
+ md_copy(N, dims, dst2, src1, CFL_SIZE);
+
+ const struct linop_s* id = linop_identity_create(3, dims);
+
+ linop_forward_unchecked(id, dst1, src1);
+
+ const struct operator_p_s* lsqr = NULL;
+
+ struct iter_conjgrad_conf conf = iter_conjgrad_defaults;
+ conf.maxiter = 0;
+
+ lsqr = lsqr2_create(&lsqr_defaults,
+ iter2_conjgrad, CAST_UP(&conf),
+ NULL, true, id, NULL,
+ 0, NULL, NULL, NULL);
+
+ operator_p_apply(lsqr, 1., N, dims, dst2, N, dims, src1);
+
+ double err = md_znrmse(N, dims, dst1, dst2);
+
+ linop_free(id);
+
+ md_free(src1);
+ md_free(dst1);
+ md_free(dst2);
+
+ UT_ASSERT(err < UT_TOL);
+}
+
+UT_REGISTER_TEST(test_iter_lsqr_warmstart);
